Commit cbb9ab43 authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch 'lashmanov/241850-replace-v-html-with-sprintf' into 'master'

Replace v-html with gl-sprintf component in locked_warning.vue (#241850)

See merge request gitlab-org/gitlab!71036
parents b4e39d58 e405e887
<script>
import { __, sprintf } from '~/locale';
import { GlSprintf, GlLink } from '@gitlab/ui';
import { __ } from '~/locale';
const alertMessage = __(
'Someone edited the issue at the same time you did. Please check out %{linkStart}the issue%{linkEnd} and make sure your changes will not unintentionally remove theirs.',
);
export default {
alertMessage,
components: {
GlSprintf,
GlLink,
},
computed: {
currentPath() {
return window.location.pathname;
},
alertMessage() {
return sprintf(
__(
'Someone edited the issue at the same time you did. Please check out %{linkStart}the issue%{linkEnd} and make sure your changes will not unintentionally remove theirs.',
),
{
linkStart: `<a href="${this.currentPath}" target="_blank" rel="nofollow">`,
linkEnd: `</a>`,
},
false,
);
},
},
};
</script>
<template>
<div
class="alert alert-danger"
v-html="alertMessage /* eslint-disable-line vue/no-v-html */"
></div>
<div class="alert alert-danger">
<gl-sprintf :message="$options.alertMessage">
<template #link="{ content }">
<gl-link :href="currentPath" target="_blank" rel="nofollow">
{{ content }}
</gl-link>
</template>
</gl-sprintf>
</div>
</template>
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