Commit 53c76729fced2e974abfafb065ac2397d7ef6faa

Authored by Rodrigo Souto
1 parent 5ddb93d8

content-viewer: use lead instead of straight abstract

app/models/article.rb
@@ -724,8 +724,9 @@ class Article < ActiveRecord::Base @@ -724,8 +724,9 @@ class Article < ActiveRecord::Base
724 paragraphs.empty? ? '' : paragraphs.first.to_html 724 paragraphs.empty? ? '' : paragraphs.first.to_html
725 end 725 end
726 726
727 - def lead  
728 - abstract.blank? ? first_paragraph.html_safe : abstract.html_safe 727 + def lead(length = nil)
  728 + content = abstract.blank? ? first_paragraph.html_safe : abstract.html_safe
  729 + length.present? ? content.truncate(length) : content
729 end 730 end
730 731
731 def short_lead 732 def short_lead
app/views/content_viewer/_article_title.html.erb
1 <% if @page.belongs_to_blog? || @page.belongs_to_forum?%> 1 <% if @page.belongs_to_blog? || @page.belongs_to_forum?%>
2 <h1 class="title"> 2 <h1 class="title">
3 - <% if no_link %> 3 + <% if no_link %>
4 <%= h(@page.title) %> 4 <%= h(@page.title) %>
5 - <% else %> 5 + <% else %>
6 <%= link_to(@page.name, @page.url) %> 6 <%= link_to(@page.name, @page.url) %>
7 - <% end %> 7 + <% end %>
8 </h1> 8 </h1>
9 <%= render :partial => "publishing_info" %> 9 <%= render :partial => "publishing_info" %>
10 <% unless @page.abstract.blank? %> 10 <% unless @page.abstract.blank? %>
app/views/content_viewer/_display_compact_format.html.erb
@@ -16,6 +16,6 @@ @@ -16,6 +16,6 @@
16 </div> 16 </div>
17 <% end %> 17 <% end %>
18 <div class = <%= className %> > 18 <div class = <%= className %> >
19 - <%= article.abstract.truncate(400) %> 19 + <%= article.lead(400) %>
20 </div> 20 </div>
21 </div> 21 </div>