Hi, I''m looking for a star rating component for RoR, a bit like Votio (http://redalt.com/downloads/ - find the votio heading) or the star rating used on Amazon. I don''t really need the AJAX capabilities, just the ability to bind the results to a hidden drop down, or radio inputs. Multiple raters per page is also an issue. Any recomendations? -- Posted via http://www.ruby-forum.com/.
On 07 Mar 2006, at 14:42, Martin Smith wrote:> Hi, > > I''m looking for a star rating component for RoR, a bit like Votio > (http://redalt.com/downloads/ - find the votio heading) or the star > rating used on Amazon. > > I don''t really need the AJAX capabilities, just the ability to bind > the > results to a hidden drop down, or radio inputs. > > Multiple raters per page is also an issue. > > Any recommendations?If you have the Rails Recipes book, you could read up on the JavaScript helper section and implement the open source version from the Yahoo UI Library and hide it behind one simple ruby command. Best regards Peter De Berdt
Hi Martin, I''ve got a flash-version I built and included via flash-javascript integration kit. Works great. Let me know if you want it and I''ll send it over. Steve On 3/7/06, Martin Smith <linus141275@hotmail.com> wrote:> > Hi, > > I''m looking for a star rating component for RoR, a bit like Votio > (http://redalt.com/downloads/ - find the votio heading) or the star > rating used on Amazon. > > I don''t really need the AJAX capabilities, just the ability to bind the > results to a hidden drop down, or radio inputs. > > Multiple raters per page is also an issue. > > Any recomendations? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060307/7e3ce8d8/attachment.html
Steve Odom wrote:> Hi Martin, > > I''ve got a flash-version I built and included via flash-javascript > integration kit. Works great. Let me know if you want it and I''ll send > it > over. > > SteveThanks, for that. I would really prefer to keep it just javascript though. I assume that for your version you need flash installed. -- Posted via http://www.ruby-forum.com/.
Peter De Berdt wrote:> > If you have the Rails Recipes book, you could read up on the > JavaScript helper section and implement the open source version from > the Yahoo UI Library and hide it behind one simple ruby command.Sadly I don''t. I have looked at the Yahoo UI Library, but could only find the Star Rater in the patterns section, not in the download. Martin -- Posted via http://www.ruby-forum.com/.
On 07 Mar 2006, at 16:03, Martin Smith wrote:> Peter De Berdt wrote: > >> >> If you have the Rails Recipes book, you could read up on the >> JavaScript helper section and implement the open source version from >> the Yahoo UI Library and hide it behind one simple ruby command. > > Sadly I don''t. I have looked at the Yahoo UI Library, but could only > find the Star Rater in the patterns section, not in the download.Well, the nice thing about javascript is that you can extract it from a page: http://us.js2.yimg.com/us.yimg.com/lib/ls/js/ yg_multirate_200602281800.js They then use the following code to show the rating system: <script> if (document.getElementById) { // Support for Class A. rating = new yg_Ratings("rating", "", 0, "star"); } else { // Support for poor DOM (low grade). document.write(''<div>''); document.write(''1 Star<input type="radio" name="rating" value="" />''); document.write(''<input type="radio" name="rating1" value="" />''); document.write(''<input type="radio" name="rating2" value="" />''); document.write(''<input type="radio" name="rating3" value="" />''); document.write(''<input type="radio" name="rating4" value="" />5 Stars''); document.write(''</div>''); //document.write(''<input class="save" type="submit" name="submit" value="Save" class="ylsfbtn" />''); } </script> Just go to http://local.yahoo.com/, search for "Restaurants" in Location "New York", click on a restaurant for the detail (which has the widget) and then look at the source. Best regards Peter De Berdt
I think the CSS approach to this is the best. I implemented the following approach, which is very popular: http://komodomedia.com/blog/index.php/2006/01/09/css-star-rating-part-deux/ The code I used below enabled the "ajaxy" part of this... so when you click on a star, it automatically saves your pick... much like the Netflix star system. ==========================<ul class=''star-rating''> <div id=''super''> <% if @review %> <li class=''current-rating'' style=''width: <%= @review.rating * 30 %>px;''> </li> <% end %> </div> <% for i in 1..5 %> <li> <%= link_to_remote i, {:update => ''super'', :url => {:action => ''rate_cause'', :cause_id => @cause.id, :user_id => @user.id, :rating => i}}, {:class => num2english(i)+"-stars"} %> </li> <% end %> </ul> ========================== It works beautifully ! Let me know if you have any questions. On 3/7/06, Peter De Berdt <peter.de.berdt@pandora.be> wrote:> > > On 07 Mar 2006, at 16:03, Martin Smith wrote: > > > Peter De Berdt wrote: > > > >> > >> If you have the Rails Recipes book, you could read up on the > >> JavaScript helper section and implement the open source version from > >> the Yahoo UI Library and hide it behind one simple ruby command. > > > > Sadly I don''t. I have looked at the Yahoo UI Library, but could only > > find the Star Rater in the patterns section, not in the download. > > Well, the nice thing about javascript is that you can extract it from > a page: > > http://us.js2.yimg.com/us.yimg.com/lib/ls/js/ > yg_multirate_200602281800.js > > They then use the following code to show the rating system: > <script> > if (document.getElementById) > { > // Support for Class A. > rating = new yg_Ratings("rating", "", 0, "star"); > } > else > { > // Support for poor DOM (low grade). > document.write(''<div>''); > document.write(''1 Star<input type="radio" name="rating" > value="" />''); > document.write(''<input type="radio" name="rating1" > value="" />''); > document.write(''<input type="radio" name="rating2" > value="" />''); > document.write(''<input type="radio" name="rating3" > value="" />''); > document.write(''<input type="radio" name="rating4" > value="" />5 > Stars''); > document.write(''</div>''); > //document.write(''<input class="save" type="submit" > name="submit" > value="Save" class="ylsfbtn" />''); > } > </script> > > Just go to http://local.yahoo.com/, search for "Restaurants" in > Location "New York", click on a restaurant for the detail (which has > the widget) and then look at the source. > > > Best regards > > Peter De Berdt > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060307/7b4ae458/attachment.html
Dylan, Can we see the controller code you are using? John On 3/7/06, Dylan Stamat <dylans@gmail.com> wrote:> > I think the CSS approach to this is the best. I implemented the following > approach, which is very popular: > http://komodomedia.com/blog/index.php/2006/01/09/css-star-rating-part-deux/ > > > The code I used below enabled the "ajaxy" part of this... so when you > click on a star, it automatically saves your pick... much like the Netflix > star system. > > ==========================> <ul class=''star-rating''> > <div id=''super''> > <% if @review %> > <li class=''current-rating'' > style=''width: <%= @review.rating * 30 %>px;''> > </li> > <% end %> > </div> > > <% for i in 1..5 %> > <li> > <%= link_to_remote i, {:update => ''super'', > :url => {:action => > ''rate_cause'', > :cause_id => @cause.id, > :user_id => @user.id, > :rating => i}}, > {:class => num2english(i)+"-stars"} > %> > </li> > <% end %> > </ul> > ==========================> > It works beautifully ! > Let me know if you have any questions. > > > > > > On 3/7/06, Peter De Berdt <peter.de.berdt@pandora.be> wrote: > > > > > > On 07 Mar 2006, at 16:03, Martin Smith wrote: > > > > > Peter De Berdt wrote: > > > > > >> > > >> If you have the Rails Recipes book, you could read up on the > > >> JavaScript helper section and implement the open source version from > > >> the Yahoo UI Library and hide it behind one simple ruby command. > > > > > > Sadly I don''t. I have looked at the Yahoo UI Library, but could only > > > find the Star Rater in the patterns section, not in the download. > > > > Well, the nice thing about javascript is that you can extract it from > > a page: > > > > http://us.js2.yimg.com/us.yimg.com/lib/ls/js/ > > yg_multirate_200602281800.js > > > > They then use the following code to show the rating system: > > <script> > > if (document.getElementById) > > { > > // Support for Class A. > > rating = new yg_Ratings("rating", "", 0, "star"); > > } > > else > > { > > // Support for poor DOM (low grade). > > document.write(''<div>''); > > document.write(''1 Star<input type="radio" name="rating" > > value="" />''); > > document.write(''<input type="radio" name="rating1" > > value="" />''); > > document.write(''<input type="radio" name="rating2" > > value="" />''); > > document.write(''<input type="radio" name="rating3" > > value="" />''); > > document.write(''<input type="radio" name="rating4" > > value="" />5 > > Stars''); > > document.write(''</div>''); > > //document.write(''<input class="save" type="submit" > > name="submit" > > value="Save" class="ylsfbtn" />''); > > } > > </script> > > > > Just go to http://local.yahoo.com/, search for "Restaurants" in > > Location "New York", click on a restaurant for the detail (which has > > the widget) and then look at the source. > > > > > > Best regards > > > > Peter De Berdt > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-- John Hornbeck http://findlawton.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060307/60482e93/attachment-0001.html
Sure ! Here you go... but please excuse the mess :) controller ==============def rate_cause id, id, rating = params[:id], params[:id], params[:rating] @review = Review.find(:first, :conditions => ["id = ? and id = ?", id, id]) if @review @review.update_attribute("rating", rating) else @review = Review.create(:id => id, :id => id, :rating => rating) end render(:layout => false) end ============== rate_cause.rhtml ==============<% if @review %> <li class=''current-rating'' style=''width: <%= @review.rating * 30 %>px;''> </li> <% end %> ============== On 3/7/06, John Hornbeck <hornbeck@gmail.com> wrote:> > Dylan, Can we see the controller code you are using? > > John > > > On 3/7/06, Dylan Stamat <dylans@gmail.com> wrote: > > > > I think the CSS approach to this is the best. I implemented the > > following approach, which is very popular: > > http://komodomedia.com/blog/index.php/2006/01/09/css-star-rating-part-deux/ > > > > > > The code I used below enabled the "ajaxy" part of this... so when you > > click on a star, it automatically saves your pick... much like the Netflix > > star system. > > > > ==========================> > <ul class=''star-rating''> > > <div id=''super''> > > <% if @review %> > > <li class=''current-rating'' > > style=''width: <%= @review.rating * 30 %>px;''> > > </li> > > <% end %> > > </div> > > > > <% for i in 1..5 %> > > <li> > > <%= link_to_remote i, {:update => ''super'', > > :url => {:action => > > ''rate_cause'', > > :cause_id => @ > > cause.id, > > :user_id => @ > > user.id, > > :rating => i}}, > > {:class => > > num2english(i)+"-stars"} %> > > </li> > > <% end %> > > </ul> > > ==========================> > > > It works beautifully ! > > Let me know if you have any questions. > > > > > > > > > > > > On 3/7/06, Peter De Berdt <peter.de.berdt@pandora.be> wrote: > > > > > > > > > On 07 Mar 2006, at 16:03, Martin Smith wrote: > > > > > > > Peter De Berdt wrote: > > > > > > > >> > > > >> If you have the Rails Recipes book, you could read up on the > > > >> JavaScript helper section and implement the open source version > > > from > > > >> the Yahoo UI Library and hide it behind one simple ruby command. > > > > > > > > Sadly I don''t. I have looked at the Yahoo UI Library, but could > > > only > > > > find the Star Rater in the patterns section, not in the download. > > > > > > Well, the nice thing about javascript is that you can extract it from > > > a page: > > > > > > http://us.js2.yimg.com/us.yimg.com/lib/ls/js/ > > > yg_multirate_200602281800.js > > > > > > They then use the following code to show the rating system: > > > <script> > > > if (document.getElementById) > > > { > > > // Support for Class A. > > > rating = new yg_Ratings("rating", "", 0, "star"); > > > } > > > else > > > { > > > // Support for poor DOM (low grade). > > > document.write(''<div>''); > > > document.write(''1 Star<input type="radio" > > > name="rating" value="" />''); > > > document.write(''<input type="radio" name="rating1" > > > value="" />''); > > > document.write(''<input type="radio" name="rating2" > > > value="" />''); > > > document.write(''<input type="radio" name="rating3" > > > value="" />''); > > > document.write(''<input type="radio" name="rating4" > > > value="" />5 > > > Stars''); > > > document.write(''</div>''); > > > //document.write(''<input class="save" type="submit" > > > name="submit" > > > value="Save" class="ylsfbtn" />''); > > > } > > > </script> > > > > > > Just go to http://local.yahoo.com/, search for "Restaurants" in > > > Location "New York", click on a restaurant for the detail (which has > > > the widget) and then look at the source. > > > > > > > > > Best regards > > > > > > Peter De Berdt > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails@lists.rubyonrails.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > -- > John Hornbeck > http://findlawton.com > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060308/49b9fccb/attachment.html
Dylan, what does your Review table look like?(database schema) John On 3/8/06, Dylan Stamat <dylans@gmail.com> wrote:> > Sure ! Here you go... but please excuse the mess :) > > > controller > ==============> def rate_cause > id, id, rating = params[:id], params[:id], params[:rating] > @review = Review.find(:first, :conditions => ["id = ? and id = ?", id, > id]) > if @review > @review.update_attribute("rating", rating) > else > @review = Review.create(:id => id, :id => id, :rating => rating) > end > render(:layout => false) > end > ==============> > > rate_cause.rhtml > ==============> > <% if @review %> > <li class=''current-rating'' style=''width: <%= @ review.rating * 30 > %>px;''> </li> > <% end %> > ==============> > > > On 3/7/06, John Hornbeck < hornbeck@gmail.com> wrote: > > > > Dylan, Can we see the controller code you are using? > > > > John > > > > > > On 3/7/06, Dylan Stamat <dylans@gmail.com> wrote: > > > > > > I think the CSS approach to this is the best. I implemented the > > > following approach, which is very popular: > > > http://komodomedia.com/blog/index.php/2006/01/09/css-star-rating-part-deux/ > > > > > > > > > The code I used below enabled the "ajaxy" part of this... so when you > > > click on a star, it automatically saves your pick... much like the Netflix > > > star system. > > > > > > ==========================> > > <ul class=''star-rating''> > > > <div id=''super''> > > > <% if @review %> > > > <li class=''current-rating'' > > > style=''width: <%= @review.rating * 30 %>px;''> > > > </li> > > > <% end %> > > > </div> > > > > > > <% for i in 1..5 %> > > > <li> > > > <%= link_to_remote i, {:update => ''super'', > > > :url => {:action => > > > ''rate_cause'', > > > :cause_id => @ > > > cause.id, > > > :user_id => @ > > > user.id, > > > :rating => i}}, > > > {:class => > > > num2english(i)+"-stars"} %> > > > </li> > > > <% end %> > > > </ul> > > > ==========================> > > > > > It works beautifully ! > > > Let me know if you have any questions. > > > > > > > > > > > > > > > > > > On 3/7/06, Peter De Berdt <peter.de.berdt@pandora.be> wrote: > > > > > > > > > > > > On 07 Mar 2006, at 16:03, Martin Smith wrote: > > > > > > > > > Peter De Berdt wrote: > > > > > > > > > >> > > > > >> If you have the Rails Recipes book, you could read up on the > > > > >> JavaScript helper section and implement the open source version > > > > from > > > > >> the Yahoo UI Library and hide it behind one simple ruby command. > > > > > > > > > > Sadly I don''t. I have looked at the Yahoo UI Library, but could > > > > only > > > > > find the Star Rater in the patterns section, not in the download. > > > > > > > > Well, the nice thing about javascript is that you can extract it > > > > from > > > > a page: > > > > > > > > http://us.js2.yimg.com/us.yimg.com/lib/ls/js/ > > > > yg_multirate_200602281800.js > > > > > > > > They then use the following code to show the rating system: > > > > <script> > > > > if (document.getElementById) > > > > { > > > > // Support for Class A. > > > > rating = new yg_Ratings("rating", "", 0, "star"); > > > > } > > > > else > > > > { > > > > // Support for poor DOM (low grade). > > > > document.write(''<div>''); > > > > document.write(''1 Star<input type="radio" > > > > name="rating" value="" />''); > > > > document.write(''<input type="radio" name="rating1" > > > > value="" />''); > > > > document.write(''<input type="radio" name="rating2" > > > > value="" />''); > > > > document.write(''<input type="radio" name="rating3" > > > > value="" />''); > > > > document.write(''<input type="radio" name="rating4" > > > > value="" />5 > > > > Stars''); > > > > document.write(''</div>''); > > > > //document.write(''<input class="save" type="submit" > > > > name="submit" > > > > value="Save" class="ylsfbtn" />''); > > > > } > > > > </script> > > > > > > > > Just go to http://local.yahoo.com/, search for "Restaurants" in > > > > Location "New York", click on a restaurant for the detail (which has > > > > > > > > the widget) and then look at the source. > > > > > > > > > > > > Best regards > > > > > > > > Peter De Berdt > > > > > > > > _______________________________________________ > > > > Rails mailing list > > > > Rails@lists.rubyonrails.org > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails@lists.rubyonrails.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > > > > > -- > > John Hornbeck > > http://findlawton.com > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-- John Hornbeck -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060717/67965234/attachment-0001.html
hi can uany one give me the entire coding for starrating. plz............ thanks -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---