Commit 437ba5644e404f700ebd457ceb40c8fb3327df18

Authored by Victor Costa
1 parent 8e62f31b

proposals_discussion: added image icon in topics

lib/proposals_discussion_plugin/topic_helper.rb
1 module ProposalsDiscussionPlugin::TopicHelper 1 module ProposalsDiscussionPlugin::TopicHelper
2 2
3 def topic_title(topic) 3 def topic_title(topic)
4 - content_tag(:div, '', :class=>'topic-color', :style => "background-color: #{topic.color};") +  
5 - content_tag(:h2, link_to(topic.title, topic.view_url)) 4 + image_icon = topic.image ? image_tag(topic.image.public_filename(:thumb), :class => 'disable-zoom') : ''
  5 +
  6 + content_tag(:div, (
  7 + content_tag(:div, '', :class=>'topic-color', :style => "background-color: #{topic.color};") +
  8 + content_tag(:h2, link_to(image_icon + content_tag(:span, topic.title), topic.view_url))
  9 + ), :class => 'topic-title')
6 end 10 end
7 11
8 end 12 end
public/style.css
@@ -156,11 +156,14 @@ form .proposals-discussion-plugin .body textarea { @@ -156,11 +156,14 @@ form .proposals-discussion-plugin .body textarea {
156 #content .topic-item h2 a, #article .article-body-proposals-discussion-plugin_topic h2 a, 156 #content .topic-item h2 a, #article .article-body-proposals-discussion-plugin_topic h2 a,
157 #content .topic h2 a { 157 #content .topic h2 a {
158 text-decoration: none; 158 text-decoration: none;
159 - padding: 10px;  
160 display: inline-block; 159 display: inline-block;
161 width: 94%; 160 width: 94%;
162 color: white; 161 color: white;
163 } 162 }
  163 +#content .topic-title h2 span {
  164 + padding: 10px;
  165 + display: inline-block;
  166 +}
164 .topic-item .topic-content, #article .article-body-proposals-discussion-plugin_topic .topic-content { 167 .topic-item .topic-content, #article .article-body-proposals-discussion-plugin_topic .topic-content {
165 padding: 5px 7px 5px 2px; 168 padding: 5px 7px 5px 2px;
166 } 169 }
@@ -223,3 +226,9 @@ form .proposals-discussion-plugin .body textarea { @@ -223,3 +226,9 @@ form .proposals-discussion-plugin .body textarea {
223 .proposal .actions .fb-share-button { 226 .proposal .actions .fb-share-button {
224 top: -3px; 227 top: -3px;
225 } 228 }
  229 +
  230 +.topic-title h2 img {
  231 + max-height: 36px;
  232 + vertical-align: middle;
  233 + padding: 4px 0 4px 4px;
  234 +}
views/cms/proposals_discussion_plugin/_topic.html.erb
@@ -11,3 +11,8 @@ @@ -11,3 +11,8 @@
11 11
12 <%= labelled_colorpicker_field(_('Color:'), :article, :color) %> 12 <%= labelled_colorpicker_field(_('Color:'), :article, :color) %>
13 <span id="color_preview" class = "color_marker" style="background-color: <%= @article.color %>" ></span> 13 <span id="color_preview" class = "color_marker" style="background-color: <%= @article.color %>" ></span>
  14 +
  15 +<%= f.fields_for :image_builder, @article.image do |i| %>
  16 + <%= file_field_or_thumbnail(_('Image:'), @article.image, i)%>
  17 + <%= _("Max size: %s (.jpg, .gif, .png)")% Image.max_size.to_humanreadable %>
  18 +<% end %>