hier-list.patch

Fri Flaj, 2010-03-19 09:45

Download (5.67 KB)

View differences:

app/controllers/issues_controller.rb
70 70
      
71 71
      @issue_count = @query.issue_count
72 72
      @issue_pages = Paginator.new self, @issue_count, limit, params['page']
73

  
74
      hier_sort_clause = sort_clause
75
      if hier_sort_clause == 'issues.id DESC'
76
        hier_sort_clause = 'issues.root_id DESC, issues.lft'
77
      elsif hier_sort_clause == 'issues.id'
78
        hier_sort_clause = 'issues.root_id, issues.lft'
79
      end
80

  
73 81
      @issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version],
74
                              :order => sort_clause, 
82
                              :order => hier_sort_clause, 
75 83
                              :offset => @issue_pages.current.offset, 
76 84
                              :limit => limit)
77 85
      @issue_count_by_group = @query.issue_count_by_group
app/controllers/projects_controller.rb
303 303
        issues = version.fixed_issues.visible.find(:all,
304 304
                                                   :include => [:project, :status, :tracker, :priority],
305 305
                                                   :conditions => {:tracker_id => @selected_tracker_ids, :project_id => project_ids},
306
                                                   :order => "#{Project.table_name}.lft, #{Tracker.table_name}.position, #{Issue.table_name}.id")
306
                                                   :order => "#{Project.table_name}.lft, #{Tracker.table_name}.position, #{Issue.table_name}.root_id, #{Issue.table_name}.lft")
307 307
        @issues_by_version[version] = issues
308 308
      end
309 309
    end
app/helpers/application_helper.rb
87 87
    s = link_to "#{issue.tracker} ##{issue.id}", {:controller => "issues", :action => "show", :id => issue}, 
88 88
                                                 :class => issue.css_classes,
89 89
                                                 :title => title
90
    s << ": #{h subject}" if subject
90

  
91
    if subject
92
      s << ": "
93
      if options[:indent] == true
94
        s << "<span style=\"padding-left: #{issue.level}em\"></span>"
95
      end
96
      s << "#{h subject}"
97
    end
98

  
91 99
    s = "#{h issue.project} - " + s if options[:project]
92 100
    s
93 101
  end
app/models/issue.rb
191 191
  def estimated_hours=(h)
192 192
    write_attribute :estimated_hours, (h.is_a?(String) ? h.to_hours : h)
193 193
  end
194
  
194

  
195 195
  SAFE_ATTRIBUTES = %w(
196 196
    tracker_id
197 197
    status_id
......
207 207
    done_ratio
208 208
    estimated_hours
209 209
    custom_field_values
210
    level
210 211
  ) unless const_defined?(:SAFE_ATTRIBUTES)
211 212
  
212 213
  # Safely sets attributes
app/views/issues/_list.rhtml
27 27
	<tr id="issue-<%= issue.id %>" class="hascontextmenu <%= cycle('odd', 'even') %> <%= issue.css_classes %>">
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
        <% query.columns.each do |column| %><%= content_tag 'td', column_content(column, issue), :class => column.name %><% end %>
30
        <% query.columns.each do |column| %>
31
            <%
32
                if column.name == :subject
33
                    indent = "padding-left: #{issue.level}em"
34
                else
35
                    indent = ""
36
                end
37
            %>
38
            <%= content_tag 'td', column_content(column, issue), :style => indent, :class => column.name %>
39
        <% end %>
31 40
	</tr>
32 41
	<% end -%>
33 42
	</tbody>
app/views/projects/roadmap.rhtml
16 16
    <%- issues.each do |issue| -%>
17 17
      <tr class="hascontextmenu">
18 18
        <td class="checkbox"><%= check_box_tag 'ids[]', issue.id %></td>
19
        <td><%= link_to_issue(issue, :project => (@project != issue.project)) %></td>
19
        <td><%= link_to_issue(issue, {:project => (@project != issue.project), :indent => true}) %></td>
20 20
      </tr>
21 21
    <%- end -%>
22 22
    </table>
app/views/versions/show.rhtml
37 37
                                       :order => "#{Tracker.table_name}.position, #{Issue.table_name}.id") %>
38 38
<% if issues.size > 0 %>
39 39
<fieldset class="related-issues"><legend><%= l(:label_related_issues) %></legend>
40
<ul>
41
<% issues.each do |issue| -%>
42
    <li><%= link_to_issue(issue) %></li>
43
<% end -%>
44
</ul>
40
  <table class="list related-issues">
41
    <%- issues.each do |issue| -%>
42
      <tr>
43
        <td><%= link_to_issue(issue, {:project => (@project != issue.project), :indent => true}) %></td>
44
      </tr>
45
    <%- end -%>
46
    </table>
45 47
</fieldset>
46 48
<% end %>
47 49
</div>