Closed (fixed)
Project:
Vote Up/Down
Version:
7.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
7 Jul 2010 at 23:00 UTC
Updated:
24 Feb 2012 at 18:00 UTC
Jump to comment: Most recent file
Comments
Comment #1
marvil07 commentedIMHO it would be more natural to do this in the widget.
Comment #2
klonos...subscribing.
Comment #3
js commented...subscribing -- thank you for the ups and downs.
Comment #4
donquixote commentedsub
Comment #5
monotaga commentedHey, gang,
This is definitely not the right answer, as this calls for a patch to vud.theme.inc and because it doesn't use ajax for the vote reset call, but it seems to work well enough for a project I'm working on. Maybe it'll help in the move toward a better solution.
NOTES:
- #vud_reset() probably needs to be changed to give the ajax response instead of just redirecting the user via drupal_goto($_SERVER['HTTP_REFERER']);
- My application is only using a "vote up" button, and I want the button text to change from "Vote" to "Unvote" when the user has already voted. Therefore, I added the 'button_text_up' variable. I call it from my custom widget's widget.tpl.php using:
<?php if (empty($button_text_up)) $button_text_up = 'Vote'; ?> [...] <?php echo $button_text_up; ?>Comment #6
marvil07 commentedmarking to avoid forgetting it
Comment #7
henrijs.seso commentedI think I managed to create proper patch that adds reset options to theme with ajax. Now all is left is creating demo widget that uses variables like class_reset, link_class_reset and link_reset.
I took a liberty of moving function vud_reset to vud.theme.inc and add $widget argument, so it works same as function vud_vote.
Comment #8
henrijs.seso commentedadded new class class_user_vote with possible values user_vote_up, user_vote_down and user_vote_empty. Makes theming easier. Will update patch.
Comment #9
marvil07 commentedThanks for the patches :-)
I did not try the patch at #7, but it looks good. I think it would be better to add this reset link to all the actual widgets.
@LavaMeTender aka mansspams: the mentioned classes at #8 do not seem to be a good idea (on this issue, to retain the subject)
Comment #10
chawl commentedsubs
Comment #11
jpoesen commented#7 works as advertised. Great job. Adding the missing class names and re-rolling the patch would be the cherry on top though.
Thx for a great addition to this module.
Comment #12
jaydub commentedThe patch in #7 worked for me for the released version of 6.2 that I was using but no longer applies cleanly to latest CVS. I rerolled to address that and add one more line to set a reset variable that was missing in the original patch.
Patch applies cleanly to HEAD too although with offsets.
Comment #13
szantog commentedThis patch #12 worked very well, and many-many thanks, this saved my life. :)
I've tested it the normal updown and the upanddown widget too, dsm(get_defined_vars()); in widget's tpl.php show the $link_reset variable.
I'used it in updown widget to make toogle +/- (if user have a + vote he can reset with link -, and vica versa).
Thanks again!
update: after this patch will be commited, my I have to contribute the widget, what I made? Exactly I ask, would you like to push a 5. widget in your module with this functions?
Comment #14
marvil07 commentedI am working on this, so will be uploading a new patch soon.
Comment #15
marvil07 commentedWhat is new on this patch:
This still needs work, as I mentioned in #9, we should use the new reset link on the current widgets.
Comment #16
laken commentedWondering what's the status on this issue? I'm using 6.x-2.6 and wondering if this patch ever made it into a recommended or dev release.
Comment #17
azarzag commentedIm using 6.x-2.6 as well with Alternate widget.
When doing a dry run i get the following failed notices
Comment #18
laken commentedHmm, patch applied correctly for me (although there were fuzz warnings) – I didn't get any failed errors, and manual inspection verified it applied correctly. I would try a separate download of a 6.x-2.6 and try the patch again.
Comment #19
laken commentedI should also mention that the patch appears to be working great for me - I reworked my custom widget to use the reset with AJAX, and now I have a neat 'like/unlike' toggle - brilliant!
Comment #20
azarzag commentedOk the patch on #15 applied correctly now. Although i assumed it would just work for the default widgets. Like i said before im using Alternate widget, but from what im reading it seems that i will have to modify it so that i can use a 'like/unlike' toggle.
Comment #21
laken commentedazarzag (nice handle):
It's easy to get started with a custom widget - I followed the instructions here to make a copy of the 'updown' widget in my theme, and then I could start modifying it. In case it's a help, here's my widget.tpl.php file that works with this patch to make an ajax like/unlike toggle. The class names (e.g. 'cclike-up', 'cclike-reset' are customized for my stylesheet).
Comment #22
azarzag commented@laken Thanks for that. I actually ended up going through the code and figuring out what i had to add/change. My template file looks almost exactly the same as yours.
This patch is awesome
Cheers,
Comment #23
jaydub commentedI re-rolled the patches to the latest 6.2 and 6.3 branches. The only thing I'm unsure of is the change to vud.install. In the 6.2 branch I named the update function 6202 and in the 6.3 branch 6301.
Both patches should apply 100% clean to the 6.2 and 6.3 branches as of 11/14/2011.
Comment #24
marvil07 commented@jaydub: Thanks for the new patch.
The reason this patch is not yet on upstream is what I mentioned on comment 9 and 15: use the new reset link on the current widgets.
Let's see how far I can get now.
BTW this is a feature request, so it will only land on 6.x-3.x, since 6.x-2.x is feature frozen.
Comment #25
marvil07 commentedOK, I finally moved this to upstream on 6.x-3.x
What's new on this patch:
Comment #26
marvil07 commentedUhm, now we need to port this to D7, but well, not today, time to get some sleep :-)
Comment #27
klonosSleep tight Marco. I don't know about the bed-bugs, but I'll help testing the 7.x port once available and I'll report back (Unfortunately I have no D6 installation available currently).
Comment #28
marvil07 commentedAfter reworking the patch here attached, I pushed it to 7.x-1.x.
From commit message: