diff --git a/app/models/article.rb b/app/models/article.rb index 2a97e99..6899eac 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -724,8 +724,9 @@ class Article < ActiveRecord::Base paragraphs.empty? ? '' : paragraphs.first.to_html end - def lead - abstract.blank? ? first_paragraph.html_safe : abstract.html_safe + def lead(length = nil) + content = abstract.blank? ? first_paragraph.html_safe : abstract.html_safe + length.present? ? content.truncate(length) : content end def short_lead diff --git a/app/views/content_viewer/_article_title.html.erb b/app/views/content_viewer/_article_title.html.erb index 36eaea9..240b8b7 100644 --- a/app/views/content_viewer/_article_title.html.erb +++ b/app/views/content_viewer/_article_title.html.erb @@ -1,10 +1,10 @@ <% if @page.belongs_to_blog? || @page.belongs_to_forum?%>

- <% if no_link %> + <% if no_link %> <%= h(@page.title) %> - <% else %> + <% else %> <%= link_to(@page.name, @page.url) %> - <% end %> + <% end %>

<%= render :partial => "publishing_info" %> <% unless @page.abstract.blank? %> diff --git a/app/views/content_viewer/_display_compact_format.html.erb b/app/views/content_viewer/_display_compact_format.html.erb index 32d3f11..02b83ac 100644 --- a/app/views/content_viewer/_display_compact_format.html.erb +++ b/app/views/content_viewer/_display_compact_format.html.erb @@ -16,6 +16,6 @@ <% end %>
> - <%= article.abstract.truncate(400) %> + <%= article.lead(400) %>
-- libgit2 0.21.2