diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-30 12:12:38 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-30 12:12:38 +0300 |
commit | 5b80d465ae36e5f73ac974b20928aeac82634e20 (patch) | |
tree | 72cb34e0c37b0d2c47581926d8e0a90ff6278224 /app/assets | |
parent | b920d2a9831056cdf907cf71fd25d94f0aaf1e6c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/vue_merge_request_widget/components/states/commits_header.vue | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/commits_header.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/commits_header.vue index a55dba92e16..e57f9938011 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/commits_header.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/commits_header.vue @@ -1,12 +1,16 @@ <script> /* eslint-disable @gitlab/require-string-literal-i18n-helpers */ -import { GlButton } from '@gitlab/ui'; +import { GlButton, GlSprintf } from '@gitlab/ui'; import { escape } from 'lodash'; -import { __, n__, sprintf, s__ } from '~/locale'; +import { __, n__, s__ } from '~/locale'; + +const mergeCommitCount = s__('mrWidgetCommitsAdded|1 merge commit'); export default { + mergeCommitCount, components: { GlButton, + GlSprintf, }, props: { isSquashEnabled: { @@ -47,22 +51,15 @@ export default { ariaLabel() { return this.expanded ? __('Collapse') : __('Expand'); }, + targetBranchEscaped() { + return escape(this.targetBranch); + }, message() { - const message = this.isFastForwardEnabled + return this.isFastForwardEnabled ? s__('mrWidgetCommitsAdded|%{commitCount} will be added to %{targetBranch}.') : s__( 'mrWidgetCommitsAdded|%{commitCount} and %{mergeCommitCount} will be added to %{targetBranch}.', ); - - return sprintf( - message, - { - commitCount: `<strong class="commits-count-message">${this.commitsCountMessage}</strong>`, - mergeCommitCount: `<strong>${s__('mrWidgetCommitsAdded|1 merge commit')}</strong>`, - targetBranch: `<span class="label-branch">${escape(this.targetBranch)}</span>`, - }, - false, - ); }, }, methods: { @@ -89,10 +86,19 @@ export default { /> <span v-if="expanded">{{ __('Collapse') }}</span> <span v-else> - <span - class="vertical-align-middle" - v-html="message /* eslint-disable-line vue/no-v-html */" - ></span> + <span class="vertical-align-middle"> + <gl-sprintf :message="message"> + <template #commitCount> + <strong class="commits-count-message">{{ commitsCountMessage }}</strong> + </template> + <template #mergeCommitCount> + <strong>{{ $options.mergeCommitCount }}</strong> + </template> + <template #targetBranch> + <span class="label-branch">{{ targetBranchEscaped }}</span> + </template> + </gl-sprintf> + </span> <gl-button variant="link" class="modify-message-button"> {{ modifyLinkMessage }} </gl-button> |