Commit 0e46fe3379b75b26896ed44dd798979db094b0e4
1 parent
2c0016f2
Exists in
master
and in
11 other branches
proposals_discussion: added score icon
Showing
5 changed files
with
13 additions
and
6 deletions
Show diff stats
lib/proposals_discussion_plugin/proposal.rb
| ... | ... | @@ -30,7 +30,7 @@ class ProposalsDiscussionPlugin::Proposal < TinyMceArticle |
| 30 | 30 | end |
| 31 | 31 | |
| 32 | 32 | def normalized_score(holder) |
| 33 | - ((score - holder.min_score)/(holder.max_score - holder.min_score).to_f).round(2) | |
| 33 | + (score/holder.max_score.to_f).round(2) | |
| 34 | 34 | end |
| 35 | 35 | |
| 36 | 36 | end | ... | ... |
lib/proposals_discussion_plugin/topic.rb
public/images/comments.gif
1.66 KB
public/style.css
| ... | ... | @@ -33,6 +33,13 @@ |
| 33 | 33 | width: 5%; |
| 34 | 34 | text-align: center; |
| 35 | 35 | } |
| 36 | +.proposal .score span { | |
| 37 | + background: url(/plugins/proposals_discussion/images/score.png) no-repeat; | |
| 38 | + display: inline-block; | |
| 39 | + width: 25px; | |
| 40 | + height: 19px; | |
| 41 | + position: relative; | |
| 42 | +} | |
| 36 | 43 | |
| 37 | 44 | .proposal .content:hover, .proposal .topic:hover { |
| 38 | 45 | background: rgb(230, 230, 230); | ... | ... |
views/content_viewer/_proposal_card.html.erb
| 1 | 1 | <div class="proposal"> |
| 2 | 2 | <div class="score"> |
| 3 | - <%= proposal_card.normalized_score(@holder) if proposal_card.published? %> | |
| 3 | + <% if proposal_card.published? %> | |
| 4 | + <% normalized_score = proposal_card.normalized_score(@holder) %> | |
| 5 | + <% size = 25 - [5, normalized_score*25].max %> | |
| 6 | + <span title="<%= normalized_score %>" style="left:-<%= size %>px;background-position-x: <%= size %>px"> </span> | |
| 7 | + <% end %> | |
| 4 | 8 | </div> |
| 5 | 9 | <div class="content"> |
| 6 | 10 | <div class="title"> | ... | ... |