diff --git a/app/assets/javascripts/milestones.js.coffee b/app/assets/javascripts/milestones.js.coffee index 99a52bf4d3fd0114fc350f4fb436167b24e1fa91..78a16e91b46888b8c46e74474246251e8d749361 100644 --- a/app/assets/javascripts/milestones.js.coffee +++ b/app/assets/javascripts/milestones.js.coffee @@ -1,11 +1,4 @@ $ -> - $('.milestone-issue-filter li[data-closed]').addClass('hide') - - $('.milestone-issue-filter ul.nav li a').click -> - $('.milestone-issue-filter li').toggleClass('active') - $('.milestone-issue-filter li[data-closed]').toggleClass('hide') - false - $('.milestone-merge-requests-filter li[data-closed]').addClass('hide') $('.milestone-merge-requests-filter ul.nav li a').click -> diff --git a/app/models/issue.rb b/app/models/issue.rb index 91dd6477b04c02d7747cbc7d6b0140e34d57bebc..ee92d944b0333c47a34f820a9668ed60bcd15f62 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -28,6 +28,8 @@ class Issue < ActiveRecord::Base scope :cared, ->(user) { where(assignee_id: user) } scope :authored, ->(user) { where(author_id: user) } scope :open_for, ->(user) { opened.assigned(user) } + scope :assigned, -> { where("assignee_id IS NOT NULL") } + scope :unassigned, -> { where("assignee_id IS NULL") } state_machine :state, initial: :opened do event :close do diff --git a/app/views/milestones/_issues.html.haml b/app/views/milestones/_issues.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..8c42330a65d01ae398ac56a643811e2dc981d4f4 --- /dev/null +++ b/app/views/milestones/_issues.html.haml @@ -0,0 +1,10 @@ +.span6 + .ui-box.milestone-issue-filter + %h5.title= title + %ul.well-list + - issues.each do |issue| + %li{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] \ No newline at end of file diff --git a/app/views/milestones/show.html.haml b/app/views/milestones/show.html.haml index 034c37852f1bcd4eea3ed7db84438952823c15d6..9f665206acb74bc23baa5dbaa702163b3919255e 100644 --- a/app/views/milestones/show.html.haml +++ b/app/views/milestones/show.html.haml @@ -56,20 +56,11 @@ .row - .span6 - .ui-box.milestone-issue-filter - .title - %ul.nav.nav-pills - %li.active= link_to('Open Issues', '#') - %li=link_to('All Issues', '#') - %ul.well-list - - @issues.each do |issue| - %li{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] + = render(partial: 'issues', locals: {title: 'Unstarted Issues (open and unassigned)', issues: @issues.opened.unassigned}) + + = render(partial: 'issues', locals: {title: 'Ongoing Issues (open and assigned)', issues: @issues.opened.assigned}) +.row .span6 .ui-box.milestone-merge-requests-filter .title @@ -84,6 +75,8 @@ – = link_to_gfm truncate(merge_request.title, length: 60), [@project, merge_request] + = render(:partial => 'issues', locals: {title: 'Completed Issues (closed)', issues: @issues.closed}) + %hr %h6 Participants: %div diff --git a/features/project/issues/milestones.feature b/features/project/issues/milestones.feature index 50c090cc6a02837edaa42ed315c439f8ac12a4ea..2f38acf14d05885a3a66b7fa2bcddd1d4d6815af 100644 --- a/features/project/issues/milestones.feature +++ b/features/project/issues/milestones.feature @@ -22,5 +22,3 @@ Feature: Project Milestones 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 fcd590fcab2a3a7424ac3fc98a65266c2cf01d5f..ba2a0184d7ed24bc1d656c265495d90fd671d4ca 100644 --- a/features/steps/project/project_milestones.rb +++ b/features/steps/project/project_milestones.rb @@ -51,11 +51,5 @@ class ProjectMilestones < Spinach::FeatureSteps Then "I should see 3 issues" do page.should have_selector('.milestone-issue-filter .well-list li', count: 4) - page.should have_selector('.milestone-issue-filter .well-list li.hide', count: 1) - end - - Then "I should see 4 issues" do - page.should have_selector('.milestone-issue-filter .well-list li', count: 4) - page.should_not have_selector('.milestone-issue-filter .well-list li.hide') end end