The ajax is primarily used to submit the score. The refresh of the component(s) is an additional bonus. And it doesn't work for 6-10 star rating systems, or alternatives such as F-A.

Also, it is possible to have different pictures for star 1, 2, 3, 4, 5, 6, 7 and so forth, depending on how far you want to go.

I like the tricks in the mentioned article, especially the way he has made it possible to show half of a star.

However, I hardly find it simpler. There's some serious CSS hackery going on, and if you were to customize it to show other images than those provided by Wicket, you'll have to implement a lot of CSS yourself again.

The ajax return is still necessary, to update the width of the current-rating list item. So you won't gain much there either.

Martijn


On 5/26/06, Andrew Berman <[EMAIL PROTECTED]> wrote:
I just looked in SVN at your code.  My solution is a bit simpler and I'm willing to donate it if you want.  It uses pure CSS to change the star, no AJAX involved at all.  You can customize the image by changing the CSS since it uses background-image.  It uses one image...it's based on this:

http://komodomedia.com/blog/index.php/2006/01/09/css-star-rating-part-deux/



On 5/26/06, Andrew Berman <[EMAIL PROTECTED]> wrote:
What does the HTML and _javascript_ look like? 

I just wrote a Ratings class (requires Prototype) in _javascript_ which does it similarly to how Yahoo's ratings work, except that when you mouse over the star it not only changes colors, but it also has a tooltip with the meaning of the star.  It uses hidden radio buttons for the form so clicking a rating changes the radio button and then in Wicket I just use a standard RadioChoice object.


On 5/26/06, Jonathan Locke < [EMAIL PROTECTED]> wrote:

awesome!  thanks!

On 5/26/06, Martijn Dashorst < [EMAIL PROTECTED]> wrote:
All,

I just wanted to let you know that I implemented a rating component in wicket-extensions, and it is in the wicket 1.2 branch, as such it will be part of the next Wicket 1.2 maintenance release. It will also be added to the trunk in the near future. If you want to check it out, and see its usage, you'll have to check out the code from SVN, located under

branches/WICKET_1_2/wicket-extensions and
branches/WICKET_1_2/wicket-examples

You can find the example in src/wicket/examples/ajax/builtin/RatingsPage.java

Features of the component:
 - use your own icons for the images
 - allow a user to vote only once (the implementation is up to you)
 - customize the styling
 - customizable rating system (it's all in the model, so ratings from 1-10, 1-5, F-A, are all possible)
 - label showing the absolute value of the rating (3.7 from 5 votes) can be turned off, or replaced with your own implementation

Example code:
        add(new RatingPanel("rating", new PropertyModel(rating, "rating"), 5, new PropertyModel(
                rating1, "nrOfVotes"), true)
        {
            protected boolean onIsStarActive(int star)
            {
                return RatingsPage.rating1.isActive(star);
            }

            protected void onRated(int rating, AjaxRequestTarget target)
            {
                RatingsPage.rating1.addRating(rating);
            }
        });

I know that Jonathan Locke was anxious to get this component, so Jonathan, this one is for you!

Martijn

--
Download Wicket 1.2 now! Write Ajax applications without touching _javascript_!
-- http://wicketframework.org






--
Download Wicket 1.2 now! Write Ajax applications without touching _javascript_!
-- http://wicketframework.org

Reply via email to