I have checked the issue queue but haven't found anything like this. Sorry if I missed it.

It would be great to provide a feedback to a user that his vote is being saved. Something like "Thanks for your vote!" shown next to a voting widget would be just great.

Actually I have hacked the 5.x-1.10 version of this module, but the site I use this hacked version is not live yet so I cannot provide a link. Plus, it was quick and dirty and most likely made in a wrong way. :-(

Anyway, this could be as simple as a tiny addition in the jquery.rating.js file, in the $stars.click function. Something like $('fivestar-confirm-widget').slideDown("slow"); and in the fivestarDefaultResult we could have something like setTimeout("$('fivestar-confirm-widget').slideDown("slow");", 1000);

'fivestar-confirm-widget' could be:

<div id="fivestar-confirm-widget">Thanks for your vote!</div>

This way the confirmation text would be visible for at least 1 second and no longer than a second after the vote was saved. It could be extended even more like this:

fivestarDefaultResult:

$('fivestar-confirm-widget').html('Your vote has been saved.');
setTimeout("$('fivestar-confirm-widget').slideDown("slow");", 1000);

Best regards,
Bartek

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

This would be a great feature to include, I agree. The likely location for the option would be under "Star Labels", even though it's not quite a star "label". Hmm. Either way, this needs to be a configuration option in the Fivestar content type settings, as it's something that is very likely to be changed on a per-site basis. If you can abstract out the feature and make a patch, I'd love to include it.

bartekg’s picture

I can try to implement this, however this is not going to happen before April. If that's fine with you we can get back to this later. Alternatively, if anyone else likes to do this I will be happy to review patches.

qingdao’s picture

yeah this would be a nice feature, i recently made some usertests on the page im developing right now, and many users were confused about fivestar rating. They didn't know if the rating was saved or not. A confirmation message would be very helpful. Thank you ...

bartekg’s picture

many users were confused about fivestar rating. They didn't know if the rating was saved or not.

That's why I believe its worth while to add this feature. I hope I will have some time to work on it during Easter time. :-)

qingdao’s picture

would be nice :-)

bartekg’s picture

Version: 6.x-1.11-beta4 » 5.x-1.11
Status: Active » Needs review
FileSize
77.65 KB
11.04 KB

Here is a patch for 5.x-1.11 version.

New features:

  • Right after clicking a star a confirmation is shown: "Thank you for your vote!" and after the vote is saved this text is changed to: "Your vote has been saved."
  • Right after canceling a vote you get "Deleting your vote..." and finally when the vote is deleted this text is changed to "Your vote has been deleted."
  • 3 seconds after the final confirmation the text disappears.
  • There is a new option in content type settings: "Enable confirmations to inform a vote was saved or deleted" (enabled by default). Voting widget preview is updated whenever this option is changed.

All texts are passed on through t() so they can be easily translated.

Since this is my first patch and I am not sure if I prepared it properly there is also a complete module (zipped) attached.

Regards,
Bartek

quicksketch’s picture

FileSize
13.01 KB

Wow! Thanks bartekg. Works really quite well! However, I ran into a few snags that we'll need to clean up, plus a few small code style things.

First, I got a javascript error if Comment module was enabled and I disabled/enabled Fivestar support for a particular node type. Just looks like the new feedback variable needed to be passed in as a last argument when updating the Comment rating preview. No problem.

I changed all the PHP code to use underscores for variable names instead of camelCase. JavaScript uses camelCase but PHP uses underscore_variables. Yeah, weird I know :P

Lastly just a few minor changes to spacing in an IF statement.

The functionality it great here though! I like that it's added as an additional line of text instead of replacing the existing status text. Very nice.

One last thing I'd like to change though, how about changing the text for "Thank you for you vote!" to "Saving your vote...". I feel like I get double feedback if it thanks me for my vote before it's even saved. What do you think?

bartekg’s picture

JavaScript uses camelCase but PHP uses underscore_variables. Yeah, weird I know :P

I wasn't aware of this. Thanks for a tip. :-)

The functionality it great here though! I like that it's added as an additional line of text instead of replacing the existing status text. Very nice.

I am glad you like it. :-D

(...) how about changing the text for "Thank you for you vote!" to "Saving your vote...". I feel like I get double feedback if it thanks me for my vote before it's even saved. What do you think?

That's fine with me. It is also a more natural counterpart to the "Deleting your vote...". However, two questions here:
1) which version is better/correct from English grammar/spelling point of view: "Saving your vote..." or "Your vote is being saved..."?
2) if we are going to stick with the former should we say: "Saving your vote..." or "Saving Your vote..."?

quicksketch’s picture

1) which version is better/correct from English grammar/spelling point of view: "Saving your vote..." or "Your vote is being saved..."?
2) if we are going to stick with the former should we say: "Saving your vote..." or "Saving Your vote..."?

Both are grammatically correct, but I think the shorter "Saving your vote..." will work better because it's less text to read and it can disappear pretty quickly. I'd prefer "Saving your vote" (instead of "Saving Your vote") because Drupal tries to have a convention of an uppercase letter only for the first letter of labels, and it reads more like a normal sentence.

bartekg’s picture

OK, so I guess we have a patch to commit. :-) Do you have any idea when a new version will be available?

quicksketch’s picture

Status: Needs review » Fixed

Committed to both 5 and 6 versions of Fivestar. Amazingly the patch applied perfectly to the Drupal 6 version also.

I want to get the multi-axis voting into version 1.12 before releasing it. It's also only been a couple weeks since the last release, people might be getting a little irritated at the rapid pace of releases. :)

So I'd estimate 2-4 weeks yet before I put out the new version.

Great work once again. For a first patch it's flippin' awesome. Thanks for the help.

bartekg’s picture

Thanks, that's great! Looking forward to the next release. :-)

quicksketch’s picture

While trying to nail down http://drupal.org/node/211526, I found that the approach we used here didn't accommodate the combo set of stars very well (when both the average and user votes are displayed).

So I reworked this a bit to replace the existing text rather than display as a second line. Although I liked the amount of information given in the original version, the confirmation now takes up no additional space and looks a lot better when used with the combo widget. If you can try out the latest dev and see what you think I'd appreciate the additional review.

bartekg’s picture

Regarding the http://drupal.org/node/211526 issue: actually I had the same idea in mind as I use the combo set on my site. It's really nice to see how this module gets better and better. :-)

I will take a look at the latest dev tonight/tomorrow and let you know my thoughts. However, based on your description, I believe it is a good idea.

bartekg’s picture

I have just checked the latest version: the voting widget works perfectly and looks even better (I have checked the combo and average/user alternatives). Well done!

Plus I have noticed that the admin section works much faster now (I guess this is because IFrames are no longer used). Also 'Custom color widgets' look really promising (btw: I couldn't get the custom colors to work - after hitting 'Save' all color related settings get back to default values).

quicksketch’s picture

Plus I have noticed that the admin section works much faster now (I guess this is because IFrames are no longer used).

Yeah, glad to get those out of there, although the new solution of running RegEx on the CSS feels a little dirty still. :P

Also 'Custom color widgets' look really promising (btw: I couldn't get the custom colors to work - after hitting 'Save' all color related settings get back to default values).

Eh, sure enough. I committed a fix for D6 but D5 missed it. It's now saving correctly.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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