Commit 12434cb7fda93538003ae6897ce12f49db4b7a9f
Exists in
master
and in
4 other branches
Merge pull request #1672 from tsigo/milestone_closed_issues
Milestone "All Issues" filter
Showing
6 changed files
with
49 additions
and
5 deletions
Show diff stats
| @@ -0,0 +1,7 @@ | @@ -0,0 +1,7 @@ | ||
| 1 | +$ -> | ||
| 2 | + $('.milestone-issue-filter tr[data-closed]').addClass('hide') | ||
| 3 | + | ||
| 4 | + $('.milestone-issue-filter ul.nav li a').click -> | ||
| 5 | + $('.milestone-issue-filter li').toggleClass('active') | ||
| 6 | + $('.milestone-issue-filter tr[data-closed]').toggleClass('hide') | ||
| 7 | + false |
app/assets/stylesheets/gitlab_bootstrap/tables.scss
| @@ -11,6 +11,11 @@ table { | @@ -11,6 +11,11 @@ table { | ||
| 11 | border-bottom: 1px solid #bbb; | 11 | border-bottom: 1px solid #bbb; |
| 12 | text-shadow: 0 1px 1px #fff; | 12 | text-shadow: 0 1px 1px #fff; |
| 13 | @include bg-dark-gray-gradient; | 13 | @include bg-dark-gray-gradient; |
| 14 | + | ||
| 15 | + ul.nav { | ||
| 16 | + text-shadow: none; | ||
| 17 | + margin: 0; | ||
| 18 | + } | ||
| 14 | } | 19 | } |
| 15 | 20 | ||
| 16 | th, td { | 21 | th, td { |
app/controllers/milestones_controller.rb
| @@ -30,7 +30,7 @@ class MilestonesController < ProjectResourceController | @@ -30,7 +30,7 @@ class MilestonesController < ProjectResourceController | ||
| 30 | end | 30 | end |
| 31 | 31 | ||
| 32 | def show | 32 | def show |
| 33 | - @issues = @milestone.issues.opened.page(params[:page]).per(40) | 33 | + @issues = @milestone.issues |
| 34 | @users = @milestone.participants | 34 | @users = @milestone.participants |
| 35 | 35 | ||
| 36 | respond_to do |format| | 36 | respond_to do |format| |
app/views/milestones/show.html.haml
| @@ -45,18 +45,20 @@ | @@ -45,18 +45,20 @@ | ||
| 45 | 45 | ||
| 46 | .row | 46 | .row |
| 47 | .span6 | 47 | .span6 |
| 48 | - %table | 48 | + %table.milestone-issue-filter |
| 49 | %thead | 49 | %thead |
| 50 | - %th Open Issues | 50 | + %th |
| 51 | + %ul.nav.nav-pills | ||
| 52 | + %li.active= link_to('Open Issues', '#') | ||
| 53 | + %li=link_to('All Issues', '#') | ||
| 51 | - @issues.each do |issue| | 54 | - @issues.each do |issue| |
| 52 | - %tr | 55 | + %tr{data: {closed: issue.closed}} |
| 53 | %td | 56 | %td |
| 54 | = link_to [@project, issue] do | 57 | = link_to [@project, issue] do |
| 55 | %span.badge.badge-info ##{issue.id} | 58 | %span.badge.badge-info ##{issue.id} |
| 56 | – | 59 | – |
| 57 | = link_to_gfm truncate(issue.title, length: 60), [@project, issue] | 60 | = link_to_gfm truncate(issue.title, length: 60), [@project, issue] |
| 58 | %br | 61 | %br |
| 59 | - = paginate @issues, theme: "gitlab" | ||
| 60 | 62 | ||
| 61 | .span6 | 63 | .span6 |
| 62 | %table | 64 | %table |
features/project/issues/milestones.feature
| @@ -16,3 +16,11 @@ Feature: Project Milestones | @@ -16,3 +16,11 @@ Feature: Project Milestones | ||
| 16 | Given I click link "New Milestone" | 16 | Given I click link "New Milestone" |
| 17 | And I submit new milestone "v2.3" | 17 | And I submit new milestone "v2.3" |
| 18 | Then I should see milestone "v2.3" | 18 | Then I should see milestone "v2.3" |
| 19 | + | ||
| 20 | + @javascript | ||
| 21 | + Scenario: Listing closed issues | ||
| 22 | + Given the milestone has open and closed issues | ||
| 23 | + And I click link "v2.2" | ||
| 24 | + Then I should see 3 issues | ||
| 25 | + When I click link "All Issues" | ||
| 26 | + Then I should see 4 issues |
features/steps/project/project_milestones.rb
| @@ -36,4 +36,26 @@ class ProjectMilestones < Spinach::FeatureSteps | @@ -36,4 +36,26 @@ class ProjectMilestones < Spinach::FeatureSteps | ||
| 36 | 36 | ||
| 37 | 3.times { Factory :issue, :project => project, :milestone => milestone } | 37 | 3.times { Factory :issue, :project => project, :milestone => milestone } |
| 38 | end | 38 | end |
| 39 | + | ||
| 40 | + Given 'the milestone has open and closed issues' do | ||
| 41 | + project = Project.find_by_name("Shop") | ||
| 42 | + milestone = project.milestones.find_by_title('v2.2') | ||
| 43 | + | ||
| 44 | + # 3 Open issues created above; create one closed issue | ||
| 45 | + create(:closed_issue, project: project, milestone: milestone) | ||
| 46 | + end | ||
| 47 | + | ||
| 48 | + When 'I click link "All Issues"' do | ||
| 49 | + click_link 'All Issues' | ||
| 50 | + end | ||
| 51 | + | ||
| 52 | + Then "I should see 3 issues" do | ||
| 53 | + page.should have_selector('.milestone-issue-filter tbody tr', count: 4) | ||
| 54 | + page.should have_selector('.milestone-issue-filter tbody tr.hide', count: 1) | ||
| 55 | + end | ||
| 56 | + | ||
| 57 | + Then "I should see 4 issues" do | ||
| 58 | + page.should have_selector('.milestone-issue-filter tbody tr', count: 4) | ||
| 59 | + page.should_not have_selector('.milestone-issue-filter tbody tr.hide') | ||
| 60 | + end | ||
| 39 | end | 61 | end |