Commit 03dce3f0666da44be941465d612de994c8f8749c

Authored by Francisco Marcelo A. Lima Júnior
1 parent eaac9e87

added image field to article

app/views/shared/_lead_and_body.rhtml
... ... @@ -6,12 +6,18 @@
6 6 <% editor_type = defined?(tiny_mce) && tiny_mce ? 'mceEditor' : '' %>
7 7 <% lead_id ||= 0%>
8 8 <% f ||= false%>
  9 +<% image_method ||= :image_builder %>
9 10  
10 11 <br style="clear: both;"/>
11 12 <%= button :add, _("Lead"), '#', :class => "lead-button", :article_id => "#article-lead-"+lead_id.to_s, :style => "margin-left: 0px;" %>
12 13 <em><%= _('Used when a short version of your text is needed.') %></em>
13 14  
14 15 <div class='article-lead' id="article-lead-<%=lead_id.to_s%>">
  16 +
  17 + <% fields_for 'article[image_builder]', @article.image do |i| %>
  18 + <%= file_field_or_thumbnail(_('Image:'), @article.image, i) %>
  19 + <% end %>
  20 +
15 21 <% if f %>
16 22 <%= labelled_form_field(_(abstract_label), f.text_area(abstract_method, :style => 'width: 98%; height: 200px;', :class => editor_type)) %>
17 23 <% else %>
... ...
plugins/display_content/lib/display_content_block.rb
... ... @@ -54,17 +54,17 @@ class DisplayContentBlock &lt; Block
54 54  
55 55 sections.select { |section|
56 56 case section[:name]
57   - when 'title'
  57 + when 'Title'
58 58 content_sections += (display_section?(section) ? (content_tag('div', link_to(h(item.title), item.url), :class => 'title') ) : '')
59   - when 'abstract'
  59 + when 'Abstract'
60 60 content_sections += (display_section?(section) ? (content_tag('div', item.abstract ,:class => 'lead')) : '' )
61 61 if display_section?(section)
62 62 content_sections += (display_section?(section) ? (content_tag('div', item.abstract ,:class => 'lead')) : '' )
63 63 read_more_section = content_tag('div', link_to(_('Read more'), item.url), :class => 'read_more')
64 64 end
65   - when 'body'
  65 + when 'Body'
66 66 content_sections += (display_section?(section) ? (content_tag('div', item.body ,:class => 'body')) : '' )
67   - when 'image'
  67 + when 'Image'
68 68 image_section = image_tag item.image.public_filename if item.image
69 69 if !image_section.blank?
70 70 content_sections += (display_section?(section) ? (content_tag('div', link_to( image_section, item.url ) ,:class => 'image')) : '' )
... ...