##// END OF EJS Templates
Issue list improvements for subtasking (#5196):...
Jean-Philippe Lang -
r3504:4524bc04e962
parent child
Show More
@@ -18,6 +18,17
18 18 module IssuesHelper
19 19 include ApplicationHelper
20 20
21 def issue_list(issues, &block)
22 ancestors = []
23 issues.each do |issue|
24 while (ancestors.any? && !issue.is_descendant_of?(ancestors.last))
25 ancestors.pop
26 end
27 yield issue, ancestors.size
28 ancestors << issue
29 end
30 end
31
21 32 def render_issue_tooltip(issue)
22 33 @cached_label_start_date ||= l(:field_start_date)
23 34 @cached_label_due_date ||= l(:field_due_date)
@@ -43,17 +54,14 module IssuesHelper
43 54
44 55 def render_descendants_tree(issue)
45 56 s = '<form><table class="list issues">'
46 ancestors = []
47 issue.descendants.sort_by(&:lft).each do |child|
48 level = child.level - issue.level - 1
57 issue_list(issue.descendants.sort_by(&:lft)) do |child, level|
49 58 s << content_tag('tr',
50 59 content_tag('td', check_box_tag("ids[]", child.id, false, :id => nil), :class => 'checkbox') +
51 content_tag('td', link_to_issue(child, :truncate => 60), :class => 'subject',
52 :style => "padding-left: #{level * 20}px") +
60 content_tag('td', link_to_issue(child, :truncate => 60), :class => 'subject') +
53 61 content_tag('td', h(child.status)) +
54 62 content_tag('td', link_to_user(child.assigned_to)) +
55 63 content_tag('td', progress_bar(child.done_ratio, :width => '80px')),
56 :class => "issue-#{child.id} hascontextmenu")
64 :class => "issue issue-#{child.id} hascontextmenu #{level > 0 ? "idnt idnt-#{level}" : nil}")
57 65 end
58 66 s << '</form></table>'
59 67 s
@@ -57,6 +57,8 module QueriesHelper
57 57 l(:general_text_Yes)
58 58 when 'FalseClass'
59 59 l(:general_text_No)
60 when 'Issue'
61 link_to_issue(value, :subject => false)
60 62 else
61 63 h(value)
62 64 end
@@ -81,7 +81,7 module SortHelper
81 81 def to_sql
82 82 sql = @criteria.collect do |k,o|
83 83 if s = @available_criteria[k]
84 (o ? s.to_a : s.to_a.collect {|c| "#{c} DESC"}).join(', ')
84 (o ? s.to_a : s.to_a.collect {|c| append_desc(c)}).join(', ')
85 85 end
86 86 end.compact.join(', ')
87 87 sql.blank? ? nil : sql
@@ -120,6 +120,15 module SortHelper
120 120 @criteria.slice!(3)
121 121 self
122 122 end
123
124 # Appends DESC to the sort criterion unless it has a fixed order
125 def append_desc(criterion)
126 if criterion =~ / (asc|desc)$/i
127 criterion
128 else
129 "#{criterion} DESC"
130 end
131 end
123 132 end
124 133
125 134 def sort_name
@@ -27,10 +27,11 class QueryColumn
27 27 self.groupable = name.to_s
28 28 end
29 29 self.default_order = options[:default_order]
30 @caption_key = options[:caption] || "field_#{name}"
30 31 end
31 32
32 33 def caption
33 l("field_#{name}")
34 l(@caption_key)
34 35 end
35 36
36 37 # Returns true if the column is sortable, otherwise false
@@ -120,6 +121,7 class Query < ActiveRecord::Base
120 121 @@available_columns = [
121 122 QueryColumn.new(:project, :sortable => "#{Project.table_name}.name", :groupable => true),
122 123 QueryColumn.new(:tracker, :sortable => "#{Tracker.table_name}.position", :groupable => true),
124 QueryColumn.new(:parent, :sortable => ["#{Issue.table_name}.root_id", "#{Issue.table_name}.lft ASC"], :default_order => 'desc', :caption => :field_parent_issue),
123 125 QueryColumn.new(:status, :sortable => "#{IssueStatus.table_name}.position", :groupable => true),
124 126 QueryColumn.new(:priority, :sortable => "#{IssuePriority.table_name}.position", :default_order => 'desc', :groupable => true),
125 127 QueryColumn.new(:subject, :sortable => "#{Issue.table_name}.subject"),
@@ -13,7 +13,7
13 13 </tr></thead>
14 14 <% previous_group = false %>
15 15 <tbody>
16 <% issues.each do |issue| -%>
16 <% issue_list(issues) do |issue, level| -%>
17 17 <% if @query.grouped? && (group = @query.group_by_column.value(issue)) != previous_group %>
18 18 <% reset_cycle %>
19 19 <tr class="group open">
@@ -24,7 +24,7
24 24 </tr>
25 25 <% previous_group = group %>
26 26 <% end %>
27 <tr id="issue-<%= issue.id %>" class="hascontextmenu <%= cycle('odd', 'even') %> <%= issue.css_classes %>">
27 <tr id="issue-<%= issue.id %>" class="hascontextmenu <%= cycle('odd', 'even') %> <%= issue.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>">
28 28 <td class="checkbox"><%= check_box_tag("ids[]", issue.id, false, :id => nil) %></td>
29 29 <td><%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %></td>
30 30 <% query.columns.each do |column| %><%= content_tag 'td', column_content(column, issue), :class => column.name %><% end %>
@@ -118,6 +118,17 tr.issue td.subject, tr.issue td.category, td.assigned_to { white-space: normal;
118 118 tr.issue td.subject { text-align: left; }
119 119 tr.issue td.done_ratio table.progress { margin-left:auto; margin-right: auto;}
120 120
121 tr.issue.idnt td.subject a {background: url(../images/bullet_arrow_right.png) no-repeat 0 50%; padding-left: 16px;}
122 tr.issue.idnt-1 td.subject {padding-left: 0.5em;}
123 tr.issue.idnt-2 td.subject {padding-left: 2em;}
124 tr.issue.idnt-3 td.subject {padding-left: 3.5em;}
125 tr.issue.idnt-4 td.subject {padding-left: 5em;}
126 tr.issue.idnt-5 td.subject {padding-left: 6.5em;}
127 tr.issue.idnt-6 td.subject {padding-left: 8em;}
128 tr.issue.idnt-7 td.subject {padding-left: 9.5em;}
129 tr.issue.idnt-8 td.subject {padding-left: 11em;}
130 tr.issue.idnt-9 td.subject {padding-left: 12.5em;}
131
121 132 tr.entry { border: 1px solid #f8f8f8; }
122 133 tr.entry td { white-space: nowrap; }
123 134 tr.entry td.filename { width: 30%; }
General Comments 0
You need to be logged in to leave comments. Login now