Merge pull request #1672 from tsigo/milestone_closed_issues

Milestone "All Issues" filter
This commit is contained in:
Valeriy Sizov 2012-10-11 03:21:08 -07:00
commit 12434cb7fd
6 changed files with 49 additions and 5 deletions

View file

@ -0,0 +1,7 @@
$ ->
$('.milestone-issue-filter tr[data-closed]').addClass('hide')
$('.milestone-issue-filter ul.nav li a').click ->
$('.milestone-issue-filter li').toggleClass('active')
$('.milestone-issue-filter tr[data-closed]').toggleClass('hide')
false

View file

@ -11,6 +11,11 @@ table {
border-bottom: 1px solid #bbb; border-bottom: 1px solid #bbb;
text-shadow: 0 1px 1px #fff; text-shadow: 0 1px 1px #fff;
@include bg-dark-gray-gradient; @include bg-dark-gray-gradient;
ul.nav {
text-shadow: none;
margin: 0;
}
} }
th, td { th, td {

View file

@ -30,7 +30,7 @@ class MilestonesController < ProjectResourceController
end end
def show def show
@issues = @milestone.issues.opened.page(params[:page]).per(40) @issues = @milestone.issues
@users = @milestone.participants @users = @milestone.participants
respond_to do |format| respond_to do |format|

View file

@ -45,18 +45,20 @@
.row .row
.span6 .span6
%table %table.milestone-issue-filter
%thead %thead
%th Open Issues %th
%ul.nav.nav-pills
%li.active= link_to('Open Issues', '#')
%li=link_to('All Issues', '#')
- @issues.each do |issue| - @issues.each do |issue|
%tr %tr{data: {closed: issue.closed}}
%td %td
= link_to [@project, issue] do = link_to [@project, issue] do
%span.badge.badge-info ##{issue.id} %span.badge.badge-info ##{issue.id}
&ndash; &ndash;
= link_to_gfm truncate(issue.title, length: 60), [@project, issue] = link_to_gfm truncate(issue.title, length: 60), [@project, issue]
%br %br
= paginate @issues, theme: "gitlab"
.span6 .span6
%table %table

View file

@ -16,3 +16,11 @@ Feature: Project Milestones
Given I click link "New Milestone" Given I click link "New Milestone"
And I submit new milestone "v2.3" And I submit new milestone "v2.3"
Then I should see milestone "v2.3" Then I should see milestone "v2.3"
@javascript
Scenario: Listing closed issues
Given the milestone has open and closed issues
And I click link "v2.2"
Then I should see 3 issues
When I click link "All Issues"
Then I should see 4 issues

View file

@ -36,4 +36,26 @@ class ProjectMilestones < Spinach::FeatureSteps
3.times { Factory :issue, :project => project, :milestone => milestone } 3.times { Factory :issue, :project => project, :milestone => milestone }
end end
Given 'the milestone has open and closed issues' do
project = Project.find_by_name("Shop")
milestone = project.milestones.find_by_title('v2.2')
# 3 Open issues created above; create one closed issue
create(:closed_issue, project: project, milestone: milestone)
end
When 'I click link "All Issues"' do
click_link 'All Issues'
end
Then "I should see 3 issues" do
page.should have_selector('.milestone-issue-filter tbody tr', count: 4)
page.should have_selector('.milestone-issue-filter tbody tr.hide', count: 1)
end
Then "I should see 4 issues" do
page.should have_selector('.milestone-issue-filter tbody tr', count: 4)
page.should_not have_selector('.milestone-issue-filter tbody tr.hide')
end
end end