Commit 54c6e8ec3a43cd3332d7e99d373cc2e94536f1fc

Authored by Victor Costa
1 parent f40b7ae9

proposals_discussion: added color to topics

lib/proposals_discussion_plugin/topic.rb
@@ -6,6 +6,10 @@ class ProposalsDiscussionPlugin::Topic < Folder @@ -6,6 +6,10 @@ class ProposalsDiscussionPlugin::Topic < Folder
6 has_many :proposals_comments, :class_name => 'Comment', :through => :children, :source => :comments 6 has_many :proposals_comments, :class_name => 'Comment', :through => :children, :source => :comments
7 has_many :proposals_authors, :class_name => 'Person', :through => :children, :source => :created_by 7 has_many :proposals_authors, :class_name => 'Person', :through => :children, :source => :created_by
8 8
  9 + settings_items :color, :type => :string
  10 +
  11 + attr_accessible :color
  12 +
9 def self.short_description 13 def self.short_description
10 _("Discussion topic") 14 _("Discussion topic")
11 end 15 end
public/style.css
@@ -9,10 +9,10 @@ @@ -9,10 +9,10 @@
9 background: rgb(236, 236, 236); 9 background: rgb(236, 236, 236);
10 width: 100%; 10 width: 100%;
11 min-width: 272px; 11 min-width: 272px;
12 - display: table;  
13 vertical-align: top; 12 vertical-align: top;
14 margin: 12px 13px 12px 0; 13 margin: 12px 13px 12px 0;
15 box-shadow: 5px 5px 5px -2px #ddd; 14 box-shadow: 5px 5px 5px -2px #ddd;
  15 + height: 100px;
16 } 16 }
17 17
18 .article-body-proposals-discussion-plugin_discussion .actions, 18 .article-body-proposals-discussion-plugin_discussion .actions,
@@ -25,6 +25,8 @@ @@ -25,6 +25,8 @@
25 border-right: 1px solid; 25 border-right: 1px solid;
26 border-color: rgb(201, 201, 201); 26 border-color: rgb(201, 201, 201);
27 padding: 5px; 27 padding: 5px;
  28 + vertical-align: middle;
  29 + height: 100%;
28 } 30 }
29 .proposal .topic { 31 .proposal .topic {
30 border-right: 0; 32 border-right: 0;
@@ -46,7 +48,7 @@ @@ -46,7 +48,7 @@
46 } 48 }
47 49
48 #article .proposal a:visited, #article .proposal a { 50 #article .proposal a:visited, #article .proposal a {
49 - color: rgb(94, 94, 94); 51 + color: rgb(70, 70, 70);
50 text-decoration: none; 52 text-decoration: none;
51 width: 100%; 53 width: 100%;
52 display: inline-block; 54 display: inline-block;
@@ -59,6 +61,8 @@ @@ -59,6 +61,8 @@
59 .proposal .content { 61 .proposal .content {
60 width: 68%; 62 width: 68%;
61 color: rgb(83, 83, 83); 63 color: rgb(83, 83, 83);
  64 + vertical-align: top;
  65 + height: 90px;
62 } 66 }
63 67
64 .proposal .abstract { 68 .proposal .abstract {
@@ -76,3 +80,32 @@ form .proposals-discussion-plugin .abstract textarea { @@ -76,3 +80,32 @@ form .proposals-discussion-plugin .abstract textarea {
76 form .proposals-discussion-plugin .body textarea { 80 form .proposals-discussion-plugin .body textarea {
77 height: 400px; 81 height: 400px;
78 } 82 }
  83 +
  84 +.topic-color {
  85 + width: 9px;
  86 + float: left;
  87 + height: 100%;
  88 +}
  89 +
  90 +.topics .topic {
  91 + background-color: rgb(233, 233, 233);
  92 + margin: 5px 0;
  93 + height: 25px;
  94 +}
  95 +
  96 +#article .proposal .topic a {
  97 + font-weight: bold;
  98 + color: #888a85;
  99 + width: 100%;
  100 + height: 100%;
  101 +}
  102 +
  103 +#article .topics .topic a {
  104 + text-decoration: none;
  105 + display: inline-block;
  106 + width: 95%;
  107 + height: 100%;
  108 + padding-left: 5px;
  109 + font-weight: bold;
  110 + font-size: 14px;
  111 +}
views/cms/proposals_discussion_plugin/_topic.html.erb 0 → 100644
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
  1 +<%= required_fields_message %>
  2 +
  3 +<%= required f.text_field('name', :size => '64', :maxlength => 150) %>
  4 +<%= render :partial => 'general_fields' %>
  5 +
  6 +<%= labelled_form_field(_('Description:'), text_area(:article, :body, :rows => 3, :cols => 64)) %>
  7 +
  8 +<!-- FIXME: Use the colorpicker component from AI2915 -->
  9 +<%= labelled_form_field(_('Color:'), text_field(:article, :color)) %>
views/content_viewer/_proposal_card.html.erb
1 <div class="proposal"> 1 <div class="proposal">
  2 + <div class="topic-color" style="background-color: <%= proposal_card.topic.color %>;"></div>
2 <div class="content"> 3 <div class="content">
3 <div class="title"> 4 <div class="title">
4 <%= link_to proposal_card.name, proposal_card.view_url %> 5 <%= link_to proposal_card.name, proposal_card.view_url %>
views/content_viewer/discussion.html.erb
@@ -13,9 +13,11 @@ @@ -13,9 +13,11 @@
13 <div class="topics"> 13 <div class="topics">
14 <h3><%= _('Discussion Topics') %></h3> 14 <h3><%= _('Discussion Topics') %></h3>
15 <% @page.topics.includes(:profile).each do |topic| %> 15 <% @page.topics.includes(:profile).each do |topic| %>
16 - <div class="topic"><%= link_to topic.title, topic.view_url %></div> 16 + <div class="topic">
  17 + <div class="topic-color" style="background-color: <%= topic.color %>;"></div>
  18 + <%= link_to topic.title, topic.view_url %>
  19 + </div>
17 <% end %> 20 <% end %>
18 - <div class="clear"></div>  
19 </div> 21 </div>
20 22
21 <div class="actions"> 23 <div class="actions">