I needed to add classes to the NQ links so I could style them differently - such as showing add/remove icons. To do this I modded the module and nodequeue.js (see attached patch).

The patch adds two classes - toggle-add & toggle-remove. These are added to function nodequeue_link, so that the appropriate class is added on page load.

The patch also mods the nodequeue.js click function by first removing both classes (my icons are on the left, so I needed to make room for the link to move over for the throbber), and then adds the correct class back in to show the new state.

I have included a screen shot of my links - on click the thumbs change to reflect the new state (all done with CSS).

I'm pretty new to Jquery and JavaScript so I'm not 100% this is the right approach etc, it works for us in our new site.

RE the patch: for some reason every time I generated a patch against 5.2 it kept including changes for nodequeue_init (look like formatting changes) not sure why but it appears to be the same code.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jeff Burnz’s picture

Bugger me, I forgot something - you need jQuery Update module for this to work. http://drupal.org/project/jquery_update

merlinofchaos’s picture

Status: Active » Needs work

The idea looks good but the patch seems to add some extra linefeeds for no apparent reason?

Jeff Burnz’s picture

Yeah, keep having issues with my patches like this, I'll re-roll once I get my patch issues sorted out.

merlinofchaos’s picture

I'm against adding a dependency on jquery update. I'm sure we can do something that doesn't require that.

Jeff Burnz’s picture

Fully agree, I just need to figure out why it doesn't work without it :)

ezra-g’s picture

Version: 5.x-2.x-dev » 7.x-2.x-dev

Bumping to 6.x. This would be a great user interface enhancement.

eromba’s picture

Version: 7.x-2.x-dev » 5.x-2.x-dev
Status: Needs work » Needs review
FileSize
1.76 KB

I have been waiting for this feature as well. I updated the original patch for the 5.x branch. It now works without the jQuery Update module and seems to be completely operational. I hope this makes the next 5.x release!

ezra-g’s picture

FileSize
2.48 KB
2.5 KB

I rerolled this for both the Drupal 5 and 6 Branches. Here's what I changed:

-- I moved the $(a).removeClass('toggle-add'); so that the add/remove toggle classes are added and removed at the same time to avoid potentially unwanted behavior and for consistency.
-- The toggle links now specify the qid and subqueue id as individual classes so that links for a queue as well as a specific subqueue can be targeted and styled by CSS. This allows us to, for example, have different styles for the "Add to My Favorite Posts" and "Add to Frontpage" links. These classes are in the format "nodequeue-toggle-q-123" and "nodequeue-toggle-sq-123"
-- These classes now apply to the LI's which wrap the $links from hook_link by default.
-- These classes don't also contain the word 'ajax' but I don't foresee them overlapping with other classes at this point, and that makes the classes smaller for readability and saves the transfer overhead four whole ASCII characters on every request ;).

I would love to get this tested and committed for the next RC :).

ezra-g’s picture

On further thought it might be nice to also expose the subqueue reference as a classs so that it would be easy for a themer to tell if a subqueue belongs to a particular user.

ezra-g’s picture

Status: Needs review » Fixed

I added a class for the subqueue reference to my previous patch and committed this to both the Drupal 5 and 6 branches. Thanks everyone -- This is excellent!!!

Jeff Burnz’s picture

Wow, thanks ezra-g, I've just been so snowed past few months, glad you took the ball and ran with it and even made it better - cheers!

Status: Fixed » Closed (fixed)

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

Francis47’s picture

Sorry to reopen this issue after 3,5 years :)

Is there any plans for this patch to be ported to D7?