Commit 08efe074 authored by Fatih Acet's avatar Fatih Acet

Merge branch '39543-milestone-page-list-redesign' into 'master'

Resolve "Milestone page list redesign"

Closes #39543

See merge request gitlab-org/gitlab-ce!19832
parents 0c50c619 fbcb55c6
...@@ -262,12 +262,7 @@ li.note { ...@@ -262,12 +262,7 @@ li.note {
} }
.milestone { .milestone {
&.milestone-closed {
background: $gray-light;
}
.progress { .progress {
margin-bottom: 0;
margin-top: 4px; margin-top: 4px;
box-shadow: none; box-shadow: none;
background-color: $border-gray-light; background-color: $border-gray-light;
......
...@@ -45,4 +45,9 @@ ...@@ -45,4 +45,9 @@
&.status-box-upcoming { &.status-box-upcoming {
background: $gl-text-color-secondary; background: $gl-text-color-secondary;
} }
&.status-box-milestone {
color: $gl-text-color;
background: $gray-darker;
}
} }
...@@ -3,8 +3,20 @@ ...@@ -3,8 +3,20 @@
} }
.milestones { .milestones {
padding: $gl-padding-8;
margin-top: $gl-padding-8;
border-radius: $border-radius-default;
background-color: $theme-gray-100;
.milestone { .milestone {
padding: 10px 16px; border: 0;
padding: $gl-padding-top $gl-padding;
border-radius: $border-radius-default;
background-color: $white-light;
&:not(:last-child) {
margin-bottom: $gl-padding-4;
}
h4 { h4 {
font-weight: $gl-font-weight-bold; font-weight: $gl-font-weight-bold;
...@@ -13,6 +25,24 @@ ...@@ -13,6 +25,24 @@
.progress { .progress {
width: 100%; width: 100%;
height: 6px; height: 6px;
margin-bottom: $gl-padding-4;
}
.milestone-progress {
a {
color: $gl-link-color;
}
}
.status-box {
font-size: $tooltip-font-size;
margin-top: 0;
margin-right: $gl-padding-4;
@include media-breakpoint-down(xs) {
line-height: unset;
padding: $gl-padding-4 $gl-input-padding;
}
} }
} }
} }
...@@ -229,6 +259,10 @@ ...@@ -229,6 +259,10 @@
} }
} }
.milestone-range {
color: $gl-text-color-tertiary;
}
@include media-breakpoint-down(xs) { @include media-breakpoint-down(xs) {
.milestone-banner-text, .milestone-banner-text,
.milestone-banner-link { .milestone-banner-link {
......
...@@ -77,7 +77,7 @@ class Projects::MilestonesController < Projects::ApplicationController ...@@ -77,7 +77,7 @@ class Projects::MilestonesController < Projects::ApplicationController
def promote def promote
promoted_milestone = Milestones::PromoteService.new(project, current_user).execute(milestone) promoted_milestone = Milestones::PromoteService.new(project, current_user).execute(milestone)
flash[:notice] = "#{milestone.title} promoted to <a href=\"#{group_milestone_path(project.group, promoted_milestone.iid)}\">group milestone</a>.".html_safe flash[:notice] = "#{milestone.title} promoted to <a href=\"#{group_milestone_path(project.group, promoted_milestone.iid)}\"><u>group milestone</u></a>.".html_safe
respond_to do |format| respond_to do |format|
format.html do format.html do
redirect_to project_milestones_path(project) redirect_to project_milestones_path(project)
......
- if milestone.expired? and not milestone.closed? - if milestone.expired? and not milestone.closed?
%span.cred (Expired) .status-box.status-box-expired.append-bottom-5 Expired
- if milestone.upcoming? - if milestone.upcoming?
%span.clgray (Upcoming) .status-box.status-box-mr-merged.append-bottom-5 Upcoming
- if milestone.due_date || milestone.start_date - if milestone.closed?
%span .status-box.status-box-closed.append-bottom-5 Closed
= milestone_date_range(milestone)
- dashboard = local_assigns[:dashboard] - dashboard = local_assigns[:dashboard]
- custom_dom_id = dom_id(milestone.try(:milestones) ? milestone.milestones.first : milestone) - custom_dom_id = dom_id(milestone.try(:milestones) ? milestone.milestones.first : milestone)
- milestone_type = milestone.group_milestone? ? 'Group Milestone' : 'Project Milestone'
%li{ class: "milestone milestone-#{milestone.closed? ? 'closed' : 'open'}", id: custom_dom_id } %li{ class: "milestone milestone-#{milestone.closed? ? 'closed' : 'open'}", id: custom_dom_id }
.row .row
.col-sm-6 .col-sm-6
%strong= link_to truncate(milestone.title, length: 100), milestone_path .append-bottom-5
- if milestone.group_milestone? %strong= link_to truncate(milestone.title, length: 100), milestone_path
%span - Group Milestone - if @group
- else = " - #{milestone_type}"
%span - Project Milestone
.col-sm-6 - if @project || milestone.is_a?(GlobalMilestone) || milestone.group_milestone?
.float-right.light #{milestone.percent_complete(current_user)}% complete - if milestone.due_date || milestone.start_date
.row .milestone-range.append-bottom-5
.col-sm-6 = milestone_date_range(milestone)
%div
= render('shared/milestone_expired', milestone: milestone)
- if milestone.legacy_group_milestone?
.projects
- milestone.milestones.each do |milestone|
= link_to milestone_path(milestone) do
%span.label-badge.label-badge-blue.d-inline-block.append-bottom-5
= dashboard ? milestone.project.full_name : milestone.project.name
.col-sm-4.milestone-progress
= milestone_progress_bar(milestone)
= link_to pluralize(milestone.total_issues_count(current_user), 'Issue'), issues_path = link_to pluralize(milestone.total_issues_count(current_user), 'Issue'), issues_path
&middot; &middot;
= link_to pluralize(milestone.merge_requests.size, 'Merge Request'), merge_requests_path = link_to pluralize(milestone.merge_requests.size, 'Merge Request'), merge_requests_path
.col-sm-6= milestone_progress_bar(milestone) .float-lg-right.light #{milestone.percent_complete(current_user)}% complete
- if milestone.is_a?(GlobalMilestone) || milestone.group_milestone? .col-sm-2
.row .milestone-actions.d-flex.justify-content-sm-start.justify-content-md-end
.col-sm-6 - if @project
- if milestone.legacy_group_milestone? - if can?(current_user, :admin_milestone, milestone.project) and milestone.active?
.expiration= render('shared/milestone_expired', milestone: milestone) - if @project.group
.projects %button.js-promote-project-milestone-button.btn.btn-blank.btn-sm.btn-grouped.has-tooltip{ title: _('Promote to Group Milestone'),
- milestone.milestones.each do |milestone| disabled: true,
= link_to milestone_path(milestone) do type: 'button',
%span.badge.badge-gray data: { url: promote_project_milestone_path(milestone.project, milestone),
= dashboard ? milestone.project.full_name : milestone.project.name milestone_title: milestone.title,
- if @group group_name: @project.group.name,
.col-sm-6.milestone-actions target: '#promote-milestone-modal',
container: 'body',
toggle: 'modal' } }
= sprite_icon('level-up', size: 14)
= link_to 'Close Milestone', project_milestone_path(@project, milestone, milestone: {state_event: :close }), method: :put, remote: true, class: "btn btn-sm btn-close btn-grouped"
- unless milestone.active?
= link_to 'Reopen Milestone', project_milestone_path(@project, milestone, {state_event: :activate }), method: :put, class: "btn btn-grouped btn-reopen"
- if @group
- if can?(current_user, :admin_milestones, @group) - if can?(current_user, :admin_milestones, @group)
- if milestone.group_milestone?
= link_to edit_group_milestone_path(@group, milestone), class: "btn btn-sm btn-grouped" do
Edit
\
- if milestone.closed? - if milestone.closed?
= link_to 'Reopen Milestone', group_milestone_route(milestone, {state_event: :activate }), method: :put, class: "btn btn-sm btn-grouped btn-reopen" = link_to 'Reopen Milestone', group_milestone_route(milestone, {state_event: :activate }), method: :put, class: "btn btn-sm btn-grouped btn-reopen"
- else - else
= link_to 'Close Milestone', group_milestone_route(milestone, {state_event: :close }), method: :put, class: "btn btn-sm btn-grouped btn-close" = link_to 'Close Milestone', group_milestone_route(milestone, {state_event: :close }), method: :put, class: "btn btn-sm btn-grouped btn-close"
- if dashboard
- if @project .status-box.status-box-milestone
.row = milestone_type
.col-sm-6
= render('shared/milestone_expired', milestone: milestone)
.col-sm-6.milestone-actions
- if can?(current_user, :admin_milestone, milestone.project) and milestone.active?
= link_to edit_project_milestone_path(milestone.project, milestone), class: "btn btn-sm btn-grouped" do
Edit
\
- if @project.group
%button.js-promote-project-milestone-button.btn.btn-sm.btn-grouped.has-tooltip{ title: _('Promote to Group Milestone'),
disabled: true,
type: 'button',
data: { url: promote_project_milestone_path(milestone.project, milestone),
milestone_title: milestone.title,
group_name: @project.group.name,
target: '#promote-milestone-modal',
container: 'body',
toggle: 'modal' } }
= _('Promote')
= link_to 'Close Milestone', project_milestone_path(@project, milestone, milestone: {state_event: :close }), method: :put, remote: true, class: "btn btn-sm btn-close btn-grouped"
%button.js-delete-milestone-button.btn.btn-sm.btn-grouped.btn-danger{ data: { toggle: 'modal',
target: '#delete-milestone-modal',
milestone_id: milestone.id,
milestone_title: markdown_field(milestone, :title),
milestone_url: project_milestone_path(milestone.project, milestone),
milestone_issue_count: milestone.issues.count,
milestone_merge_request_count: milestone.merge_requests.count },
disabled: true }
= _('Delete')
= icon('spin spinner', class: 'js-loading-icon hidden' )
---
title: Milestone page list redesign
merge_request: 19832
author: Constance Okoghenun
type: changed
...@@ -124,7 +124,7 @@ describe Projects::MilestonesController do ...@@ -124,7 +124,7 @@ describe Projects::MilestonesController do
it 'shows group milestone' do it 'shows group milestone' do
post :promote, namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid post :promote, namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid
expect(flash[:notice]).to eq("#{milestone.title} promoted to <a href=\"#{group_milestone_path(project.group, milestone.iid)}\">group milestone</a>.") expect(flash[:notice]).to eq("#{milestone.title} promoted to <a href=\"#{group_milestone_path(project.group, milestone.iid)}\"><u>group milestone</u></a>.")
expect(response).to redirect_to(project_milestones_path(project)) expect(response).to redirect_to(project_milestones_path(project))
end end
end end
......
...@@ -107,19 +107,6 @@ feature 'Group milestones' do ...@@ -107,19 +107,6 @@ feature 'Group milestones' do
expect(page).to have_selector("#milestone_#{legacy_milestone.milestones.first.id}", count: 1) expect(page).to have_selector("#milestone_#{legacy_milestone.milestones.first.id}", count: 1)
end end
it 'updates milestone' do
page.within(".milestones #milestone_#{active_group_milestone.id}") do
click_link('Edit')
end
page.within('.milestone-form') do
fill_in 'milestone_title', with: 'new title'
click_button('Update milestone')
end
expect(find('#content-body h2')).to have_content('new title')
end
it 'shows milestone detail and supports its edit' do it 'shows milestone detail and supports its edit' do
page.within(".milestones #milestone_#{active_group_milestone.id}") do page.within(".milestones #milestone_#{active_group_milestone.id}") do
click_link(active_group_milestone.title) click_link(active_group_milestone.title)
......
...@@ -13,6 +13,7 @@ describe "User deletes milestone", :js do ...@@ -13,6 +13,7 @@ describe "User deletes milestone", :js do
end end
it "deletes milestone" do it "deletes milestone" do
click_link(milestone.title)
click_button("Delete") click_button("Delete")
click_button("Delete milestone") click_button("Delete milestone")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment