From ace816354fb098118539640b5d9af392da349396 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Tue, 4 Sep 2012 04:13:56 -0400 Subject: [PATCH 1/4] Add toggle to show closed issues on Milestones#show Progress on #1167 --- app/assets/javascripts/milestones.js.coffee | 7 +++++++ app/assets/stylesheets/gitlab_bootstrap/tables.scss | 5 +++++ app/controllers/milestones_controller.rb | 2 +- app/views/milestones/show.html.haml | 10 ++++++---- 4 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 app/assets/javascripts/milestones.js.coffee diff --git a/app/assets/javascripts/milestones.js.coffee b/app/assets/javascripts/milestones.js.coffee new file mode 100644 index 00000000..f24682bf --- /dev/null +++ b/app/assets/javascripts/milestones.js.coffee @@ -0,0 +1,7 @@ +$ -> + $('.milestone-issue-filter td[data-closed]').addClass('hide') + + $('.milestone-issue-filter ul.nav li a').click -> + $('.milestone-issue-filter li').toggleClass('active') + $('.milestone-issue-filter td[data-closed]').toggleClass('hide') + false diff --git a/app/assets/stylesheets/gitlab_bootstrap/tables.scss b/app/assets/stylesheets/gitlab_bootstrap/tables.scss index 29293867..b9220792 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/tables.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/tables.scss @@ -11,6 +11,11 @@ table { border-bottom: 1px solid #bbb; text-shadow: 0 1px 1px #fff; @include bg-dark-gray-gradient; + + ul.nav { + text-shadow: none; + margin: 0; + } } th, td { diff --git a/app/controllers/milestones_controller.rb b/app/controllers/milestones_controller.rb index f8fe987c..fa202cf4 100644 --- a/app/controllers/milestones_controller.rb +++ b/app/controllers/milestones_controller.rb @@ -30,7 +30,7 @@ class MilestonesController < ProjectResourceController end def show - @issues = @milestone.issues.opened.page(params[:page]).per(40) + @issues = @milestone.issues @users = @milestone.participants respond_to do |format| diff --git a/app/views/milestones/show.html.haml b/app/views/milestones/show.html.haml index d3b1c092..e2555610 100644 --- a/app/views/milestones/show.html.haml +++ b/app/views/milestones/show.html.haml @@ -45,18 +45,20 @@ .row .span6 - %table + %table.milestone-issue-filter %thead - %th Open Issues + %th + %ul.nav.nav-pills + %li.active.open= link_to('Open Issues', '#') + %li.all=link_to('All Issues', '#') - @issues.each do |issue| %tr - %td + %td{data: {closed: issue.closed}} = link_to [@project, issue] do %span.badge.badge-info ##{issue.id} – = link_to_gfm truncate(issue.title, length: 60), [@project, issue] %br - = paginate @issues, theme: "gitlab" .span6 %table From ce6e5f34d59bf6925170584a6579fb4478cd6e50 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Tue, 4 Sep 2012 04:18:30 -0400 Subject: [PATCH 2/4] Remove unused li classes from milestone issue filter --- app/views/milestones/show.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/milestones/show.html.haml b/app/views/milestones/show.html.haml index e2555610..cbc69fb7 100644 --- a/app/views/milestones/show.html.haml +++ b/app/views/milestones/show.html.haml @@ -49,8 +49,8 @@ %thead %th %ul.nav.nav-pills - %li.active.open= link_to('Open Issues', '#') - %li.all=link_to('All Issues', '#') + %li.active= link_to('Open Issues', '#') + %li=link_to('All Issues', '#') - @issues.each do |issue| %tr %td{data: {closed: issue.closed}} From 7d145adf35b53fae3a512d433f23ee911b4f5d39 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Wed, 10 Oct 2012 13:06:34 -0400 Subject: [PATCH 3/4] Move 'closed' attribute to the row instead of the cell --- app/assets/javascripts/milestones.js.coffee | 4 ++-- app/views/milestones/show.html.haml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/milestones.js.coffee b/app/assets/javascripts/milestones.js.coffee index f24682bf..13aba860 100644 --- a/app/assets/javascripts/milestones.js.coffee +++ b/app/assets/javascripts/milestones.js.coffee @@ -1,7 +1,7 @@ $ -> - $('.milestone-issue-filter td[data-closed]').addClass('hide') + $('.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 td[data-closed]').toggleClass('hide') + $('.milestone-issue-filter tr[data-closed]').toggleClass('hide') false diff --git a/app/views/milestones/show.html.haml b/app/views/milestones/show.html.haml index cbc69fb7..c113c81f 100644 --- a/app/views/milestones/show.html.haml +++ b/app/views/milestones/show.html.haml @@ -52,8 +52,8 @@ %li.active= link_to('Open Issues', '#') %li=link_to('All Issues', '#') - @issues.each do |issue| - %tr - %td{data: {closed: issue.closed}} + %tr{data: {closed: issue.closed}} + %td = link_to [@project, issue] do %span.badge.badge-info ##{issue.id} – From bf1554f8c49d8243abadaf0078fbecf3ebdfaf93 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Wed, 10 Oct 2012 13:06:54 -0400 Subject: [PATCH 4/4] Add Feature for milestone issue filter Closes #1167 --- features/project/issues/milestones.feature | 8 +++++++ features/steps/project/project_milestones.rb | 22 ++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/features/project/issues/milestones.feature b/features/project/issues/milestones.feature index a57f67d6..50c090cc 100644 --- a/features/project/issues/milestones.feature +++ b/features/project/issues/milestones.feature @@ -16,3 +16,11 @@ Feature: Project Milestones Given I click link "New Milestone" And I submit new 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 diff --git a/features/steps/project/project_milestones.rb b/features/steps/project/project_milestones.rb index 83ed6859..4d689c95 100644 --- a/features/steps/project/project_milestones.rb +++ b/features/steps/project/project_milestones.rb @@ -36,4 +36,26 @@ class ProjectMilestones < Spinach::FeatureSteps 3.times { Factory :issue, :project => project, :milestone => milestone } 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