Commit 0d7352c2 authored by Douwe Maan's avatar Douwe Maan

Merge branch '5710-add-contact-sales-option-for-epics' into 'master'

Add contact sales option for Epics

Closes #5710

See merge request gitlab-org/gitlab-ee!5601
parents e2d00615 5a4968c6
module IssuablesHelper
prepend EE::IssuablesHelper
include GitlabRoutingHelper
def sidebar_gutter_toggle_icon
......@@ -390,9 +392,7 @@ module IssuablesHelper
editable: can_edit_issuable,
currentUser: UserSerializer.new.represent(current_user),
rootPath: root_path,
fullPath: @project.full_path,
weightOptions: Issue.weight_options,
weightNoneValue: Issue::WEIGHT_NONE
fullPath: @project.full_path
}
end
......
......@@ -18,7 +18,7 @@
= render "shared/issuable/sidebar_todo", todo: todo, issuable: issuable, is_collapsed: true
.block.assignee
= render "shared/issuable/sidebar_assignees", issuable: issuable, can_edit_issuable: can_edit_issuable, signed_in: current_user.present?
= render "shared/issuable/sidebar_item_epic", issuable: issuable
= render_sidebar_epic(issuable)
.block.milestone
.sidebar-collapsed-icon.has-tooltip{ title: milestone_tooltip_title(issuable.milestone), data: { container: 'body', html: 1, placement: 'left' } }
= icon('clock-o', 'aria-hidden': 'true')
......
import initShow from '~/pages/projects/issues/show';
import initSidebarBundle from 'ee/sidebar/sidebar_bundle';
import initRelatedIssues from 'ee/related_issues';
import UserCallout from '~/user_callout';
document.addEventListener('DOMContentLoaded', () => {
initShow();
initSidebarBundle();
initRelatedIssues();
// eslint-disable-next-line no-new
new UserCallout({ className: 'js-epics-sidebar-callout' });
// eslint-disable-next-line no-new
new UserCallout({ className: 'js-weight-sidebar-callout' });
});
......@@ -22,7 +22,6 @@
align-items: flex-start;
.close {
.dismiss-icon {
color: $gray-darkest;
}
......@@ -32,13 +31,11 @@
color: $text-color;
}
}
}
.svg-container {
margin-right: 15px;
}
}
&.promotion-empty-page {
......@@ -70,7 +67,6 @@
}
.promotion-modal {
.modal-dialog {
width: 540px;
}
......@@ -87,7 +83,6 @@
.modal-footer {
border-top: 0;
}
}
.promotion-backdrop {
......@@ -100,11 +95,17 @@
}
}
.promotion-info-weight-message {
padding: $gl-padding-top;
.promotion-issue-sidebar {
.promotion-issue-sidebar-message {
padding: $gl-padding-top;
.dropdown-title {
margin: 0 0 10px;
.dropdown-title {
margin: 0 0 10px;
}
.btn + .btn {
margin-top: $gl-padding-4;
}
}
.btn {
......@@ -114,7 +115,7 @@
line-height: $line-height-base;
}
.btn-link {
.right-sidebar & .btn-link {
display: inline;
color: $gl-link-color;
background-color: transparent;
......@@ -127,7 +128,6 @@
}
}
.promotion-issue-template-message {
padding: $gl-padding 30px 20px $gl-padding;
......@@ -160,4 +160,3 @@
}
}
}
module EE
module IssuablesHelper
extend ::Gitlab::Utils::Override
override :issuable_sidebar_options
def issuable_sidebar_options(issuable, can_edit_issuable)
super.merge(
weightOptions: ::Issue.weight_options,
weightNoneValue: ::Issue::WEIGHT_NONE
)
end
def render_sidebar_epic(issuable)
if issuable.project.feature_available?(:epics)
render 'shared/issuable/sidebar_item_epic', issuable: issuable
else
render 'shared/promotions/promote_epics'
end
end
end
end
- return unless issuable.project.group&.feature_available?(:epics)
- if issuable.is_a?(Issue)
.block.epic
#js-vue-sidebar-item-epic
......
- promotion_feature = 'promote_epics_sidebar_dismissed'
- if !@project.feature_available?(:epics) && show_promotions? && show_callout?(promotion_feature)
.block.js-epics-sidebar-callout.promotion-issue-sidebar{ data: { uid: promotion_feature } }
.sidebar-collapsed-icon{ data: { toggle: "dropdown", target: ".js-epics-sidebar-callout" } }
%span{ data: { toggle: "tooltip", placement: "left", container: "body" }, title: _('Epic') }
= sprite_icon('epic', size: 16)
%span
= _('None')
.title.hide-collapsed
= _('Epic')
.dropdown
.dropdown-menu.promotion-issue-sidebar-message
.dropdown-title
%span
= _('Epic')
%button.dropdown-title-button.dropdown-menu-close{ "aria-label" => _('Close'), :type => "button" }
%i.fa.fa-times.dropdown-menu-close-icon{ "aria-hidden" => "true", "data-hidden" => "true" }
%div
%p
= s_('Promotions|Epics let you manage your portfolio of projects more efficiently and with less effort by tracking groups of issues that share a theme, across projects and milestones.')
= link_to s_('Read more'), 'https://docs.gitlab.com/ee/user/group/epics/', class: 'btn-link', target: '_blank'
%div
= render 'shared/promotions/promotion_link_project', short_form: true
= link_to s_("Promotions|Don't show me this again"), '#', class: ['btn', 'js-close', 'js-close-callout']
.hide-collapsed
= s_('Promotions|This feature is locked.')
= link_to s_('Promotions|Upgrade plan') , '#', class: 'btn-link', data: { toggle: "dropdown", target: ".js-epics-sidebar-callout" }
- if show_promotions? && !@project.feature_available?(:issue_weights)
.block.weight
.sidebar-collapsed-icon{ data: { toggle: "dropdown", target: ".weight" } }
- promotion_feature = 'promote_weight_sidebar_dismissed'
- if !@project.feature_available?(:issue_weights) && show_promotions? && show_callout?(promotion_feature)
.block.js-weight-sidebar-callout.promotion-issue-sidebar{ data: { uid: promotion_feature } }
.sidebar-collapsed-icon{ data: { toggle: "dropdown", target: ".js-weight-sidebar-callout" } }
%span{ data: { toggle: "tooltip", placement: "left", container: "body" }, title: _("Weight") }
= icon('balance-scale')
%span No
.title.hide-collapsed
= _('Weight')
= link_to _('Edit'), '#', class: 'edit-link promote-weight-link pull-right', data: { toggle: "dropdown", target: ".weight" }
.promotion-info-weight.dropdown
.dropdown-menu.promotion-info-weight-message
.dropdown
.dropdown-menu.promotion-issue-sidebar-message
.dropdown-title
%span
= _('Change Weight')
......@@ -23,6 +24,7 @@
= link_to _('Read more'), help_page_path('workflow/issue_weight.html'), class: 'btn-link', target: '_blank'
%div
= render 'shared/promotions/promotion_link_project', short_form: true
= link_to s_("Promotions|Don't show me this again"), '#', class: ['btn', 'js-close', 'js-close-callout']
.hide-collapsed
%span.no-value
= _('None')
= s_('Promotions|This feature is locked.')
= link_to s_('Promotions|Upgrade plan') , '#', class: 'btn-link', data: { toggle: "dropdown", target: ".js-weight-sidebar-callout" }
---
title: Add promotion for epics to issuable sidebar
merge_request: 5601
author:
type: other
---
title: Make issue weight promotion in issuable sidebar dismissable
merge_request: 5601
author:
type: changed
......@@ -18,6 +18,7 @@ describe 'Promotions', :js do
it 'should show no promotion at all' do
sign_in(user)
visit edit_project_path(project)
expect(page).not_to have_selector('#promote_service_desk')
end
end
......@@ -33,12 +34,14 @@ describe 'Promotions', :js do
it 'should have the contact admin line' do
sign_in(user)
visit edit_project_path(project)
expect(find('#promote_service_desk')).to have_content 'Contact your Administrator to upgrade your license.'
end
it 'should have the start trial button' do
sign_in(admin)
visit edit_project_path(project)
expect(find('#promote_service_desk')).to have_content 'Start GitLab Ultimate trial'
end
end
......@@ -58,11 +61,13 @@ describe 'Promotions', :js do
it 'should have the Upgrade your plan button' do
visit edit_project_path(project)
expect(find('#promote_service_desk')).to have_content 'Upgrade your plan'
end
it 'should have the contact owner line' do
visit edit_project_path(otherproject)
expect(find('#promote_service_desk')).to have_content 'Contact owner'
end
end
......@@ -79,6 +84,7 @@ describe 'Promotions', :js do
it 'should appear in project edit page' do
visit edit_project_path(project)
expect(find('#promote_service_desk')).to have_content 'Improve customer support with GitLab Service Desk.'
end
......@@ -108,6 +114,7 @@ describe 'Promotions', :js do
it 'should appear in project edit page' do
visit edit_project_path(project)
expect(find('#promote_mr_features')).to have_content 'Improve Merge Requests'
end
......@@ -165,6 +172,7 @@ describe 'Promotions', :js do
it 'should appear in new MR page' do
visit project_new_merge_request_path(project, merge_request: { target_branch: 'master', source_branch: 'feature' })
expect(find('#promote_squash_commits')).to have_content 'Improve Merge Requests with Squash Commit and GitLab Enterprise Edition.'
end
......@@ -192,6 +200,7 @@ describe 'Promotions', :js do
it 'should appear in milestone page' do
visit project_milestone_path(project, milestone)
expect(find('#promote_burndown_charts')).to have_content "Upgrade your plan to improve milestones with Burndown Charts."
end
......@@ -219,6 +228,7 @@ describe 'Promotions', :js do
it 'should appear in milestone page' do
visit project_boards_path(project)
expect(find('.board-promotion-state')).to have_content "Upgrade your plan to improve Issue boards"
end
......@@ -246,11 +256,64 @@ describe 'Promotions', :js do
it 'should appear on export modal' do
visit project_issues_path(project)
click_on 'Export as CSV'
expect(find('.issues-export-modal')).to have_content 'Export issues with GitLab Enterprise Edition.'
end
end
describe 'for epics in issues sidebar', :js do
before do
allow(License).to receive(:current).and_return(nil)
stub_application_setting(check_namespace_plan: false)
project.add_master(user)
sign_in(user)
end
it 'should appear on the page' do
visit project_issue_path(project, issue)
wait_for_requests
find('.js-epics-sidebar-callout .btn-link').click
expect(find('.promotion-issue-sidebar-message')).to have_content 'Epics let you manage your portfolio of projects more efficiently'
end
it 'should be removed after dismissal' do
visit project_issue_path(project, issue)
wait_for_requests
find('.js-epics-sidebar-callout .btn-link').click
find('.js-epics-sidebar-callout .js-close-callout').click
expect(page).not_to have_selector('.js-epics-sidebar-callout')
end
it 'should not appear on page after dismissal and reload' do
visit project_issue_path(project, issue)
wait_for_requests
find('.js-epics-sidebar-callout .btn-link').click
find('.js-epics-sidebar-callout .js-close-callout').click
visit project_issue_path(project, issue)
expect(page).not_to have_selector('.js-epics-sidebar-callout')
end
it 'should close dialog when clicking on X, but not dismiss it' do
visit project_issue_path(project, issue)
wait_for_requests
find('.js-epics-sidebar-callout .btn-link').click
find('.js-epics-sidebar-callout .dropdown-menu-close').click
expect(page).to have_selector('.js-epics-sidebar-callout')
expect(page).to have_selector('.promotion-issue-sidebar-message', visible: false)
end
end
describe 'for issue weight', :js do
before do
allow(License).to receive(:current).and_return(nil)
......@@ -263,8 +326,42 @@ describe 'Promotions', :js do
it 'should appear on the page', :js do
visit project_issue_path(project, issue)
wait_for_requests
find('.promote-weight-link').click
expect(find('.promotion-info-weight-message')).to have_content 'Improve issues management with Issue weight and GitLab Enterprise Edition'
find('.js-weight-sidebar-callout .btn-link').click
expect(find('.promotion-issue-sidebar-message')).to have_content 'Improve issues management with Issue weight and GitLab Enterprise Edition'
end
it 'should be removed after dismissal' do
visit project_issue_path(project, issue)
wait_for_requests
find('.js-weight-sidebar-callout .btn-link').click
find('.js-weight-sidebar-callout .js-close-callout').click
expect(page).not_to have_selector('.js-weight-sidebar-callout')
end
it 'should not appear on page after dismissal and reload' do
visit project_issue_path(project, issue)
wait_for_requests
find('.js-weight-sidebar-callout .btn-link').click
find('.js-weight-sidebar-callout .js-close-callout').click
visit project_issue_path(project, issue)
expect(page).not_to have_selector('.js-weight-sidebar-callout')
end
it 'should close dialog when clicking on X, but not dismiss it' do
visit project_issue_path(project, issue)
wait_for_requests
find('.js-weight-sidebar-callout .btn-link').click
find('.js-weight-sidebar-callout .dropdown-menu-close').click
expect(page).to have_selector('.js-weight-sidebar-callout')
expect(page).to have_selector('.promotion-issue-sidebar-message', visible: false)
end
end
......@@ -280,7 +377,9 @@ describe 'Promotions', :js do
it 'should appear on the page', :js do
visit new_project_issue_path(project)
wait_for_requests
find('#promotion-issue-template-link').click
expect(find('.promotion-issue-template-message')).to have_content 'Description templates allow you to define context-specific templates for issue and merge request description fields for your project.'
end
end
......@@ -296,6 +395,7 @@ describe 'Promotions', :js do
it 'should appear on the page' do
visit project_audit_events_path(project)
expect(find('.user-callout-copy')).to have_content 'Track your project with Audit Events'
end
end
......@@ -311,6 +411,7 @@ describe 'Promotions', :js do
it 'should appear on the page' do
visit group_analytics_path(group)
expect(find('.user-callout-copy')).to have_content 'Track activity with Contribution Analytics.'
end
end
......@@ -326,6 +427,7 @@ describe 'Promotions', :js do
it 'should appear on the page' do
visit group_hooks_path(group)
expect(find('.user-callout-copy')).to have_content 'Add Group Webhooks'
end
end
......
......@@ -4077,6 +4077,18 @@ msgstr ""
msgid "Promote to Group Milestone"
msgstr ""
msgid "Promotions|Don't show me this again"
msgstr ""
msgid "Promotions|Epics let you manage your portfolio of projects more efficiently and with less effort by tracking groups of issues that share a theme, across projects and milestones."
msgstr ""
msgid "Promotions|This feature is locked."
msgstr ""
msgid "Promotions|Upgrade plan"
msgstr ""
msgid "Protip:"
msgstr ""
......
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