summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2010-03-27 16:55:20 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2010-03-27 16:55:20 +0000
commit4524bc04e9627e93317a7fa6e6af6252f1276a0f (patch)
treefabcfa8d6df85b785f336878ec5e313ef7cace63
parent06d2c3fd4e4a39ae036444127a99ef0db9d7b00e (diff)
downloadredmine-4524bc04e9627e93317a7fa6e6af6252f1276a0f.tar.gz
redmine-4524bc04e9627e93317a7fa6e6af6252f1276a0f.zip
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
-rw-r--r--app/helpers/issues_helper.rb20
-rw-r--r--app/helpers/queries_helper.rb2
-rw-r--r--app/helpers/sort_helper.rb11
-rw-r--r--app/models/query.rb4
-rw-r--r--app/views/issues/_list.rhtml4
-rw-r--r--public/stylesheets/application.css11
6 files changed, 42 insertions, 10 deletions
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index 609aae204..18d2af317 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -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
diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb
index ecfac55ad..997e5ff5a 100644
--- a/app/helpers/queries_helper.rb
+++ b/app/helpers/queries_helper.rb
@@ -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
diff --git a/app/helpers/sort_helper.rb b/app/helpers/sort_helper.rb
index 4ea7b87b0..c1a89db5a 100644
--- a/app/helpers/sort_helper.rb
+++ b/app/helpers/sort_helper.rb
@@ -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
diff --git a/app/models/query.rb b/app/models/query.rb
index ae162b0a7..1ecf8dcea 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -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"),
diff --git a/app/views/issues/_list.rhtml b/app/views/issues/_list.rhtml
index b29476d58..48e8311a5 100644
--- a/app/views/issues/_list.rhtml
+++ b/app/views/issues/_list.rhtml
@@ -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 %>
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css
index e82e6341b..356e25471 100644
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -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%; }