debian-mirror-gitlab/app/assets/javascripts/diffs/components/edit_button.vue

50 lines
908 B
Vue
Raw Normal View History

2018-11-08 19:23:39 +05:30
<script>
2019-07-07 11:18:12 +05:30
import { GlTooltipDirective, GlButton } from '@gitlab/ui';
import Icon from '~/vue_shared/components/icon.vue';
2018-11-08 19:23:39 +05:30
export default {
2019-07-07 11:18:12 +05:30
components: {
GlButton,
Icon,
},
directives: {
GlTooltip: GlTooltipDirective,
},
2018-11-08 19:23:39 +05:30
props: {
editPath: {
type: String,
required: true,
},
canCurrentUserFork: {
type: Boolean,
required: true,
},
canModifyBlob: {
type: Boolean,
required: false,
default: false,
},
},
methods: {
handleEditClick(evt) {
2019-07-07 11:18:12 +05:30
if (this.canCurrentUserFork && !this.canModifyBlob) {
2018-11-08 19:23:39 +05:30
evt.preventDefault();
this.$emit('showForkMessage');
}
},
},
};
</script>
<template>
2019-07-07 11:18:12 +05:30
<gl-button
2019-09-04 21:01:54 +05:30
v-gl-tooltip.top
2019-07-07 11:18:12 +05:30
:href="editPath"
:title="__('Edit file')"
class="js-edit-blob"
@click.native="handleEditClick"
>
<icon name="pencil" />
</gl-button>
2018-11-08 19:23:39 +05:30
</template>