From 822bfafae2f30d13a3b1bf8f3b31802c31b05072 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Thu, 23 Mar 2017 15:53:51 -0500 Subject: [PATCH 01/16] add basic sidebar functionality to milestones page --- app/assets/javascripts/dispatcher.js | 3 +++ app/helpers/nav_helper.rb | 3 ++- app/views/dashboard/milestones/show.html.haml | 1 + app/views/groups/milestones/show.html.haml | 1 + app/views/projects/milestones/show.html.haml | 4 ++++ app/views/shared/milestones/_sidebar.html.haml | 9 +++++++++ app/views/shared/milestones/_top.html.haml | 3 +++ 7 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 app/views/shared/milestones/_sidebar.html.haml diff --git a/app/assets/javascripts/dispatcher.js b/app/assets/javascripts/dispatcher.js index d1a662459e1..80490052389 100644 --- a/app/assets/javascripts/dispatcher.js +++ b/app/assets/javascripts/dispatcher.js @@ -33,6 +33,8 @@ /* global ProjectShow */ /* global Labels */ /* global Shortcuts */ +/* global Sidebar */ + import Issue from './issue'; import BindInOut from './behaviors/bind_in_out'; @@ -118,6 +120,7 @@ const ShortcutsBlob = require('./shortcuts_blob'); case 'groups:milestones:show': case 'dashboard:milestones:show': new Milestone(); + new Sidebar(); break; case 'dashboard:todos:index': new gl.Todos(); diff --git a/app/helpers/nav_helper.rb b/app/helpers/nav_helper.rb index 991fd949b94..17bfd07e00f 100644 --- a/app/helpers/nav_helper.rb +++ b/app/helpers/nav_helper.rb @@ -6,7 +6,8 @@ module NavHelper current_path?('merge_requests#builds') || current_path?('merge_requests#conflicts') || current_path?('merge_requests#pipelines') || - current_path?('issues#show') + current_path?('issues#show') || + current_path?('milestones#show') if cookies[:collapsed_gutter] == 'true' "page-gutter right-sidebar-collapsed" else diff --git a/app/views/dashboard/milestones/show.html.haml b/app/views/dashboard/milestones/show.html.haml index 60c84a26420..7a65dd4114d 100644 --- a/app/views/dashboard/milestones/show.html.haml +++ b/app/views/dashboard/milestones/show.html.haml @@ -3,3 +3,4 @@ = render 'shared/milestones/top', milestone: @milestone = render 'shared/milestones/summary', milestone: @milestone = render 'shared/milestones/tabs', milestone: @milestone, show_full_project_name: true += render 'shared/milestones/sidebar', milestone: @milestone, affix_offset: 51 diff --git a/app/views/groups/milestones/show.html.haml b/app/views/groups/milestones/show.html.haml index e66a8e0a3b3..ddc1a845e5a 100644 --- a/app/views/groups/milestones/show.html.haml +++ b/app/views/groups/milestones/show.html.haml @@ -6,3 +6,4 @@ = render 'shared/milestones/top', milestone: @milestone, group: @group = render 'shared/milestones/summary', milestone: @milestone = render 'shared/milestones/tabs', milestone: @milestone, show_project_name: true += render 'shared/milestones/sidebar', milestone: @milestone, affix_offset: 102 diff --git a/app/views/projects/milestones/show.html.haml b/app/views/projects/milestones/show.html.haml index d16f49bd33a..2ebd927042e 100644 --- a/app/views/projects/milestones/show.html.haml +++ b/app/views/projects/milestones/show.html.haml @@ -36,6 +36,9 @@ = link_to namespace_project_milestone_path(@project.namespace, @project, @milestone), data: { confirm: 'Are you sure?' }, method: :delete, class: "btn btn-grouped btn-danger" do Delete + %a.btn.btn-default.btn-grouped.pull-right.visible-xs-block.js-sidebar-toggle{ href: "#" } + = icon('angle-double-left') + .detail-page-description.milestone-detail{ class: ('hide-bottom-border' unless @milestone.description.present? ) } %h2.title = markdown_field(@milestone, :title) @@ -55,3 +58,4 @@ = render 'shared/milestones/summary', milestone: @milestone, project: @project = render 'shared/milestones/tabs', milestone: @milestone + = render 'shared/milestones/sidebar', milestone: @milestone, affix_offset: 153 diff --git a/app/views/shared/milestones/_sidebar.html.haml b/app/views/shared/milestones/_sidebar.html.haml new file mode 100644 index 00000000000..f661582e7bf --- /dev/null +++ b/app/views/shared/milestones/_sidebar.html.haml @@ -0,0 +1,9 @@ +- affix_offset = local_assigns.fetch(:affix_offset, "102") + +%aside.right-sidebar.js-right-sidebar{ data: { "offset-top" => affix_offset, "spy" => "affix" }, class: sidebar_gutter_collapsed_class, 'aria-live' => 'polite' } + .issuable-sidebar + .block.issuable-sidebar-header + %span.issuable-header-text.hide-collapsed.pull-left + Milestone #{milestone.try(:to_reference) || milestone.title} + %a.gutter-toggle.pull-right.js-sidebar-toggle{ role: "button", href: "#", "aria-label" => "Toggle sidebar" } + = sidebar_gutter_toggle_icon diff --git a/app/views/shared/milestones/_top.html.haml b/app/views/shared/milestones/_top.html.haml index 497446c1ef3..2562f085338 100644 --- a/app/views/shared/milestones/_top.html.haml +++ b/app/views/shared/milestones/_top.html.haml @@ -3,6 +3,9 @@ - group = local_assigns[:group] .detail-page-header + %a.btn.btn-default.btn-grouped.pull-right.visible-xs-block.js-sidebar-toggle{ href: "#" } + = icon('angle-double-left') + .status-box{ class: "status-box-#{milestone.closed? ? 'closed' : 'open'}" } - if milestone.closed? Closed From 71e798f5d54dc3142605623fdf2bb6b6326827fb Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 24 Mar 2017 11:43:52 -0500 Subject: [PATCH 02/16] prevent formatted milestone date string from having html escaped --- app/helpers/milestones_helper.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/helpers/milestones_helper.rb b/app/helpers/milestones_helper.rb index 5053b937c02..bd3f51fc658 100644 --- a/app/helpers/milestones_helper.rb +++ b/app/helpers/milestones_helper.rb @@ -89,10 +89,12 @@ module MilestonesHelper content = time_ago.gsub(/\d+/) { |match| "#{match}" } content.slice!("about ") content << " remaining" + content.html_safe elsif milestone.start_date && milestone.start_date.past? days = milestone.elapsed_days content = content_tag(:strong, days) content << " #{'day'.pluralize(days)} elapsed" + content.html_safe end end From 92e0bd9b672061cfd3172624db85847993f31beb Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 24 Mar 2017 12:04:46 -0500 Subject: [PATCH 03/16] add milestone reference clipboard button to sidebar --- app/views/shared/milestones/_sidebar.html.haml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/app/views/shared/milestones/_sidebar.html.haml b/app/views/shared/milestones/_sidebar.html.haml index f661582e7bf..d955ef52676 100644 --- a/app/views/shared/milestones/_sidebar.html.haml +++ b/app/views/shared/milestones/_sidebar.html.haml @@ -3,7 +3,20 @@ %aside.right-sidebar.js-right-sidebar{ data: { "offset-top" => affix_offset, "spy" => "affix" }, class: sidebar_gutter_collapsed_class, 'aria-live' => 'polite' } .issuable-sidebar .block.issuable-sidebar-header - %span.issuable-header-text.hide-collapsed.pull-left - Milestone #{milestone.try(:to_reference) || milestone.title} %a.gutter-toggle.pull-right.js-sidebar-toggle{ role: "button", href: "#", "aria-label" => "Toggle sidebar" } = sidebar_gutter_toggle_icon + + %span.issuable-header-text.hide-collapsed + Milestone #{milestone.try(:to_reference) || milestone.title} + + - milestone_ref = milestone.try(:to_reference, full: true) + - if milestone_ref.present? + .block + .sidebar-collapsed-icon.dont-change-state + = clipboard_button(clipboard_text: milestone_ref, title: "Copy reference to clipboard", placement: "left") + .cross-project-reference.hide-collapsed + %span + Reference: + %cite{ title: milestone_ref } + = milestone_ref + = clipboard_button(clipboard_text: milestone_ref, title: "Copy reference to clipboard", placement: "left") From 9023526c053529ea9e5c4898cdc577fe0e547dac Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 24 Mar 2017 12:13:29 -0500 Subject: [PATCH 04/16] move milestone due date info to sidebar --- app/assets/stylesheets/pages/milestone.scss | 4 ---- app/views/projects/milestones/show.html.haml | 2 +- .../shared/milestones/_sidebar.html.haml | 22 +++++++++++++++++++ .../shared/milestones/_summary.html.haml | 4 ---- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/app/assets/stylesheets/pages/milestone.scss b/app/assets/stylesheets/pages/milestone.scss index efbd9365fd9..68a865200a6 100644 --- a/app/assets/stylesheets/pages/milestone.scss +++ b/app/assets/stylesheets/pages/milestone.scss @@ -62,10 +62,6 @@ } } - .remaining-days { - color: $orange-600; - } - .milestone-stats-and-buttons { display: flex; justify-content: flex-start; diff --git a/app/views/projects/milestones/show.html.haml b/app/views/projects/milestones/show.html.haml index 2ebd927042e..7299f6046f4 100644 --- a/app/views/projects/milestones/show.html.haml +++ b/app/views/projects/milestones/show.html.haml @@ -58,4 +58,4 @@ = render 'shared/milestones/summary', milestone: @milestone, project: @project = render 'shared/milestones/tabs', milestone: @milestone - = render 'shared/milestones/sidebar', milestone: @milestone, affix_offset: 153 + = render 'shared/milestones/sidebar', milestone: @milestone, project: @project, affix_offset: 153 diff --git a/app/views/shared/milestones/_sidebar.html.haml b/app/views/shared/milestones/_sidebar.html.haml index d955ef52676..4f95d789942 100644 --- a/app/views/shared/milestones/_sidebar.html.haml +++ b/app/views/shared/milestones/_sidebar.html.haml @@ -1,4 +1,5 @@ - affix_offset = local_assigns.fetch(:affix_offset, "102") +- project = local_assigns[:project] %aside.right-sidebar.js-right-sidebar{ data: { "offset-top" => affix_offset, "spy" => "affix" }, class: sidebar_gutter_collapsed_class, 'aria-live' => 'polite' } .issuable-sidebar @@ -9,6 +10,27 @@ %span.issuable-header-text.hide-collapsed Milestone #{milestone.try(:to_reference) || milestone.title} + - if project + .block.due_date + .sidebar-collapsed-icon + = icon('calendar', 'aria-hidden': 'true') + %span.js-due-date-sidebar-value + = milestone.due_date.try(:to_s, :medium) || 'None' + .title.hide-collapsed + Due date + - if can?(current_user, :admin_milestone, @project) + = link_to 'Edit', edit_namespace_project_milestone_path(@project.namespace, @project, @milestone), class: 'edit-link pull-right' + .value.hide-collapsed + %span.value-content + - if milestone.due_date + %span.bold= milestone.due_date.to_s(:medium) + - else + %span.no-value No due date + - remaining_days = milestone_remaining_days(milestone) + - if remaining_days.present? + = surround '(', ')' do + %span.remaining-days= remaining_days + - milestone_ref = milestone.try(:to_reference, full: true) - if milestone_ref.present? .block diff --git a/app/views/shared/milestones/_summary.html.haml b/app/views/shared/milestones/_summary.html.haml index 78079f633d5..7ee7ce047b9 100644 --- a/app/views/shared/milestones/_summary.html.haml +++ b/app/views/shared/milestones/_summary.html.haml @@ -26,10 +26,6 @@ %span.milestone-stat %strong== #{milestone.percent_complete(current_user)}% complete - - remaining_days = milestone_remaining_days(milestone) - - if remaining_days.present? - %span.milestone-stat - %span.remaining-days= remaining_days .milestone-progress-buttons %span.tab-issues-buttons From 470bba5cb91948abc3e4bce3927c7205ef918b3a Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 24 Mar 2017 13:39:33 -0500 Subject: [PATCH 05/16] move issue and milestone counts to sidebar --- .../shared/milestones/_sidebar.html.haml | 39 +++++++++++++++++++ .../shared/milestones/_summary.html.haml | 17 -------- 2 files changed, 39 insertions(+), 17 deletions(-) diff --git a/app/views/shared/milestones/_sidebar.html.haml b/app/views/shared/milestones/_sidebar.html.haml index 4f95d789942..31b245d2be7 100644 --- a/app/views/shared/milestones/_sidebar.html.haml +++ b/app/views/shared/milestones/_sidebar.html.haml @@ -31,6 +31,45 @@ = surround '(', ')' do %span.remaining-days= remaining_days + - if !project || can?(current_user, :read_issue, project) + .block + .sidebar-collapsed-icon + %strong + = icon('hashtag', 'aria-hidden': 'true') + %span= milestone.issues_visible_to_user(current_user).size + .title.hide-collapsed + Issues + %span.badge= milestone.issues_visible_to_user(current_user).size + - if project && can?(current_user, :create_issue, project) + = link_to new_namespace_project_issue_path(project.namespace, project, issue: { milestone_id: milestone.id }), class: "pull-right", title: "New Issue" do + New issue + .value.hide-collapsed + %span.milestone-stat + Open: + = milestone.issues_visible_to_user(current_user).opened.size + %span.milestone-stat + Closed: + = milestone.issues_visible_to_user(current_user).closed.size + + .block + .sidebar-collapsed-icon + %strong + = icon('exclamation', 'aria-hidden': 'true') + %span= milestone.issues_visible_to_user(current_user).size + .title.hide-collapsed + Merge requests + %span.badge= milestone.merge_requests.size + .value.hide-collapsed + %span.milestone-stat + Open: + = milestone.merge_requests.opened.size + %span.milestone-stat + Closed: + = milestone.merge_requests.closed.size + %span.milestone-stat + Merged: + = milestone.merge_requests.merged.size + - milestone_ref = milestone.try(:to_reference, full: true) - if milestone_ref.present? .block diff --git a/app/views/shared/milestones/_summary.html.haml b/app/views/shared/milestones/_summary.html.haml index 7ee7ce047b9..885c521ca38 100644 --- a/app/views/shared/milestones/_summary.html.haml +++ b/app/views/shared/milestones/_summary.html.haml @@ -6,23 +6,6 @@ .milestone-stats-and-buttons .milestone-stats - - if !project || can?(current_user, :read_issue, project) - %span.milestone-stat.with-drilldown - %strong= milestone.issues_visible_to_user(current_user).size - issues: - %span.milestone-stat - %strong= milestone.issues_visible_to_user(current_user).opened.size - open and - %strong= milestone.issues_visible_to_user(current_user).closed.size - closed - %span.milestone-stat.with-drilldown - %strong= milestone.merge_requests.size - merge requests: - %span.milestone-stat - %strong= milestone.merge_requests.opened.size - open and - %strong= milestone.merge_requests.merged.size - merged %span.milestone-stat %strong== #{milestone.percent_complete(current_user)}% complete From 2bacc040d84085eaeb2c5943c6c2ed8ba54e8dee Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 24 Mar 2017 14:41:08 -0500 Subject: [PATCH 06/16] move links to browse issuables into sidebar --- app/assets/stylesheets/pages/milestone.scss | 20 ------- app/helpers/milestones_helper.rb | 4 +- .../shared/milestones/_sidebar.html.haml | 54 +++++++++++++------ .../shared/milestones/_summary.html.haml | 11 ---- 4 files changed, 41 insertions(+), 48 deletions(-) diff --git a/app/assets/stylesheets/pages/milestone.scss b/app/assets/stylesheets/pages/milestone.scss index 68a865200a6..37b3b3ce17f 100644 --- a/app/assets/stylesheets/pages/milestone.scss +++ b/app/assets/stylesheets/pages/milestone.scss @@ -73,26 +73,6 @@ } } - .milestone-progress-buttons { - order: 1; - margin-top: 10px; - - @media (min-width: $screen-xs-min) { - order: 2; - margin-top: 0; - flex-shrink: 0; - } - - .btn { - float: left; - margin-right: $btn-side-margin; - - &:last-child { - margin-right: 0; - } - } - } - .milestone-stats { order: 2; width: 100%; diff --git a/app/helpers/milestones_helper.rb b/app/helpers/milestones_helper.rb index bd3f51fc658..c9e70faa52e 100644 --- a/app/helpers/milestones_helper.rb +++ b/app/helpers/milestones_helper.rb @@ -19,8 +19,8 @@ module MilestonesHelper end end - def milestones_browse_issuables_path(milestone, type:) - opts = { milestone_title: milestone.title } + def milestones_browse_issuables_path(milestone, state: nil, type:) + opts = { milestone_title: milestone.title, state: state } if @project polymorphic_path([@project.namespace.becomes(Namespace), @project, type], opts) diff --git a/app/views/shared/milestones/_sidebar.html.haml b/app/views/shared/milestones/_sidebar.html.haml index 31b245d2be7..edacae0b4ab 100644 --- a/app/views/shared/milestones/_sidebar.html.haml +++ b/app/views/shared/milestones/_sidebar.html.haml @@ -44,12 +44,22 @@ = link_to new_namespace_project_issue_path(project.namespace, project, issue: { milestone_id: milestone.id }), class: "pull-right", title: "New Issue" do New issue .value.hide-collapsed - %span.milestone-stat - Open: - = milestone.issues_visible_to_user(current_user).opened.size - %span.milestone-stat - Closed: - = milestone.issues_visible_to_user(current_user).closed.size + - if project && can?(current_user, :read_issue, project) + %span.milestone-stat + = link_to milestones_browse_issuables_path(milestone, type: :issues) do + Open: + = milestone.issues_visible_to_user(current_user).opened.size + %span.milestone-stat + = link_to milestones_browse_issuables_path(milestone, type: :issues, state: 'closed') do + Closed: + = milestone.issues_visible_to_user(current_user).closed.size + - else + %span.milestone-stat + Open: + = milestone.issues_visible_to_user(current_user).opened.size + %span.milestone-stat + Closed: + = milestone.issues_visible_to_user(current_user).closed.size .block .sidebar-collapsed-icon @@ -60,15 +70,29 @@ Merge requests %span.badge= milestone.merge_requests.size .value.hide-collapsed - %span.milestone-stat - Open: - = milestone.merge_requests.opened.size - %span.milestone-stat - Closed: - = milestone.merge_requests.closed.size - %span.milestone-stat - Merged: - = milestone.merge_requests.merged.size + - if project && can?(current_user, :read_merge_request, project) + %span.milestone-stat + = link_to milestones_browse_issuables_path(milestone, type: :merge_requests) do + Open: + = milestone.merge_requests.opened.size + %span.milestone-stat + = link_to milestones_browse_issuables_path(milestone, type: :merge_requests, state: 'closed') do + Closed: + = milestone.merge_requests.closed.size + %span.milestone-stat + = link_to milestones_browse_issuables_path(milestone, type: :merge_requests, state: 'merged') do + Merged: + = milestone.merge_requests.merged.size + - else + %span.milestone-stat + Open: + = milestone.merge_requests.opened.size + %span.milestone-stat + Closed: + = milestone.merge_requests.closed.size + %span.milestone-stat + Merged: + = milestone.merge_requests.merged.size - milestone_ref = milestone.try(:to_reference, full: true) - if milestone_ref.present? diff --git a/app/views/shared/milestones/_summary.html.haml b/app/views/shared/milestones/_summary.html.haml index 885c521ca38..9c08dd5f5fe 100644 --- a/app/views/shared/milestones/_summary.html.haml +++ b/app/views/shared/milestones/_summary.html.haml @@ -10,15 +10,4 @@ %strong== #{milestone.percent_complete(current_user)}% complete - .milestone-progress-buttons - %span.tab-issues-buttons - - if project - - if can?(current_user, :create_issue, project) - = link_to new_namespace_project_issue_path(project.namespace, project, issue: { milestone_id: milestone.id }), class: "btn", title: "New Issue" do - New Issue - - if can?(current_user, :read_issue, project) - = link_to 'Browse Issues', milestones_browse_issuables_path(milestone, type: :issues), class: "btn" - %span.tab-merge-requests-buttons.hidden - = link_to 'Browse Merge Requests', milestones_browse_issuables_path(milestone, type: :merge_requests), class: "btn" - = milestone_progress_bar(milestone) From 38c1367335ad3df29d6b82c1f8066f5b1dece69e Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 24 Mar 2017 15:03:06 -0500 Subject: [PATCH 07/16] update styling for milestone sidebar content --- app/assets/stylesheets/pages/milestone.scss | 16 ++++++++++++++++ app/views/shared/milestones/_sidebar.html.haml | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/pages/milestone.scss b/app/assets/stylesheets/pages/milestone.scss index 37b3b3ce17f..86355c72c37 100644 --- a/app/assets/stylesheets/pages/milestone.scss +++ b/app/assets/stylesheets/pages/milestone.scss @@ -52,6 +52,22 @@ } } +.milestone-sidebar { + .remaining-days strong { + font-weight: normal; + } + + .milestone-stat { + float: left; + font-weight: bold; + margin-right: 14px; + } + + .milestone-stat:last-child { + margin-right: 0; + } +} + .milestone-summary { .milestone-stat { white-space: nowrap; diff --git a/app/views/shared/milestones/_sidebar.html.haml b/app/views/shared/milestones/_sidebar.html.haml index edacae0b4ab..7116560897c 100644 --- a/app/views/shared/milestones/_sidebar.html.haml +++ b/app/views/shared/milestones/_sidebar.html.haml @@ -2,7 +2,7 @@ - project = local_assigns[:project] %aside.right-sidebar.js-right-sidebar{ data: { "offset-top" => affix_offset, "spy" => "affix" }, class: sidebar_gutter_collapsed_class, 'aria-live' => 'polite' } - .issuable-sidebar + .issuable-sidebar.milestone-sidebar .block.issuable-sidebar-header %a.gutter-toggle.pull-right.js-sidebar-toggle{ role: "button", href: "#", "aria-label" => "Toggle sidebar" } = sidebar_gutter_toggle_icon From d3de86c6bd53dcda9db871e5ac24436776d56705 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 24 Mar 2017 15:29:36 -0500 Subject: [PATCH 08/16] add separator before milestone reference in collapsed view --- app/assets/stylesheets/pages/milestone.scss | 6 ++++++ app/views/shared/milestones/_sidebar.html.haml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/pages/milestone.scss b/app/assets/stylesheets/pages/milestone.scss index 86355c72c37..ce3adbb9114 100644 --- a/app/assets/stylesheets/pages/milestone.scss +++ b/app/assets/stylesheets/pages/milestone.scss @@ -66,6 +66,12 @@ .milestone-stat:last-child { margin-right: 0; } + + .right-sidebar-collapsed & { + .reference { + border-top: 1px solid $border-gray-normal; + } + } } .milestone-summary { diff --git a/app/views/shared/milestones/_sidebar.html.haml b/app/views/shared/milestones/_sidebar.html.haml index 7116560897c..bb406316662 100644 --- a/app/views/shared/milestones/_sidebar.html.haml +++ b/app/views/shared/milestones/_sidebar.html.haml @@ -96,7 +96,7 @@ - milestone_ref = milestone.try(:to_reference, full: true) - if milestone_ref.present? - .block + .block.reference .sidebar-collapsed-icon.dont-change-state = clipboard_button(clipboard_text: milestone_ref, title: "Copy reference to clipboard", placement: "left") .cross-project-reference.hide-collapsed From 12869a9e8164e1681a856c5a6a86a85e293a9271 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 24 Mar 2017 16:11:15 -0500 Subject: [PATCH 09/16] move progress bar from milestone summary into the sidebar --- app/assets/stylesheets/pages/milestone.scss | 65 ++++++++----------- app/views/dashboard/milestones/show.html.haml | 1 - app/views/groups/milestones/show.html.haml | 1 - app/views/projects/milestones/show.html.haml | 1 - .../shared/milestones/_sidebar.html.haml | 13 +++- .../shared/milestones/_summary.html.haml | 13 ---- 6 files changed, 36 insertions(+), 58 deletions(-) delete mode 100644 app/views/shared/milestones/_summary.html.haml diff --git a/app/assets/stylesheets/pages/milestone.scss b/app/assets/stylesheets/pages/milestone.scss index ce3adbb9114..e700637d4f5 100644 --- a/app/assets/stylesheets/pages/milestone.scss +++ b/app/assets/stylesheets/pages/milestone.scss @@ -53,6 +53,21 @@ } .milestone-sidebar { + .gutter-toggle { + margin-bottom: 10px; + } + + .milestone-progress { + .title { + padding-top: 5px; + } + + .progress { + height: 6px; + margin: 0; + } + } + .remaining-days strong { font-weight: normal; } @@ -67,6 +82,17 @@ margin-right: 0; } + .milestone-progress { + .sidebar-collapsed-icon { + clear: both; + padding: 15px 5px 5px; + + .progress { + margin: 5px 0; + } + } + } + .right-sidebar-collapsed & { .reference { border-top: 1px solid $border-gray-normal; @@ -74,45 +100,6 @@ } } -.milestone-summary { - .milestone-stat { - white-space: nowrap; - margin-right: 10px; - - &.with-drilldown { - margin-right: 2px; - } - } - - .milestone-stats-and-buttons { - display: flex; - justify-content: flex-start; - flex-wrap: wrap; - - @media (min-width: $screen-xs-min) { - justify-content: space-between; - flex-wrap: nowrap; - } - } - - .milestone-stats { - order: 2; - width: 100%; - padding: 7px 0; - flex-shrink: 1; - - @media (min-width: $screen-xs-min) { - // when displayed on one line stats go first, buttons second - order: 1; - } - } - - .progress { - width: 100%; - margin: 15px 0; - } -} - .issues-sortable-list, .merge_requests-sortable-list { .issuable-detail { diff --git a/app/views/dashboard/milestones/show.html.haml b/app/views/dashboard/milestones/show.html.haml index 7a65dd4114d..2129920afd2 100644 --- a/app/views/dashboard/milestones/show.html.haml +++ b/app/views/dashboard/milestones/show.html.haml @@ -1,6 +1,5 @@ - header_title "Milestones", dashboard_milestones_path = render 'shared/milestones/top', milestone: @milestone -= render 'shared/milestones/summary', milestone: @milestone = render 'shared/milestones/tabs', milestone: @milestone, show_full_project_name: true = render 'shared/milestones/sidebar', milestone: @milestone, affix_offset: 51 diff --git a/app/views/groups/milestones/show.html.haml b/app/views/groups/milestones/show.html.haml index ddc1a845e5a..8e83b2002b2 100644 --- a/app/views/groups/milestones/show.html.haml +++ b/app/views/groups/milestones/show.html.haml @@ -4,6 +4,5 @@ = page_specific_javascript_bundle_tag('simulate_drag') if Rails.env.test? = render 'shared/milestones/top', milestone: @milestone, group: @group -= render 'shared/milestones/summary', milestone: @milestone = render 'shared/milestones/tabs', milestone: @milestone, show_project_name: true = render 'shared/milestones/sidebar', milestone: @milestone, affix_offset: 102 diff --git a/app/views/projects/milestones/show.html.haml b/app/views/projects/milestones/show.html.haml index 7299f6046f4..f612b5c7d6b 100644 --- a/app/views/projects/milestones/show.html.haml +++ b/app/views/projects/milestones/show.html.haml @@ -56,6 +56,5 @@ .alert.alert-success.prepend-top-default %span All issues for this milestone are closed. You may close this milestone now. - = render 'shared/milestones/summary', milestone: @milestone, project: @project = render 'shared/milestones/tabs', milestone: @milestone = render 'shared/milestones/sidebar', milestone: @milestone, project: @project, affix_offset: 153 diff --git a/app/views/shared/milestones/_sidebar.html.haml b/app/views/shared/milestones/_sidebar.html.haml index bb406316662..38ff9c7a92d 100644 --- a/app/views/shared/milestones/_sidebar.html.haml +++ b/app/views/shared/milestones/_sidebar.html.haml @@ -3,12 +3,19 @@ %aside.right-sidebar.js-right-sidebar{ data: { "offset-top" => affix_offset, "spy" => "affix" }, class: sidebar_gutter_collapsed_class, 'aria-live' => 'polite' } .issuable-sidebar.milestone-sidebar - .block.issuable-sidebar-header + .block.milestone-progress.issuable-sidebar-header %a.gutter-toggle.pull-right.js-sidebar-toggle{ role: "button", href: "#", "aria-label" => "Toggle sidebar" } = sidebar_gutter_toggle_icon - %span.issuable-header-text.hide-collapsed - Milestone #{milestone.try(:to_reference) || milestone.title} + .sidebar-collapsed-icon + %span== #{milestone.percent_complete(current_user)}% + = milestone_progress_bar(milestone) + .title.hide-collapsed + %strong== #{milestone.percent_complete(current_user)}% + %span.hide-collapsed + complete + .value.hide-collapsed + = milestone_progress_bar(milestone) - if project .block.due_date diff --git a/app/views/shared/milestones/_summary.html.haml b/app/views/shared/milestones/_summary.html.haml deleted file mode 100644 index 9c08dd5f5fe..00000000000 --- a/app/views/shared/milestones/_summary.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -- project = local_assigns[:project] - -.context.prepend-top-default - .milestone-summary - %h4 Progress - - .milestone-stats-and-buttons - .milestone-stats - %span.milestone-stat - %strong== #{milestone.percent_complete(current_user)}% - complete - - = milestone_progress_bar(milestone) From 47af12037b9247a65a50b8ab4e4a5f05c3731dea Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 24 Mar 2017 17:08:41 -0500 Subject: [PATCH 10/16] add CHANGELOG.md entry for !10096 --- changelogs/unreleased/23674-simplify-milestone-summary.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changelogs/unreleased/23674-simplify-milestone-summary.yml diff --git a/changelogs/unreleased/23674-simplify-milestone-summary.yml b/changelogs/unreleased/23674-simplify-milestone-summary.yml new file mode 100644 index 00000000000..7a315c25151 --- /dev/null +++ b/changelogs/unreleased/23674-simplify-milestone-summary.yml @@ -0,0 +1,4 @@ +--- +title: Move milestone summary content into the sidebar +merge_request: 10096 +author: From 5af7dbe37ace8d0a56a5e3df7c3de0e28a9d0859 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 24 Mar 2017 18:27:47 -0500 Subject: [PATCH 11/16] update milestone page tests --- features/steps/group/milestones.rb | 2 +- .../projects/milestones/milestone_spec.rb | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/features/steps/group/milestones.rb b/features/steps/group/milestones.rb index 20204ad8654..9996f3baf0d 100644 --- a/features/steps/group/milestones.rb +++ b/features/steps/group/milestones.rb @@ -36,7 +36,7 @@ class Spinach::Features::GroupMilestones < Spinach::FeatureSteps step 'I should see group milestone with all issues and MRs assigned to that milestone' do expect(page).to have_content('Milestone GL-113') - expect(page).to have_content('3 issues: 3 open and 0 closed') + expect(page).to have_content('Issues 3 Open: 3 Closed: 0') issue = Milestone.find_by(name: 'GL-113').issues.first expect(page).to have_link(issue.title, href: namespace_project_issue_path(issue.project.namespace, issue.project, issue)) end diff --git a/spec/features/projects/milestones/milestone_spec.rb b/spec/features/projects/milestones/milestone_spec.rb index df229d0aa78..dab78fd3571 100644 --- a/spec/features/projects/milestones/milestone_spec.rb +++ b/spec/features/projects/milestones/milestone_spec.rb @@ -23,12 +23,14 @@ feature 'Project milestone', :feature do end it 'shows issues stats' do - expect(page).to have_content 'issues:' + expect(find('.milestone-sidebar')).to have_content 'Issues 0' end - it 'shows Browse Issues button' do - within('#content-body') do - expect(page).to have_link 'Browse Issues' + it 'shows link to browse and add issues' do + within('.milestone-sidebar') do + expect(page).to have_link 'New issue' + expect(page).to have_link 'Open: 0' + expect(page).to have_link 'Closed: 0' end end end @@ -48,12 +50,12 @@ feature 'Project milestone', :feature do end it 'hides issues stats' do - expect(page).to have_no_content 'issues:' + expect(find('.milestone-sidebar')).not_to have_content 'Issues 0' end - it 'hides Browse Issues button' do - within('#content-body') do - expect(page).not_to have_link 'Browse Issues' + it 'hides new issue button' do + within('.milestone-sidebar') do + expect(page).not_to have_link 'New issue' end end From d79bdfcf646ed1285f8ca2465d6e4abb7ad99428 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Mon, 27 Mar 2017 12:06:48 -0500 Subject: [PATCH 12/16] enable links to browse milsetone issuables in dashboard and group view --- app/views/shared/milestones/_sidebar.html.haml | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/app/views/shared/milestones/_sidebar.html.haml b/app/views/shared/milestones/_sidebar.html.haml index 38ff9c7a92d..571bff67553 100644 --- a/app/views/shared/milestones/_sidebar.html.haml +++ b/app/views/shared/milestones/_sidebar.html.haml @@ -51,20 +51,12 @@ = link_to new_namespace_project_issue_path(project.namespace, project, issue: { milestone_id: milestone.id }), class: "pull-right", title: "New Issue" do New issue .value.hide-collapsed - - if project && can?(current_user, :read_issue, project) - %span.milestone-stat - = link_to milestones_browse_issuables_path(milestone, type: :issues) do - Open: - = milestone.issues_visible_to_user(current_user).opened.size - %span.milestone-stat - = link_to milestones_browse_issuables_path(milestone, type: :issues, state: 'closed') do - Closed: - = milestone.issues_visible_to_user(current_user).closed.size - - else - %span.milestone-stat + %span.milestone-stat + = link_to milestones_browse_issuables_path(milestone, type: :issues) do Open: = milestone.issues_visible_to_user(current_user).opened.size - %span.milestone-stat + %span.milestone-stat + = link_to milestones_browse_issuables_path(milestone, type: :issues, state: 'closed') do Closed: = milestone.issues_visible_to_user(current_user).closed.size @@ -77,7 +69,7 @@ Merge requests %span.badge= milestone.merge_requests.size .value.hide-collapsed - - if project && can?(current_user, :read_merge_request, project) + - if !project || can?(current_user, :read_merge_request, project) %span.milestone-stat = link_to milestones_browse_issuables_path(milestone, type: :merge_requests) do Open: From 8dafec40cf7efb1b46bb7b4d7501cfb74da53ba4 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Mon, 27 Mar 2017 12:10:30 -0500 Subject: [PATCH 13/16] use smaller font-weight in sidebar to match other sidebar content in gitlab --- app/assets/stylesheets/pages/milestone.scss | 1 - app/views/shared/milestones/_sidebar.html.haml | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/assets/stylesheets/pages/milestone.scss b/app/assets/stylesheets/pages/milestone.scss index e700637d4f5..a1c6179840a 100644 --- a/app/assets/stylesheets/pages/milestone.scss +++ b/app/assets/stylesheets/pages/milestone.scss @@ -74,7 +74,6 @@ .milestone-stat { float: left; - font-weight: bold; margin-right: 14px; } diff --git a/app/views/shared/milestones/_sidebar.html.haml b/app/views/shared/milestones/_sidebar.html.haml index 571bff67553..7c45fdf0fab 100644 --- a/app/views/shared/milestones/_sidebar.html.haml +++ b/app/views/shared/milestones/_sidebar.html.haml @@ -11,7 +11,7 @@ %span== #{milestone.percent_complete(current_user)}% = milestone_progress_bar(milestone) .title.hide-collapsed - %strong== #{milestone.percent_complete(current_user)}% + %strong.bold== #{milestone.percent_complete(current_user)}% %span.hide-collapsed complete .value.hide-collapsed @@ -50,7 +50,7 @@ - if project && can?(current_user, :create_issue, project) = link_to new_namespace_project_issue_path(project.namespace, project, issue: { milestone_id: milestone.id }), class: "pull-right", title: "New Issue" do New issue - .value.hide-collapsed + .value.hide-collapsed.bold %span.milestone-stat = link_to milestones_browse_issuables_path(milestone, type: :issues) do Open: @@ -68,7 +68,7 @@ .title.hide-collapsed Merge requests %span.badge= milestone.merge_requests.size - .value.hide-collapsed + .value.hide-collapsed.bold - if !project || can?(current_user, :read_merge_request, project) %span.milestone-stat = link_to milestones_browse_issuables_path(milestone, type: :merge_requests) do From 3b513675d0bfdf10725d5eed421d39ca66aebad5 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Mon, 27 Mar 2017 12:20:07 -0500 Subject: [PATCH 14/16] add start date to sidebar and display dates on group and dashboard views when possible --- .../shared/milestones/_sidebar.html.haml | 55 ++++++++++++------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/app/views/shared/milestones/_sidebar.html.haml b/app/views/shared/milestones/_sidebar.html.haml index 7c45fdf0fab..2de7308ebc2 100644 --- a/app/views/shared/milestones/_sidebar.html.haml +++ b/app/views/shared/milestones/_sidebar.html.haml @@ -17,26 +17,41 @@ .value.hide-collapsed = milestone_progress_bar(milestone) - - if project - .block.due_date - .sidebar-collapsed-icon - = icon('calendar', 'aria-hidden': 'true') - %span.js-due-date-sidebar-value - = milestone.due_date.try(:to_s, :medium) || 'None' - .title.hide-collapsed - Due date - - if can?(current_user, :admin_milestone, @project) - = link_to 'Edit', edit_namespace_project_milestone_path(@project.namespace, @project, @milestone), class: 'edit-link pull-right' - .value.hide-collapsed - %span.value-content - - if milestone.due_date - %span.bold= milestone.due_date.to_s(:medium) - - else - %span.no-value No due date - - remaining_days = milestone_remaining_days(milestone) - - if remaining_days.present? - = surround '(', ')' do - %span.remaining-days= remaining_days + .block.start_date + .sidebar-collapsed-icon + = icon('calendar', 'aria-hidden': 'true') + %span.js-due-date-sidebar-value + = milestone.start_date.try(:to_s, :medium) || 'None' + .title.hide-collapsed + Start date + - if @project && can?(current_user, :admin_milestone, @project) + = link_to 'Edit', edit_namespace_project_milestone_path(@project.namespace, @project, @milestone), class: 'edit-link pull-right' + .value.hide-collapsed + %span.value-content + - if milestone.start_date + %span.bold= milestone.start_date.to_s(:medium) + - else + %span.no-value No start date + + .block.due_date + .sidebar-collapsed-icon + = icon('calendar', 'aria-hidden': 'true') + %span.js-due-date-sidebar-value + = milestone.due_date.try(:to_s, :medium) || 'None' + .title.hide-collapsed + Due date + - if @project && can?(current_user, :admin_milestone, @project) + = link_to 'Edit', edit_namespace_project_milestone_path(@project.namespace, @project, @milestone), class: 'edit-link pull-right' + .value.hide-collapsed + %span.value-content + - if milestone.due_date + %span.bold= milestone.due_date.to_s(:medium) + - else + %span.no-value No due date + - remaining_days = milestone_remaining_days(milestone) + - if remaining_days.present? + = surround '(', ')' do + %span.remaining-days= remaining_days - if !project || can?(current_user, :read_issue, project) .block From 3671437769e41b2f1a6260c66a6cbcea990598c2 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Mon, 27 Mar 2017 13:14:27 -0500 Subject: [PATCH 15/16] combine milestone start and end dates in collapsed sidebar --- app/assets/stylesheets/pages/milestone.scss | 12 ++++++++ .../shared/milestones/_sidebar.html.haml | 28 +++++++++++++------ 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/app/assets/stylesheets/pages/milestone.scss b/app/assets/stylesheets/pages/milestone.scss index a1c6179840a..335e587b8f4 100644 --- a/app/assets/stylesheets/pages/milestone.scss +++ b/app/assets/stylesheets/pages/milestone.scss @@ -68,6 +68,18 @@ } } + .collapsed-milestone-date { + font-size: 12px; + } + + .milestone-date { + display: block; + } + + .date-separator { + line-height: 5px; + } + .remaining-days strong { font-weight: normal; } diff --git a/app/views/shared/milestones/_sidebar.html.haml b/app/views/shared/milestones/_sidebar.html.haml index 2de7308ebc2..6430c5f6352 100644 --- a/app/views/shared/milestones/_sidebar.html.haml +++ b/app/views/shared/milestones/_sidebar.html.haml @@ -17,16 +17,12 @@ .value.hide-collapsed = milestone_progress_bar(milestone) - .block.start_date - .sidebar-collapsed-icon - = icon('calendar', 'aria-hidden': 'true') - %span.js-due-date-sidebar-value - = milestone.start_date.try(:to_s, :medium) || 'None' - .title.hide-collapsed + .block.start_date.hide-collapsed + .title Start date - if @project && can?(current_user, :admin_milestone, @project) = link_to 'Edit', edit_namespace_project_milestone_path(@project.namespace, @project, @milestone), class: 'edit-link pull-right' - .value.hide-collapsed + .value %span.value-content - if milestone.start_date %span.bold= milestone.start_date.to_s(:medium) @@ -36,8 +32,22 @@ .block.due_date .sidebar-collapsed-icon = icon('calendar', 'aria-hidden': 'true') - %span.js-due-date-sidebar-value - = milestone.due_date.try(:to_s, :medium) || 'None' + %span.collapsed-milestone-date + - if milestone.start_date && milestone.due_date + - if milestone.start_date.year == milestone.due_date.year + .milestone-date= milestone.start_date.strftime('%b %-d') + - else + .milestone-date= milestone.start_date.strftime('%b %-d %Y') + .date-separator - + .due_date= milestone.due_date.strftime('%b %-d %Y') + - elsif milestone.start_date + From + .milestone-date= milestone.start_date.strftime('%b %-d %Y') + - elsif milestone.due_date + Until + .milestone-date= milestone.due_date.strftime('%b %-d %Y') + - else + None .title.hide-collapsed Due date - if @project && can?(current_user, :admin_milestone, @project) From 48a30a7ab38932d14dfd4136960983efe76fa630 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Wed, 29 Mar 2017 15:26:24 -0500 Subject: [PATCH 16/16] prever #count over #size when calculating issue/mr totals --- .../shared/milestones/_sidebar.html.haml | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app/views/shared/milestones/_sidebar.html.haml b/app/views/shared/milestones/_sidebar.html.haml index 6430c5f6352..2810f1377b2 100644 --- a/app/views/shared/milestones/_sidebar.html.haml +++ b/app/views/shared/milestones/_sidebar.html.haml @@ -68,10 +68,10 @@ .sidebar-collapsed-icon %strong = icon('hashtag', 'aria-hidden': 'true') - %span= milestone.issues_visible_to_user(current_user).size + %span= milestone.issues_visible_to_user(current_user).count .title.hide-collapsed Issues - %span.badge= milestone.issues_visible_to_user(current_user).size + %span.badge= milestone.issues_visible_to_user(current_user).count - if project && can?(current_user, :create_issue, project) = link_to new_namespace_project_issue_path(project.namespace, project, issue: { milestone_id: milestone.id }), class: "pull-right", title: "New Issue" do New issue @@ -79,44 +79,44 @@ %span.milestone-stat = link_to milestones_browse_issuables_path(milestone, type: :issues) do Open: - = milestone.issues_visible_to_user(current_user).opened.size + = milestone.issues_visible_to_user(current_user).opened.count %span.milestone-stat = link_to milestones_browse_issuables_path(milestone, type: :issues, state: 'closed') do Closed: - = milestone.issues_visible_to_user(current_user).closed.size + = milestone.issues_visible_to_user(current_user).closed.count .block .sidebar-collapsed-icon %strong = icon('exclamation', 'aria-hidden': 'true') - %span= milestone.issues_visible_to_user(current_user).size + %span= milestone.issues_visible_to_user(current_user).count .title.hide-collapsed Merge requests - %span.badge= milestone.merge_requests.size + %span.badge= milestone.merge_requests.count .value.hide-collapsed.bold - if !project || can?(current_user, :read_merge_request, project) %span.milestone-stat = link_to milestones_browse_issuables_path(milestone, type: :merge_requests) do Open: - = milestone.merge_requests.opened.size + = milestone.merge_requests.opened.count %span.milestone-stat = link_to milestones_browse_issuables_path(milestone, type: :merge_requests, state: 'closed') do Closed: - = milestone.merge_requests.closed.size + = milestone.merge_requests.closed.count %span.milestone-stat = link_to milestones_browse_issuables_path(milestone, type: :merge_requests, state: 'merged') do Merged: - = milestone.merge_requests.merged.size + = milestone.merge_requests.merged.count - else %span.milestone-stat Open: - = milestone.merge_requests.opened.size + = milestone.merge_requests.opened.count %span.milestone-stat Closed: - = milestone.merge_requests.closed.size + = milestone.merge_requests.closed.count %span.milestone-stat Merged: - = milestone.merge_requests.merged.size + = milestone.merge_requests.merged.count - milestone_ref = milestone.try(:to_reference, full: true) - if milestone_ref.present?