[#4552] Link the issue counts to filtered Issue lists
This commit is contained in:
@@ -143,4 +143,19 @@ module ContractsHelper
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def link_to_issue_list_with_filter(text, options={})
|
||||
deliverable_id = options[:deliverable_id] || '*'
|
||||
status_id = options[:status_id] || '*'
|
||||
|
||||
link_to(h(text), {
|
||||
:controller => 'issues',
|
||||
:action => 'index',
|
||||
:project_id => @project,
|
||||
:set_filter => 't',
|
||||
:status_id => status_id,
|
||||
:deliverable_id => deliverable_id
|
||||
})
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -117,13 +117,27 @@
|
||||
<tbody>
|
||||
<% deliverable.issues_by_status.each do |status, issues| %>
|
||||
<tr>
|
||||
<td><%= h(status.name) %></td>
|
||||
<td class="number"><%= h(issues.length) %></td>
|
||||
<td>
|
||||
<%= link_to_issue_list_with_filter(status.name,
|
||||
:deliverable_id => deliverable.id,
|
||||
:status_id => status.id) %>
|
||||
</td>
|
||||
<td class="number">
|
||||
<%= link_to_issue_list_with_filter(issues.length,
|
||||
:deliverable_id => deliverable.id,
|
||||
:status_id => status.id) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<td><strong><%= l(:label_all).capitalize %></strong></td>
|
||||
<td class="number"><%= deliverable.issues.count %></td>
|
||||
<td><strong>
|
||||
<%= link_to_issue_list_with_filter(l(:label_all).capitalize,
|
||||
:deliverable_id => deliverable.id) %>
|
||||
</strong></td>
|
||||
<td class="number">
|
||||
<%= link_to_issue_list_with_filter(deliverable.issues.count,
|
||||
:deliverable_id => deliverable.id) %>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -413,16 +413,16 @@ class ContractsShowTest < ActionController::IntegrationTest
|
||||
visit_contract_page(@contract)
|
||||
assert_select "table#deliverables" do
|
||||
assert_select "tr" do
|
||||
assert_select "td", :text => /#{@status1}/
|
||||
assert_select "td.number", :text => /3/
|
||||
assert_select "td a", :text => /#{@status1}/
|
||||
assert_select "td.number a", :text => /3/
|
||||
end
|
||||
assert_select "tr" do
|
||||
assert_select "td", :text => /#{@status2}/
|
||||
assert_select "td.number", :text => /1/
|
||||
assert_select "td a", :text => /#{@status2}/
|
||||
assert_select "td.number a", :text => /1/
|
||||
end
|
||||
assert_select "tr" do
|
||||
assert_select "td strong", "All"
|
||||
assert_select "td.number", :text => /4/
|
||||
assert_select "td strong a", "All"
|
||||
assert_select "td.number a", :text => /4/
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user