summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValeriy Sizov <vsv2711@gmail.com>2012-10-11 03:21:08 -0700
committerValeriy Sizov <vsv2711@gmail.com>2012-10-11 03:21:08 -0700
commit12434cb7fda93538003ae6897ce12f49db4b7a9f (patch)
tree7782ac60bb7a9401c622c7d994ecf3ef165b3643
parent2b7fd29b1abb3ab6ca5ece7fe2b093f6672796d6 (diff)
parentbf1554f8c49d8243abadaf0078fbecf3ebdfaf93 (diff)
downloadgitlab-ce-12434cb7fda93538003ae6897ce12f49db4b7a9f.tar.gz
Merge pull request #1672 from tsigo/milestone_closed_issues
Milestone "All Issues" filter
-rw-r--r--app/assets/javascripts/milestones.js.coffee7
-rw-r--r--app/assets/stylesheets/gitlab_bootstrap/tables.scss5
-rw-r--r--app/controllers/milestones_controller.rb2
-rw-r--r--app/views/milestones/show.html.haml10
-rw-r--r--features/project/issues/milestones.feature8
-rw-r--r--features/steps/project/project_milestones.rb22
6 files changed, 49 insertions, 5 deletions
diff --git a/app/assets/javascripts/milestones.js.coffee b/app/assets/javascripts/milestones.js.coffee
new file mode 100644
index 00000000000..13aba860932
--- /dev/null
+++ b/app/assets/javascripts/milestones.js.coffee
@@ -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
diff --git a/app/assets/stylesheets/gitlab_bootstrap/tables.scss b/app/assets/stylesheets/gitlab_bootstrap/tables.scss
index 29293867ef7..b9220792b36 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 f8fe987c437..fa202cf4677 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 d3b1c092192..c113c81f33c 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= link_to('Open Issues', '#')
+ %li=link_to('All Issues', '#')
- @issues.each do |issue|
- %tr
+ %tr{data: {closed: issue.closed}}
%td
= link_to [@project, issue] do
%span.badge.badge-info ##{issue.id}
&ndash;
= link_to_gfm truncate(issue.title, length: 60), [@project, issue]
%br
- = paginate @issues, theme: "gitlab"
.span6
%table
diff --git a/features/project/issues/milestones.feature b/features/project/issues/milestones.feature
index a57f67d6815..50c090cc6a0 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 83ed6859f1b..4d689c95d25 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