Maybe there's a way to do this now, but I can't see it. For example - in a restaurant review, it's common to have a star rating for quality as well as a rating for cost. It would be nice if the cost rating could be, for example, currency icons instead of stars. I have a restaurant review content type using CCK and Contemplate, but I can't see an easy way to do this right now. Even so, it would be REALLY nice to be able to customize the icon set in a per-CCK field way, with it defaulting to the current site-wide choice.

Comments

quicksketch’s picture

This gets into a really sticky area. The reason the stars are site-wide only is because they're simply switching out different CSS files. In order to make the CSS generated "per-widget", that means we're getting into dynamic css files :P

duckpuppy’s picture

That's what I figured, but it looks like there's only really three things in the CSS that needs to change - the class of the containing DIV (required and must be unique), an (optional) cancel image, and an (optional) stars image. Appropriate defaults could be provided to all of the values. Am I correct in that? If the CSS file were templatized to allow three replacements - the CSS class name, the "cancel" image, and the "stars" image, the CSS could be built dynamically and allow great customization - the user would only have to provide the class name and browse to the two images somewhere on the file system that's web-accessible. Then the correct class would have to be applied to the DIV/containing element of the rating widget. I'm willing to take a look at this myself, but I'm more of a PHP dabbler...

I'm quite willing to admit that my lack of PHP knowledge (I've done more Java/C++/.NET and non-web applications for the last 6 years) and limited browsing of the module itself may make this seem easier than it is. As a feature request, though, it's certainly nice to at least have on the list for SOMEDAY. :)

duckpuppy’s picture

You know, a simple first step could just be allowing the user to specifiy the CSS class for each fivestar form, defaulting to "star" if none is entered which would use the default site-wide widget. Instead of "star" as the class, I could specify "dollar". Then the CSS of my theme would include the CSS necessary to do the right thing, removing the need for the fivestar module to handle dynamic CSS for the time being.

It would simply be up to users to include the CSS for handling custom widget classes in their theme's CSS somewhere.

quicksketch’s picture

I'm just entertaining the idea here, no actual committing to code.

I think there's already a unique class on each fivestar widget. If there's not, then we could make one. Rather than dealing with dynamic CSS at all, we could simply read in the CSS file for the desired (alternate) widget, do a str_replace on the generic class name and set it to the unique class of the widget. Don't even bother with making a CSS file, just put it right into the HTML head with <style> tags around it. :)

duckpuppy’s picture

There doesn't seem to be any unique class on the fivestar widget - I created a test CCK node with 2 widgets and both have the same style information.

quicksketch’s picture

Status: Active » Closed (won't fix)

With the new features (the color picker) being added to the admin/settings/fivestar and the increasing number of stars available for Fivestar, I don't think this is a viable request. If different stars are needed per content type, you'll just have to do it the old fashioned way with hand written CSS in your theme. This could be implemented in the same way as described in http://drupal.org/node/180229 (just basic CSS).

vkr11’s picture

subscribe

Mark Theunissen’s picture

I've done a tutorial on my blog for this functionality - it requires CSS knowledge and theme overrides, but if you don't feel like working it out yourself, check out:

http://codebaboon.com/tutorial-different-icons-fivestar-cck-fields

quicksketch’s picture

Thanks Mark.