Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 4726 for applications

Show
Ignore:
Timestamp:
08/08/06 21:01:45 (2 years ago)
Author:
rick
Message:

allow setting of new ratings

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • applications/plugins/app/helpers/application_helper.rb

    r4725 r4726  
    44  end 
    55   
    6   def icon_for(rating, points) 
    7     link_to_function image_tag("#{points > 0 ? :add : :subtract}.gif", :size => '12x12'), 
    8       "Plugin.setRating(#{rating.plugin_id}, #{rating.release_id}, #{points})",  
    9       :id => "release-#{rating.release_id}-#{points > 0 ? :add : :subtract}", :class => (rating.points == points ? 'selected-icon' : 'icon') 
     6  def rating_icon_for(plugin_id, release_id, points, icon_points) 
     7    link_to_function icon_for(icon_points), 
     8      "Plugin.setRating(#{plugin_id}, #{release_id}, #{icon_points})",  
     9      :id => "release-#{release_id}-#{icon_points > 0 ? :add : :subtract}", :class => (points == icon_points ? 'selected-icon' : 'icon') 
     10  end 
     11   
     12  def icon_for(points) 
     13    image_tag("#{points > 0 ? :add : :subtract}.gif", :size => '12x12', :class => 'icon') 
    1014  end 
    1115end 
  • applications/plugins/app/views/ratings/_rating.rhtml

    r4725 r4726  
    1 <li id="<%= rating.dom_id %>">(<%= rating.points %>) <%= link_to rating.plugin.name, plugin_path(rating.plugin_id) %> for <%= link_to rating.release.name, release_path(rating.release_id) %></li> 
     1<li id="<%= rating.dom_id %>"> 
     2  <%= icon_for(rating.points) %>  
     3  <%= link_to rating.release.name, release_path(rating.release_id) %> by 
     4  <%= link_to rating.user.login, user_path(rating.user_id) %> 
     5</li> 
  • applications/plugins/app/views/ratings/index.rhtml

    r4725 r4726  
    77<% @releases.each do |release| rating = @ratings.detect { |r| r.release_id == release.id } ; -%> 
    88  <li> 
    9     <%= icon_for(rating, 1) %> 
    10     <%= icon_for(rating, -1) %> 
     9    <%= rating_icon_for(@plugin.id, release.id, (rating && rating.points || 0), 1) %> 
     10    <%= rating_icon_for(@plugin.id, release.id, (rating && rating.points || 0), -1) %> 
    1111    <%= link_to release.name, release_path(release) %> 
    1212    <%= image_tag 'progress.gif', :size => '10x10', :id => "#{release.dom_id}-spinner", :style => 'display:none' %> 
  • applications/plugins/public/stylesheets/plugins.css

    r4725 r4726  
    6767} 
    6868 
    69 .selected-icon img { 
     69.icon, 
     70.selected-icon img.icon { 
    7071  background-color: #390; 
    7172} 
    7273 
    73 .icon img
     74.icon img.icon
    7475  background-color: #555; 
    7576} 
    7677 
    77 .busy-icon img
     78.busy-icon img.icon
    7879  background-color: #999; 
    7980} 
    8081 
    8182img { border-width:0; } 
     83 
     84ul { 
     85  padding:0; 
     86  margin:0; 
     87  list-style-type:none; 
     88}