Commit 4524bc04 authored by Jean-Philippe Lang's avatar Jean-Philippe Lang

Issue list improvements for subtasking (#5196):

* makes the parent task column available
* display the issue hierarchy when list is sorted by parent

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3618 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 06d2c3fd
......@@ -18,6 +18,17 @@
module IssuesHelper
include ApplicationHelper
def issue_list(issues, &block)
ancestors = []
issues.each do |issue|
while (ancestors.any? && !issue.is_descendant_of?(ancestors.last))
ancestors.pop
end
yield issue, ancestors.size
ancestors << issue
end
end
def render_issue_tooltip(issue)
@cached_label_start_date ||= l(:field_start_date)
@cached_label_due_date ||= l(:field_due_date)
......@@ -43,17 +54,14 @@ module IssuesHelper
def render_descendants_tree(issue)
s = '<form><table class="list issues">'
ancestors = []
issue.descendants.sort_by(&:lft).each do |child|
level = child.level - issue.level - 1
issue_list(issue.descendants.sort_by(&:lft)) do |child, level|
s << content_tag('tr',
content_tag('td', check_box_tag("ids[]", child.id, false, :id => nil), :class => 'checkbox') +
content_tag('td', link_to_issue(child, :truncate => 60), :class => 'subject',
:style => "padding-left: #{level * 20}px") +
content_tag('td', link_to_issue(child, :truncate => 60), :class => 'subject') +
content_tag('td', h(child.status)) +
content_tag('td', link_to_user(child.assigned_to)) +
content_tag('td', progress_bar(child.done_ratio, :width => '80px')),
:class => "issue-#{child.id} hascontextmenu")
:class => "issue issue-#{child.id} hascontextmenu #{level > 0 ? "idnt idnt-#{level}" : nil}")
end
s << '</form></table>'
s
......
......@@ -57,6 +57,8 @@ module QueriesHelper
l(:general_text_Yes)
when 'FalseClass'
l(:general_text_No)
when 'Issue'
link_to_issue(value, :subject => false)
else
h(value)
end
......
......@@ -81,7 +81,7 @@ module SortHelper
def to_sql
sql = @criteria.collect do |k,o|
if s = @available_criteria[k]
(o ? s.to_a : s.to_a.collect {|c| "#{c} DESC"}).join(', ')
(o ? s.to_a : s.to_a.collect {|c| append_desc(c)}).join(', ')
end
end.compact.join(', ')
sql.blank? ? nil : sql
......@@ -120,6 +120,15 @@ module SortHelper
@criteria.slice!(3)
self
end
# Appends DESC to the sort criterion unless it has a fixed order
def append_desc(criterion)
if criterion =~ / (asc|desc)$/i
criterion
else
"#{criterion} DESC"
end
end
end
def sort_name
......
......@@ -27,10 +27,11 @@ class QueryColumn
self.groupable = name.to_s
end
self.default_order = options[:default_order]
@caption_key = options[:caption] || "field_#{name}"
end
def caption
l("field_#{name}")
l(@caption_key)
end
# Returns true if the column is sortable, otherwise false
......@@ -120,6 +121,7 @@ class Query < ActiveRecord::Base
@@available_columns = [
QueryColumn.new(:project, :sortable => "#{Project.table_name}.name", :groupable => true),
QueryColumn.new(:tracker, :sortable => "#{Tracker.table_name}.position", :groupable => true),
QueryColumn.new(:parent, :sortable => ["#{Issue.table_name}.root_id", "#{Issue.table_name}.lft ASC"], :default_order => 'desc', :caption => :field_parent_issue),
QueryColumn.new(:status, :sortable => "#{IssueStatus.table_name}.position", :groupable => true),
QueryColumn.new(:priority, :sortable => "#{IssuePriority.table_name}.position", :default_order => 'desc', :groupable => true),
QueryColumn.new(:subject, :sortable => "#{Issue.table_name}.subject"),
......
......@@ -13,7 +13,7 @@
</tr></thead>
<% previous_group = false %>
<tbody>
<% issues.each do |issue| -%>
<% issue_list(issues) do |issue, level| -%>
<% if @query.grouped? && (group = @query.group_by_column.value(issue)) != previous_group %>
<% reset_cycle %>
<tr class="group open">
......@@ -24,7 +24,7 @@
</tr>
<% previous_group = group %>
<% end %>
<tr id="issue-<%= issue.id %>" class="hascontextmenu <%= cycle('odd', 'even') %> <%= issue.css_classes %>">
<tr id="issue-<%= issue.id %>" class="hascontextmenu <%= cycle('odd', 'even') %> <%= issue.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>">
<td class="checkbox"><%= check_box_tag("ids[]", issue.id, false, :id => nil) %></td>
<td><%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %></td>
<% 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;
tr.issue td.subject { text-align: left; }
tr.issue td.done_ratio table.progress { margin-left:auto; margin-right: auto;}
tr.issue.idnt td.subject a {background: url(../images/bullet_arrow_right.png) no-repeat 0 50%; padding-left: 16px;}
tr.issue.idnt-1 td.subject {padding-left: 0.5em;}
tr.issue.idnt-2 td.subject {padding-left: 2em;}
tr.issue.idnt-3 td.subject {padding-left: 3.5em;}
tr.issue.idnt-4 td.subject {padding-left: 5em;}
tr.issue.idnt-5 td.subject {padding-left: 6.5em;}
tr.issue.idnt-6 td.subject {padding-left: 8em;}
tr.issue.idnt-7 td.subject {padding-left: 9.5em;}
tr.issue.idnt-8 td.subject {padding-left: 11em;}
tr.issue.idnt-9 td.subject {padding-left: 12.5em;}
tr.entry { border: 1px solid #f8f8f8; }
tr.entry td { white-space: nowrap; }
tr.entry td.filename { width: 30%; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment