From 642f9f4a1cd66152846d0bc61fba2efd550edd33 Mon Sep 17 00:00:00 2001 From: Sytse Sijbrandij <sytse@gitlab.com> Date: Mon, 10 Jun 2013 17:24:49 +0000 Subject: [PATCH] Scrum view style milestone view. --- app/assets/javascripts/milestones.js.coffee | 7 ------- app/models/issue.rb | 2 ++ app/views/milestones/_issues.html.haml | 12 ++++++++++++ app/views/milestones/show.html.haml | 19 ++++++------------- 4 files changed, 20 insertions(+), 20 deletions(-) create mode 100644 app/views/milestones/_issues.html.haml diff --git a/app/assets/javascripts/milestones.js.coffee b/app/assets/javascripts/milestones.js.coffee index 99a52bf4d3..78a16e91b4 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 91dd6477b0..6ad11e8f7b 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 0000000000..bd4fef1655 --- /dev/null +++ b/app/views/milestones/_issues.html.haml @@ -0,0 +1,12 @@ +.span6 + .ui-box.milestone-issue-filter + .title + %ul.nav.nav-pills + %li=issues.first + %ul.well-list + - issues.second.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 034c37852f..fa13f556e6 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', :object => ['Unstarted Issues (open and unassigned)', @issues.opened.unassigned]) + + =render(:partial => 'issues', :object => ['Ongoing Issues (open and assigned) ', @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', :object => ['Completed Issues (closed)', @issues.closed]) + %hr %h6 Participants: %div -- 2.30.9