Commit 351a5817f7193ff03fda2a671429ae7250d494a7

Authored by Victor Costa
1 parent 4839450f

proposals_discussion: show tags in topic view

plugins/proposals_discussion/lib/proposals_discussion_plugin/topic.rb
@@ -36,4 +36,11 @@ class ProposalsDiscussionPlugin::Topic < Folder @@ -36,4 +36,11 @@ class ProposalsDiscussionPlugin::Topic < Folder
36 @max ||= [1, proposals.maximum(:comments_count)].max 36 @max ||= [1, proposals.maximum(:comments_count)].max
37 end 37 end
38 38
  39 + def proposal_tags
  40 + proposals.tag_counts.inject({}) do |memo,tag|
  41 + memo[tag.name] = tag.count
  42 + memo
  43 + end
  44 + end
  45 +
39 end 46 end
plugins/proposals_discussion/public/style.css
@@ -170,3 +170,18 @@ form .proposals-discussion-plugin .body textarea { @@ -170,3 +170,18 @@ form .proposals-discussion-plugin .body textarea {
170 position: absolute; 170 position: absolute;
171 top: -18px; 171 top: -18px;
172 } 172 }
  173 +
  174 +#content .tag_cloud a {
  175 + text-decoration: none;
  176 +}
  177 +
  178 +#content .statistics {
  179 + display: inline-block;
  180 +}
  181 +#content .tag_cloud {
  182 + float: right;
  183 + width: 300px;
  184 + box-shadow: 5px 5px 5px -2px #ddd;
  185 + background-color: rgb(248, 248, 248);
  186 + min-height: 50px;
  187 +}
plugins/proposals_discussion/views/content_viewer/topic.html.erb
@@ -15,25 +15,30 @@ @@ -15,25 +15,30 @@
15 15
16 <% unless list_view %> 16 <% unless list_view %>
17 <h4><%= topic.discussion.title %></h4> 17 <h4><%= topic.discussion.title %></h4>
18 -<div class="proposals-count">  
19 - <span class="label"><%= _('Number of Proposals: ') %></span>  
20 - <span class="content"><%= topic.proposals.count %></span> 18 +<div class="statistics">
  19 + <div class="proposals-count">
  20 + <span class="label"><%= _('Number of Proposals: ') %></span>
  21 + <span class="content"><%= topic.proposals.count %></span>
  22 + </div>
  23 + <div class="participants-count">
  24 + <span class="label"><%= _('Number of Participants: ') %></span>
  25 + <span class="content"><%= topic.proposals_authors.count %></span>
  26 + </div>
  27 + <div class="comments-count">
  28 + <span class="label"><%= _('Number of Comments: ') %></span>
  29 + <span class="content"><%= topic.proposals_comments.count %></span>
  30 + </div>
  31 + <div class="active-participants">
  32 + <span class="label"><%= _('Most active: ') %></span>
  33 + <span class="content">
  34 + <% topic.most_active_participants.each do |author| %>
  35 + <%= link_to profile_image(author, :icon), author.url, :title => author.name %>
  36 + <% end %>
  37 + </span>
  38 + </div>
21 </div> 39 </div>
22 -<div class="participants-count">  
23 - <span class="label"><%= _('Number of Participants: ') %></span>  
24 - <span class="content"><%= topic.proposals_authors.count %></span>  
25 -</div>  
26 -<div class="comments-count">  
27 - <span class="label"><%= _('Number of Comments: ') %></span>  
28 - <span class="content"><%= topic.proposals_comments.count %></span>  
29 -</div>  
30 -<div class="active-participants">  
31 - <span class="label"><%= _('Most active: ') %></span>  
32 - <span class="content">  
33 - <% topic.most_active_participants.each do |author| %>  
34 - <%= link_to profile_image(author, :icon), author.url, :title => author.name %>  
35 - <% end %>  
36 - </span> 40 +<div class="tag_cloud">
  41 + <%= tag_cloud(topic.proposal_tags, :tag, {:action => :tag, :controller => 'search'}, :max_size => 18, :min_size => 10) %>
37 </div> 42 </div>
38 <% end %> 43 <% end %>
39 44