From f4be4d101ba1bcd9979ca57b82db7540d79680fb Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Tue, 16 Mar 2010 21:37:05 +0000 Subject: [PATCH] Inlines some code to speed up large ticket history rendering. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3594 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/journals_helper.rb | 6 +++--- app/views/issues/_history.rhtml | 2 +- app/views/issues/show.rhtml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/helpers/journals_helper.rb b/app/helpers/journals_helper.rb index 4f21b30db..cf8772430 100644 --- a/app/helpers/journals_helper.rb +++ b/app/helpers/journals_helper.rb @@ -16,13 +16,13 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. module JournalsHelper - def render_notes(journal, options={}) + def render_notes(issue, journal, options={}) content = '' - editable = journal.editable_by?(User.current) + editable = User.current.logged? && (User.current.allowed_to?(:edit_issue_notes, issue.project) || (journal.user == User.current && User.current.allowed_to?(:edit_own_issue_notes, issue.project))) links = [] if !journal.notes.blank? links << link_to_remote(image_tag('comment.png'), - { :url => {:controller => 'issues', :action => 'reply', :id => journal.journalized, :journal_id => journal} }, + { :url => {:controller => 'issues', :action => 'reply', :id => issue, :journal_id => journal} }, :title => l(:button_quote)) if options[:reply_links] links << link_to_in_place_notes_editor(image_tag('edit.png'), "journal-#{journal.id}-notes", { :controller => 'journals', :action => 'edit', :id => journal }, diff --git a/app/views/issues/_history.rhtml b/app/views/issues/_history.rhtml index ffbb29399..b57c543e6 100644 --- a/app/views/issues/_history.rhtml +++ b/app/views/issues/_history.rhtml @@ -11,7 +11,7 @@
  • <%= show_detail(detail) %>
  • <% end %> - <%= render_notes(journal, :reply_links => reply_links) unless journal.notes.blank? %> + <%= render_notes(issue, journal, :reply_links => reply_links) unless journal.notes.blank? %> <%= call_hook(:view_issues_history_journal_bottom, { :journal => journal }) %> <% end %> diff --git a/app/views/issues/show.rhtml b/app/views/issues/show.rhtml index 3be765d0c..5f6ba1ba6 100644 --- a/app/views/issues/show.rhtml +++ b/app/views/issues/show.rhtml @@ -89,7 +89,7 @@ <% if @journals.any? %>

    <%=l(:label_history)%>

    -<%= render :partial => 'history', :locals => { :journals => @journals } %> +<%= render :partial => 'history', :locals => { :issue => @issue, :journals => @journals } %>
    <% end %>