Fix promoting labels and milestones copy text
This commit is contained in:
parent
fe5f7390f0
commit
1f02673867
|
|
@ -19,15 +19,19 @@
|
|||
type: String,
|
||||
required: true,
|
||||
},
|
||||
groupName: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
title() {
|
||||
return sprintf(s__('Milestones|Promote %{milestoneTitle} to group milestone?'), { milestoneTitle: this.milestoneTitle });
|
||||
},
|
||||
text() {
|
||||
return s__(`Milestones|Promoting this milestone will make it available for all projects inside the group.
|
||||
return sprintf(s__(`Milestones|Promoting %{milestoneTitle} will make it available for all projects inside %{groupName}.
|
||||
Existing project milestones with the same title will be merged.
|
||||
This action cannot be reversed.`);
|
||||
This action cannot be reversed.`), { milestoneTitle: this.milestoneTitle, groupName: this.groupName });
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ export default () => {
|
|||
const modalProps = {
|
||||
milestoneTitle: button.dataset.milestoneTitle,
|
||||
url: button.dataset.url,
|
||||
groupName: button.dataset.groupName,
|
||||
};
|
||||
eventHub.$once('promoteMilestoneModal.requestStarted', onRequestStarted);
|
||||
eventHub.$emit('promoteMilestoneModal.props', modalProps);
|
||||
|
|
@ -54,6 +55,7 @@ export default () => {
|
|||
return {
|
||||
modalProps: {
|
||||
milestoneTitle: '',
|
||||
groupName: '',
|
||||
url: '',
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -27,11 +27,18 @@
|
|||
type: String,
|
||||
required: true,
|
||||
},
|
||||
groupName: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
text() {
|
||||
return s__(`Milestones|Promoting this label will make it available for all projects inside the group.
|
||||
Existing project labels with the same title will be merged. This action cannot be reversed.`);
|
||||
return sprintf(s__(`Labels|Promoting %{labelTitle} will make it available for all projects inside %{groupName}.
|
||||
Existing project labels with the same title will be merged. This action cannot be reversed.`), {
|
||||
labelTitle: this.labelTitle,
|
||||
groupName: this.groupName,
|
||||
});
|
||||
},
|
||||
title() {
|
||||
const label = `<span
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ const initLabelIndex = () => {
|
|||
labelColor: button.dataset.labelColor,
|
||||
labelTextColor: button.dataset.labelTextColor,
|
||||
url: button.dataset.url,
|
||||
groupName: button.dataset.groupName,
|
||||
};
|
||||
eventHub.$once('promoteLabelModal.requestStarted', onRequestStarted);
|
||||
eventHub.$emit('promoteLabelModal.props', modalProps);
|
||||
|
|
@ -62,6 +63,7 @@ const initLabelIndex = () => {
|
|||
labelColor: '',
|
||||
labelTextColor: '',
|
||||
url: '',
|
||||
groupName: '',
|
||||
},
|
||||
};
|
||||
},
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ class Projects::LabelsController < Projects::ApplicationController
|
|||
begin
|
||||
return render_404 unless promote_service.execute(@label)
|
||||
|
||||
flash[:notice] = "#{@label.title} promoted to group label."
|
||||
flash[:notice] = "#{@label.title} promoted to <a href=#{group_labels_path(@project.group)}>group label.</a>".html_safe
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
redirect_to(project_labels_path(@project), status: 303)
|
||||
|
|
|
|||
|
|
@ -74,9 +74,9 @@ class Projects::MilestonesController < Projects::ApplicationController
|
|||
end
|
||||
|
||||
def promote
|
||||
Milestones::PromoteService.new(project, current_user).execute(milestone)
|
||||
promoted_milestone = Milestones::PromoteService.new(project, current_user).execute(milestone)
|
||||
|
||||
flash[:notice] = "#{milestone.title} promoted to group milestone"
|
||||
flash[:notice] = "#{milestone.title} promoted to <a href=#{group_milestone_path(project.group, promoted_milestone.iid)}>group milestone.</a>".html_safe
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
redirect_to project_milestones_path(project)
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
%button.js-promote-project-milestone-button.btn.btn-grouped{ data: { toggle: 'modal',
|
||||
target: '#promote-milestone-modal',
|
||||
milestone_title: @milestone.title,
|
||||
group_name: @project.group.name,
|
||||
url: promote_project_milestone_path(@milestone.project, @milestone),
|
||||
container: 'body' },
|
||||
disabled: true,
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@
|
|||
label_title: label.title,
|
||||
label_color: label.color,
|
||||
label_text_color: label.text_color,
|
||||
group_name: label.project.group.name,
|
||||
target: '#promote-label-modal',
|
||||
container: 'body',
|
||||
toggle: 'modal' } }
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@
|
|||
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' } }
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ describe Projects::MilestonesController do
|
|||
it 'shows group milestone' do
|
||||
post :promote, namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid
|
||||
|
||||
expect(flash[:notice]).to eq("#{milestone.title} promoted to group milestone")
|
||||
expect(flash[:notice]).to eq("#{milestone.title} promoted to <a href=#{group_milestone_path(project.group, milestone.iid)}>group milestone.</a>")
|
||||
expect(response).to redirect_to(project_milestones_path(project))
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ describe('Promote label modal', () => {
|
|||
labelColor: '#5cb85c',
|
||||
labelTextColor: '#ffffff',
|
||||
url: `${gl.TEST_HOST}/dummy/promote/labels`,
|
||||
groupName: 'group',
|
||||
};
|
||||
|
||||
describe('Modal title and description', () => {
|
||||
|
|
@ -24,7 +25,7 @@ describe('Promote label modal', () => {
|
|||
});
|
||||
|
||||
it('contains the proper description', () => {
|
||||
expect(vm.text).toContain('Promoting this label will make it available for all projects inside the group');
|
||||
expect(vm.text).toContain(`Promoting ${labelMockData.labelTitle} will make it available for all projects inside ${labelMockData.groupName}`);
|
||||
});
|
||||
|
||||
it('contains a label span with the color', () => {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ describe('Promote milestone modal', () => {
|
|||
const milestoneMockData = {
|
||||
milestoneTitle: 'v1.0',
|
||||
url: `${gl.TEST_HOST}/dummy/promote/milestones`,
|
||||
groupName: 'group',
|
||||
};
|
||||
|
||||
describe('Modal title and description', () => {
|
||||
|
|
@ -22,7 +23,7 @@ describe('Promote milestone modal', () => {
|
|||
});
|
||||
|
||||
it('contains the proper description', () => {
|
||||
expect(vm.text).toContain('Promoting this milestone will make it available for all projects inside the group.');
|
||||
expect(vm.text).toContain(`Promoting ${milestoneMockData.milestoneTitle} will make it available for all projects inside ${milestoneMockData.groupName}.`);
|
||||
});
|
||||
|
||||
it('contains the correct title', () => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue