diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 65be7ab95b..123d929c1c 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -157,6 +157,43 @@ module IssuesHelper 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) ic = Iconv.new(l(:general_csv_encoding), 'UTF-8') decimal_separator = l(:general_csv_decimal_separator) @@ -253,7 +290,7 @@ module IssuesHelper def entries_for_filter_select_sorted(query) # with rails 3.2 ActiveSupport::Inflector.transliterate should be used instead of I18n.transliterate - [["",""]] + query.available_filters.collect{|field| [ field[1][:name] || l(("field_"+field[0].to_s.gsub(/_id$/, "")).to_sym), field[0]] unless query.has_filter?(field[0])}.compact.sort_by do |el| + [["",""]] + query.available_filters.collect{|field| [ field[1][:name] || l(("field_"+field[0].to_s.gsub(/_id$/, "")).to_sym), field[0]] unless query.has_filter?(field[0])}.compact.sort_by do |el| I18n.transliterate(el[0]).downcase end end diff --git a/app/views/issues/_history.rhtml b/app/views/issues/_history.rhtml index 793b69927f..e2f4d052e3 100644 --- a/app/views/issues/_history.rhtml +++ b/app/views/issues/_history.rhtml @@ -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 %> - <%= render_journal issue, journal, :edit_permission => :edit_issue_notes, - :edit_own_permission => :edit_own_issue_notes %> + <%= render_journal issue, + 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 }) %> <% end %> diff --git a/app/views/issues/_subissue_row.rhtml b/app/views/issues/_subissue_row.rhtml deleted file mode 100644 index 6942f5b0f8..0000000000 --- a/app/views/issues/_subissue_row.rhtml +++ /dev/null @@ -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(' ') - ) -%> diff --git a/app/views/issues/_subissues_paragraph.rhtml b/app/views/issues/_subissues_paragraph.rhtml index 7ded4541e5..e586caac58 100644 --- a/app/views/issues/_subissues_paragraph.rhtml +++ b/app/views/issues/_subissues_paragraph.rhtml @@ -9,17 +9,17 @@ <% @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 %> <% end %> - <%= render :partial => 'subissue_row', :locals => { :issue => @issue, :level => indent, :relation => "root" } %> + <%= render_issue_tree_row @issue, indent, "root" %> <% indent += 1 %> <% 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 %>