Quick Tabs do not load extra JavaScript and CSS files required by ajax-loaded content

Flying Drupalist - December 29, 2008 - 16:07
Project:Quick Tabs
Version:6.x-2.0-rc3
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Issue tags:Ajax, JavaScript
Description

I want to call the tribune block via ajax, but of course that doesn't work.

What's the best way to make it work? I recently discovered http://blog.brandonaaron.net/2007/08/19/new-plugin-live-query
which might be a way to handle the issue, or use "event delegation", I'm not sure what that is.

Do you think this support is feasible? Thanks.

#1

SeeSchloss - March 9, 2009 - 19:27
Status:active» postponed (maintainer needs more info)

I'm not sure what you mean by "calling the tribune block via ajax"? Just sending messages, or getting messages, or getting the whole block in HTML form?

#2

Flying Drupalist - March 9, 2009 - 21:41

I would like to put the tribune block inside a quicktabs ajax Tab. So that the block is shown only when the tab is selected.

Simply doing that makes the tribune block lose all javascript, I would like to summon the block with ajax and still be able to use it normally. Thanks.

#3

Flying Drupalist - March 30, 2009 - 04:13

Hi, do you have any thoughts on this?

Thanks. :)

#4

SeeSchloss - March 31, 2009 - 21:16
Title:Tribune in Ajax» Quick Tabs do not load Javascript and CSS files included by a block
Project:Tribune» Quick Tabs
Version:6.x-1.x-dev» 6.x-2.0-rc3
Category:support request» feature request

Well... I've just tried it, and it seems to me that the problem is different : my module's javascript is not loaded at all. If it was, it should work fine regardless of whether I am using livequery or not.

The block hook just does drupal_add_js(drupal_get_path('module', 'tribune') .'/js/tribune.ajax.js'); before returning the block contents, and it looks like quicktabs doesn't quite understand that it should include the js too?

The css from drupal_add_css isn't loaded either.

I'm changing this issue to the quicktabs project, but if there's anything I can do on my side (except including the javascript and css on every page when the module is enabled, of course) to make it work...

#5

Pasqualle - April 1, 2009 - 02:20
Status:postponed (maintainer needs more info)» active

#345175: what could be inside ajax quicktabs
I don't know what could I add to this issue. This simply does not work at current state.
You have to switch to non-ajax quicktab..

#6

Flying Drupalist - April 1, 2009 - 03:52

Hi, thanks for your help.

Pasqualle, as the other issue says, is the problem here?
http://drupal.org/node/251578

Isn't it fixed? What else is needed?

If the problem is just the js and css not being loaded, I think I can just include them in the theme, since once aggregated and compressed, I don't think they're that big. Is that a good temporary solution?

#7

Pasqualle - April 1, 2009 - 14:37

I am not a js expert, but as I see we need much more than #251578: More flexible js/css ordering and an alter operation

Yes, if at page load you add the necessary js and css files for the ajax loaded content, then it should work..

#8

katbailey - April 1, 2009 - 23:49
Title:Quick Tabs do not load Javascript and CSS files included by a block» Quick Tabs do not load extra JavaScript and CSS files required by ajax-loaded content

@Miraploy that issue is for D7 - this functionality will never be supported in core in Drupal 6 as far as I know. What you need is to make sure the required js and css files will be loaded on the page. If additional js settings are required, then that's another matter and again is being addressed in D7 core (see #360081: Pass Settings Locally to JS Behaviors) but not D6.

#9

Flying Drupalist - May 24, 2009 - 21:03

Thank you for all of your help. I loaded the tribune ajax in every page. And in the block itself the tribune works fine.

However clicking on the tab to get to the tribune block reloads the page rather than insert the block by ajax.

Help on this matter would be appreciated.

#10

Flying Drupalist - May 24, 2009 - 21:40

Additionally I get this error. (attachment)

I think this is the settings thing you were talking about katbailey. I what probably happened was that the js error broke quicktabs js, leading to the page refresh. :(

Is there nothing that could be done?

Edit:

This error appears even when there is no QT with a tribune block on page.

AttachmentSize
tribune.ajax_.jpg 24.89 KB

#11

katbailey - May 25, 2009 - 20:35

yes, this is because tribune requires extra js settings as well as the js file that you're loading on every page. And as explained above, Drupal 6 has no mechanism for updating Drupal.settings with new settings for content loaded via ajax.

#12

Flying Drupalist - June 1, 2009 - 16:05

Thanks katbailey, I don't understand exactly what's stopping quicktabs from using one of the existing D6 mechanisms for updating settings, such as using the ajax load module or using the popups example.

Whatever is the case, I would be willing to chip in though to get settings to be loaded for D6.

#13

Manuel Garcia - November 5, 2009 - 13:57

Just for the record, I believe this is also affecting Views using the views_accordion style plugin, which prepares settings and adds a js file on render(), and a css file through template_preprocess_views_view_accordion.

These files are not being added if the tab is being loaded through ajax, otherwise both modules work perfectly together.

I'm the maintainer of views_accordion btw, and will be helping testing this issue if we come up with a solution.

 
 

Drupal is a registered trademark of Dries Buytaert.