Much smarter project note truncation

Fixes #780
This commit is contained in:
Eric Allen 2010-04-02 09:14:25 -04:00
parent 3146fa6bd1
commit 205c4e7ed4
5 changed files with 90 additions and 2 deletions

View file

@ -2,4 +2,8 @@ module NotesHelper
def truncated_note(note, characters = 50)
sanitize(textilize_without_paragraph(truncate(note.body, :length => characters, :omission => "...")))
end
def rendered_note(note)
sanitize(textilize_without_paragraph(note.body))
end
end

View file

@ -6,7 +6,8 @@
'jquery.autocomplete', :cache => true %>
<%= stylesheet_link_tag "print", :media => "print" %>
<%= javascript_include_tag 'jquery','jquery-ui','jquery.cookie',
'jquery.blockUI','jquery.jeditable','jquery.autocomplete', :cache => 'jquery-all' %>
'jquery.blockUI','jquery.jeditable','jquery.autocomplete',
'jquery.truncator', :cache => 'jquery-all' %>
<%= javascript_include_tag 'hoverIntent','superfish','application',
'accesskey-hints','niftycube','flashobject', :cache => 'tracks' %>
<%= javascript_tag "var AUTH_TOKEN = #{form_authenticity_token.inspect};" if protect_against_forgery? %>

View file

@ -1,6 +1,6 @@
<% note = notes_summary -%>
<div class="note_wrapper" id="<%= dom_id(note) %>">
<%= link_to( image_tag("blank.png", :border => 0), note_path(note), :title => "Show note", :class => "link_to_notes icon") %>&nbsp;
<%= truncated_note(note) %>
<%= rendered_note(note) %>
</div>
<% note = nil -%>