Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
might be a nice idea to make the add to + delete from favorites with ajax functionality - good for the user and less reloads?
Comments
Comment #1
Dabitch CreditAttribution: Dabitch commentedWish I knew more about Ajax because yes, that sounds awesome.
Comment #2
mr.andrey CreditAttribution: mr.andrey commentedYes, this would be great to get going with jquery - so it works like the faves in flickr.
A.
Comment #3
z.stolar CreditAttribution: z.stolar commentedI need to implement exactly that in a project. Let's hope a patch will evolve out of that.
Comment #4
bobdalob CreditAttribution: bobdalob commented#2 only just tried the flickr 'faves' - yes, that's the idea!
Comment #5
ilmaestro CreditAttribution: ilmaestro commentedi'm actually checking how i can implement this same thing. i can get something working using jquery's ajax, but it doesn't actually use the favorite_nodes/add/123 menu path that is built into the favorite nodes module. In general, I don't know if drupal supports ajax calls to URLs this way.
Still researching...
Comment #6
ilmaestro CreditAttribution: ilmaestro commentedOk guys, I got it working and thought I'd post my results here. I found inspiration with the fasttoggle module, and just went from there:
The following stuff you can add to the favorite_nodes_menu function. Be sure to empty your cache_menu table after making this change.
Next is the new funciton that is called by the two new menu URLs above:
Finally we have some javascript stuff that kicks off the ajax request to our new menu url handler, and handles the callback:
To use the new functionality, just add a link to your page to add to favorites, something like this:
Note, the javascript also adds a "throbbing" css class to your link. You can take this stuff out if you want, or download the fasttoggle module to get the CSS and the image for that.
Cheers.
Comment #7
mokargas CreditAttribution: mokargas commentedTried that code ilmaestro, but it doesn't work? At least not for deleting
Comment #8
MagicMatze CreditAttribution: MagicMatze commentedsame to me - not working. Maybe we made some mistakes by editing your code?
Maybe you could implement this feature in next release?
Comment #9
ilmaestro CreditAttribution: ilmaestro commentedYou say it didn't work for deleting - did it work for adding? The URL for deleting a node from the favorites would of course be different. Example, to delete nid 106:
Comment #10
bobdalob CreditAttribution: bobdalob commentedSolved.....elsewhere. There are so many modules now that I don't often go and see what's out there. Yesterday I had a browse and found "Views Bookmarks", which does the job. I wasn't sure when I saw the name, but it's worth a look.
I'll leave this request as active for those wishing to see this functionality appear in this module.
Comment #11
lainel CreditAttribution: lainel commentedWhere did you insert these codes?
I'm thinking you inserted them into the fasttoggle file.
Comment #12
kbahey CreditAttribution: kbahey commentedPlease do not change issue titles without a real need for that ....
Comment #13
liquidcms CreditAttribution: liquidcms commentedfurther to #10 above it sounds like Views Bookmarks is not being ported to D6 but is replaced with an alternate to this module: http://drupal.org/project/flag which seems to have numerous more features including ajax.