Commit 839d7f3c authored by Denys Mishunov's avatar Denys Mishunov

Moving constants to $options

parent fad64474
<script> <script>
import { GlButton, GlButtonGroup, GlIcon, GlTooltipDirective } from '@gitlab/ui'; import { GlButton, GlButtonGroup, GlIcon, GlTooltipDirective } from '@gitlab/ui';
import { __ } from '~/locale';
import { BTN_COPY_CONTENTS_TITLE, BTN_DOWNLOAD_TITLE, BTN_RAW_TITLE } from './constants'; import { BTN_COPY_CONTENTS_TITLE, BTN_DOWNLOAD_TITLE, BTN_RAW_TITLE } from './constants';
export default { export default {
...@@ -19,15 +18,6 @@ export default { ...@@ -19,15 +18,6 @@ export default {
}, },
}, },
computed: { computed: {
copyBtnTitle() {
return __(BTN_COPY_CONTENTS_TITLE);
},
rawBtnTitle() {
return __(BTN_RAW_TITLE);
},
downloadBtnTitle() {
return __(BTN_DOWNLOAD_TITLE);
},
rawUrl() { rawUrl() {
return this.blob.rawPath; return this.blob.rawPath;
}, },
...@@ -40,34 +30,35 @@ export default { ...@@ -40,34 +30,35 @@ export default {
this.$emit('copy'); this.$emit('copy');
}, },
}, },
BTN_COPY_CONTENTS_TITLE,
BTN_DOWNLOAD_TITLE,
BTN_RAW_TITLE,
}; };
</script> </script>
<template> <template>
<gl-button-group> <gl-button-group>
<gl-button <gl-button
v-gl-tooltip.hover v-gl-tooltip.hover
:aria-label="copyBtnTitle" :aria-label="$options.BTN_COPY_CONTENTS_TITLE"
:title="copyBtnTitle" :title="$options.BTN_COPY_CONTENTS_TITLE"
@click="requestCopyContents" @click="requestCopyContents"
> >
<gl-icon name="copy-to-clipboard" :size="14" /> <gl-icon name="copy-to-clipboard" :size="14" />
</gl-button> </gl-button>
<gl-button <gl-button
v-gl-tooltip.hover v-gl-tooltip.hover
:aria-label="rawBtnTitle" :aria-label="$options.BTN_RAW_TITLE"
:title="rawBtnTitle" :title="$options.BTN_RAW_TITLE"
:href="rawUrl" :href="rawUrl"
rel="noopener noreferrer"
target="_blank" target="_blank"
> >
<gl-icon name="doc-code" :size="14" /> <gl-icon name="doc-code" :size="14" />
</gl-button> </gl-button>
<gl-button <gl-button
v-gl-tooltip.hover v-gl-tooltip.hover
:aria-label="downloadBtnTitle" :aria-label="$options.BTN_DOWNLOAD_TITLE"
:title="downloadBtnTitle" :title="$options.BTN_DOWNLOAD_TITLE"
:href="downloadUrl" :href="downloadUrl"
rel="noopener noreferrer"
target="_blank" target="_blank"
> >
<gl-icon name="download" :size="14" /> <gl-icon name="download" :size="14" />
......
export const BTN_COPY_CONTENTS_TITLE = 'Copy file contents'; import { __ } from '~/locale';
export const BTN_RAW_TITLE = 'Open raw';
export const BTN_DOWNLOAD_TITLE = 'Download'; export const BTN_COPY_CONTENTS_TITLE = __('Copy file contents');
export const BTN_RAW_TITLE = __('Open raw');
export const BTN_DOWNLOAD_TITLE = __('Download');
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