Merge pull request #26 from opf/perf/issue_show_history

Perf/issue show history
pull/27/merge
cratz 12 years ago
commit c19e611a66
  1. 37
      app/helpers/issues_helper.rb
  2. 13
      app/views/issues/_history.rhtml
  3. 36
      app/views/issues/_subissue_row.rhtml
  4. 6
      app/views/issues/_subissues_paragraph.rhtml

@ -157,6 +157,43 @@ module IssuesHelper
end end
end end
def render_issue_tree_row(issue, level, relation)
css_classes = ["issue"]
css_classes << "issue-#{issue.id}"
css_classes << "idnt" << "idnt-#{level}" if level > 0
if relation == "root"
issue_text = link_to("#{h(issue.tracker.name)} ##{issue.id}",
'javascript:void(0)',
:style => "color:inherit; font-weight: bold; text-decoration:none; cursor:default;",
:class => issue.css_classes)
else
title = []
if relation == "parent"
title << content_tag(:span, l(:description_parent_issue), :class => "hidden-for-sighted")
elsif relation == "child"
title << content_tag(:span, l(:description_sub_issue), :class => "hidden-for-sighted")
end
title << h(issue.tracker.name)
title << "##{issue.id}"
issue_text = link_to(title.join(' '), issue_path(issue), :class => issue.css_classes)
end
issue_text << ": "
issue_text << truncate(issue.subject, :length => 60)
content_tag('tr', [
content_tag('td', check_box_tag("ids[]", issue.id, false, :id => nil), :class => 'checkbox'),
content_tag('td', issue_text, :class => 'subject'),
content_tag('td', h(issue.status)),
content_tag('td', link_to_user(issue.assigned_to)),
content_tag('td', link_to_version(issue.fixed_version))
].join,
:class => css_classes.join(' ')
)
end
def issues_to_csv(issues, project = nil) def issues_to_csv(issues, project = nil)
ic = Iconv.new(l(:general_csv_encoding), 'UTF-8') ic = Iconv.new(l(:general_csv_encoding), 'UTF-8')
decimal_separator = l(:general_csv_decimal_separator) decimal_separator = l(:general_csv_decimal_separator)

@ -1,6 +1,15 @@
<%# Uses a cache to render the history. The placeing of this object
is somewhat arbitrary. The important point is that it is not instantiated within
a journal as the cache could then not be used between all of an issue's journals. %>
<% @journal_cache = Acts::Journalized::JournalObjectCache.new %>
<% for journal in journals %> <% for journal in journals %>
<%= render_journal issue, journal, :edit_permission => :edit_issue_notes, <%= render_journal issue,
:edit_own_permission => :edit_own_issue_notes %> journal,
:edit_permission => :edit_issue_notes,
:edit_own_permission => :edit_own_issue_notes,
:cache => @journal_cache %>
<%= call_hook(:view_issues_history_journal_bottom, { :journal => journal }) %> <%= call_hook(:view_issues_history_journal_bottom, { :journal => journal }) %>
<% end %> <% end %>

@ -1,36 +0,0 @@
<%
css_classes = ["issue"]
css_classes << "issue-#{issue.id}"
css_classes << "idnt" << "idnt-#{level}" if level > 0
if relation == "root"
issue_text = link_to("#{h(issue.tracker.name)} ##{issue.id}",
'javascript:void(0)',
:style => "color:inherit; font-weight: bold; text-decoration:none; cursor:default;",
:class => issue.css_classes)
else
title = ''
if relation == "parent"
title << content_tag(:span, l(:description_parent_issue), :class => "hidden-for-sighted")
elsif relation == "child"
title << content_tag(:span, l(:description_sub_issue), :class => "hidden-for-sighted")
end
title << " #{h(issue.tracker.name)} ##{issue.id}"
issue_text = link_to(title, issue, :class => issue.css_classes)
end
issue_text << ": "
issue_text << truncate(issue.subject, :length => 60)
%>
<%=
content_tag('tr', [
content_tag('td', check_box_tag("ids[]", issue.id, false, :id => nil), :class => 'checkbox'),
content_tag('td', issue_text, :class => 'subject'),
content_tag('td', h(issue.status)),
content_tag('td', link_to_user(issue.assigned_to)),
content_tag('td', link_to_version(issue.fixed_version))
].join,
:class => css_classes.join(' ')
)
%>

@ -9,17 +9,17 @@
<!-- render parent elements --> <!-- render parent elements -->
<% @issue.ancestors.each do |issue| %> <% @issue.ancestors.each do |issue| %>
<%= render :partial => 'subissue_row', :locals => { :issue => issue, :level => indent, :relation => "parent" } %> <%= render_issue_tree_row issue, indent, "parent" %>
<% indent += 1 %> <% indent += 1 %>
<% end %> <% end %>
<!-- render current element --> <!-- render current element -->
<%= render :partial => 'subissue_row', :locals => { :issue => @issue, :level => indent, :relation => "root" } %> <%= render_issue_tree_row @issue, indent, "root" %>
<% indent += 1 %> <% indent += 1 %>
<!-- render child elements --> <!-- render child elements -->
<% issue_list(@issue.descendants.sort_by(&:lft)) do |issue, level| %> <% issue_list(@issue.descendants.sort_by(&:lft)) do |issue, level| %>
<%= render :partial => 'subissue_row', :locals => { :issue => issue, :level => indent + level, :relation => "child" } %> <%= render_issue_tree_row issue, indent + level, "child" %>
<% end %> <% end %>
</table> </table>

Loading…
Cancel
Save