gitlab-org--gitlab-foss/app/assets/javascripts/ide/components/repo_file_buttons.vue

61 lines
1.2 KiB
Vue
Raw Normal View History

2017-07-24 12:15:41 -04:00
<script>
import { mapGetters } from 'vuex';
2017-07-24 12:15:41 -04:00
export default {
2017-07-24 12:15:41 -04:00
computed: {
...mapGetters([
'activeFile',
]),
showButtons() {
return this.activeFile.rawPath ||
this.activeFile.blamePath ||
this.activeFile.commitsPath ||
this.activeFile.permalink;
},
rawDownloadButtonLabel() {
return this.activeFile.binary ? 'Download' : 'Raw';
2017-07-24 12:15:41 -04:00
},
},
};
</script>
<template>
<div
v-if="showButtons"
2017-11-23 12:16:01 -05:00
class="multi-file-editor-btn-group"
>
2017-08-15 15:53:41 -04:00
<a
:href="activeFile.rawPath"
2017-08-15 15:53:41 -04:00
target="_blank"
2017-11-23 12:16:01 -05:00
class="btn btn-default btn-sm raw"
2017-08-15 15:53:41 -04:00
rel="noopener noreferrer">
{{ rawDownloadButtonLabel }}
2017-08-15 15:53:41 -04:00
</a>
2017-07-24 12:15:41 -04:00
2017-08-15 15:53:41 -04:00
<div
class="btn-group"
role="group"
2018-01-06 14:54:45 -05:00
aria-label="File actions"
>
2017-08-15 15:53:41 -04:00
<a
:href="activeFile.blamePath"
2018-01-06 14:54:45 -05:00
class="btn btn-default btn-sm blame"
>
2017-08-15 15:53:41 -04:00
Blame
</a>
<a
:href="activeFile.commitsPath"
2018-01-06 14:54:45 -05:00
class="btn btn-default btn-sm history"
>
2017-08-15 15:53:41 -04:00
History
</a>
<a
:href="activeFile.permalink"
2018-01-06 14:54:45 -05:00
class="btn btn-default btn-sm permalink"
>
2017-08-15 15:53:41 -04:00
Permalink
</a>
</div>
</div>
2017-07-24 12:15:41 -04:00
</template>