Flag module and Galleriffic doesn't work on the same page.

Can somebody test this situation?

Comments

acouch’s picture

Version: 6.x-6.x-dev » 6.x-1.x-dev

Thanks for using this module and for sharing your experience.

Can you please be more specific about the problem? Is this a view that is attached to a node or is the page you are describing a view itself? Does the flag module appear and just not work or does it not appear at all? What about the flag module doesn't operate normally?

dgastudio’s picture

StatusFileSize
new64.63 KB
new54.8 KB

of course:

flag installed: printed in custom node.tpl using print flag_create_link('bookmarks', $node->nid); . Using JavaScript toggle.

Gallerific installed: printed un custom node.tpl using print $node->content['media_gallery_node_content_2']['#value'];

On open node.tpl, everything is ok, the gallery is working.

after press FLAG link the Gallerific Views is broken, it doesn't change after press on any thumb. But the flag link is still working, i can flag unflag content.

vatavale’s picture

+1. I have the exactly same problem.

acouch’s picture

Status: Active » Closed (won't fix)

I've confirmed that these two don't play well together.

Thank you for posting this. I've added this issue to the module page.

I don't intend on fixing this but will happily commit a working patch.

mrgoltra’s picture

Same here. Once flag has been set all I can do is refresh the page so images would load.

forgot to mention that you will need to set the link type to Normal Link in flag module settings.

gmclelland’s picture

I might be completely wrong and stupid saying this, but could it be when the Flag's ajax request gets fired off all the Drupal's behaviors get reattached causing the problem since galleriffic is being initialized twice?

I had a similar problem with another jquery script that I added to my theme. The script was "Easy List Splitter" from http://www.madeincima.eu/blog/jquery-plugin-easy-list-splitter/

Every time an ajax event was fired or the DOM was modified all my columns would get messed up. You could also see this behavior when using other modules that modified the dom after the page is loaded. Examples: Skinr module - Applying a different skin to a block using a modal dialog, Boxes Module - ajax editing of blocks

So what I did was added this to my theme's(cmftao) js file

// Split lists into columns
// http://drupal.org/node/205296
// This jQuery code ensures that this element
// is only processed once.  It is basically saying:
// 1) Find all elements with this class, that do not
// have the processed class on it
// 2) Iterate through them 
// 3) Add the processed class (so that it will not
// be processed again).

Drupal.behaviors.cmftaoSplitLists = function (context) {
  $('div.menu-block-3 ul:not(.cmftaoSplitLists-processed)', context).addClass("cmftaoSplitLists-processed").easyListSplitter({colNumber:4});

}; /* End of behavior */

Before I was doing

Drupal.behaviors.cmftaoSplitLists = function (context) {
$('#block-menu_block-3 ul.menu').easyListSplitter({colNumber:4});
};

So maybe in views_galleriffic.js:
Something like this:

// Initialize Advanced Galleriffic Gallery
var gallery = $('#thumbs').galleriffic({ 

Could be turned into something like this:

// Initialize Advanced Galleriffic Gallery
var gallery = $('#thumbs:not(galleriffic-processed)',context).addClass("galleriffic-processed").galleriffic({ 

What do you think?

gmclelland’s picture

By changing this in views_galleriffic.js:
var gallery = $('#thumbs').galleriffic({
to this:
var gallery = $('#thumbs:not(.galleriffic-processed)').addClass('galleriffic-processed').galleriffic({

It seems to work. I need more testers. The other problem I think it helps with is when there is other AJAX on the page.

For example a view that is ajax enabled on the same page as galleriffic.

Could someone else try this out? I'm a bit rushed at the moment. I will test some more later.

Hope that helps

gmclelland’s picture

StatusFileSize
new75.81 KB

Did some more changes in views_galleriffic.js I added context from:
this:
Drupal.behaviors.ViewsGalleriffic = function () {

To this:
Drupal.behaviors.ViewsGalleriffic = function (context) {

Then I changed this:
var gallery = $('#thumbs').galleriffic({

To this:
var gallery = $('#thumbs:not(.galleriffic-processed)', context).addClass('galleriffic-processed').galleriffic({

I can confirm that using the flag module 6.x-2.0-beta5 works now with javascript flags.

I am seeing some strange behavior with ajax views on the same page as a galleriffic gallery. When using an ajax pager on the view it allows you to click once and update the view, but the next click causes a full page refresh. So for example, when I click on the "2" it works just fine. When I click back on the "1" it causes a full page refresh. Strange, not sure what is causing this, but I do get this error in firebug.

See the attached image.
imageData is undefined

The good news is that views_galleriffic continues to function properly even after the page is updated with AJAX or a flag was clicked. Before galleriffic would simply stop functioning after a flag was clicked or a view was updated with ajax.

Hope that helps

dirtysteak’s picture

I am also seeing ajax enabled views on the same page loading the entire page instead of just the view.

gmclelland’s picture

Ok after some more trial and error and research, the AJAX problem can be fixed by making the following edits to jquery.galleriffic.js:
http://code.google.com/p/galleriffic/issues/detail?id=81 - make all the changes specified here

So the Flag issue and AJAX issue is now solved, just need a patch for the module.

Just to be clear, here is how to fix both the Javascript Flag and AJAX issues for the views_galleriffic module:
1. Update views_galleriffic.js - http://drupal.org/node/703760#comment-4011536
2. Update jquery.galleriffic.js - http://code.google.com/p/galleriffic/issues/detail?id=81

@acouch - How do you want to proceed? Do you need a patch or can you make these changes?

FYI... These fixes are for the Drupal 6 version of this module. Haven't tested with the D7 version.

Hope that helps everyone.

acouch’s picture

Status: Closed (won't fix) » Needs review

Can you make a patch?

http://drupal.org/patch/create

gmclelland’s picture

StatusFileSize
new2.01 KB

Took me a while to learn patching. So here is my first patch.

To those who want to test, I had to apply the patch using:
patch -p0 < path/file.patch
from within the views_galleriffic module's directory

I made the changes against the latest dev release(Feb 25-2011).

Hope this helps everyone,
-Glenn

acouch’s picture

Status: Needs review » Fixed

I committed this to 6.x and 7.x. Thanks for the work everyone. Will create a new release soon.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.