Commit 53c76729fced2e974abfafb065ac2397d7ef6faa
1 parent
5ddb93d8
Exists in
master
and in
29 other branches
content-viewer: use lead instead of straight abstract
Showing
3 changed files
with
7 additions
and
6 deletions
Show diff stats
app/models/article.rb
... | ... | @@ -724,8 +724,9 @@ class Article < ActiveRecord::Base |
724 | 724 | paragraphs.empty? ? '' : paragraphs.first.to_html |
725 | 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 | 730 | end |
730 | 731 | |
731 | 732 | def short_lead | ... | ... |
app/views/content_viewer/_article_title.html.erb
1 | 1 | <% if @page.belongs_to_blog? || @page.belongs_to_forum?%> |
2 | 2 | <h1 class="title"> |
3 | - <% if no_link %> | |
3 | + <% if no_link %> | |
4 | 4 | <%= h(@page.title) %> |
5 | - <% else %> | |
5 | + <% else %> | |
6 | 6 | <%= link_to(@page.name, @page.url) %> |
7 | - <% end %> | |
7 | + <% end %> | |
8 | 8 | </h1> |
9 | 9 | <%= render :partial => "publishing_info" %> |
10 | 10 | <% unless @page.abstract.blank? %> | ... | ... |