2020-03-13 15:44:24 +05:30
|
|
|
<script>
|
|
|
|
import FileIcon from '~/vue_shared/components/file_icon.vue';
|
|
|
|
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
|
|
|
|
import { numberToHumanSize } from '~/lib/utils/number_utils';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
FileIcon,
|
|
|
|
ClipboardButton,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
blob: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
blobSize() {
|
|
|
|
return numberToHumanSize(this.blob.size);
|
|
|
|
},
|
|
|
|
gfmCopyText() {
|
|
|
|
return `\`${this.blob.path}\``;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<template>
|
|
|
|
<div class="file-header-content d-flex align-items-center lh-100">
|
|
|
|
<slot name="filepathPrepend"></slot>
|
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
<template v-if="blob.path">
|
|
|
|
<file-icon :file-name="blob.path" :size="18" aria-hidden="true" css-classes="mr-2" />
|
|
|
|
<strong
|
|
|
|
class="file-title-name mr-1 js-blob-header-filepath"
|
2020-06-23 00:09:42 +05:30
|
|
|
data-qa-selector="file_title_content"
|
2020-05-24 23:13:21 +05:30
|
|
|
>{{ blob.path }}</strong
|
|
|
|
>
|
|
|
|
</template>
|
2020-03-13 15:44:24 +05:30
|
|
|
|
|
|
|
<small class="mr-2">{{ blobSize }}</small>
|
|
|
|
|
|
|
|
<clipboard-button
|
|
|
|
:text="blob.path"
|
|
|
|
:gfm="gfmCopyText"
|
|
|
|
:title="__('Copy file path')"
|
2021-01-03 14:25:43 +05:30
|
|
|
category="tertiary"
|
2020-03-13 15:44:24 +05:30
|
|
|
css-class="btn-clipboard btn-transparent lh-100 position-static"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</template>
|