2018-06-21 08:22:40 -04:00
|
|
|
<script>
|
2020-04-03 05:09:31 -04:00
|
|
|
import { GlTooltipDirective, GlDeprecatedButton } from '@gitlab/ui';
|
2019-02-28 09:14:15 -05:00
|
|
|
import Icon from '~/vue_shared/components/icon.vue';
|
|
|
|
|
2018-06-21 08:22:40 -04:00
|
|
|
export default {
|
2019-02-28 09:14:15 -05:00
|
|
|
components: {
|
2020-04-03 05:09:31 -04:00
|
|
|
GlDeprecatedButton,
|
2019-02-28 09:14:15 -05:00
|
|
|
Icon,
|
|
|
|
},
|
|
|
|
directives: {
|
|
|
|
GlTooltip: GlTooltipDirective,
|
|
|
|
},
|
2018-06-21 08:22:40 -04:00
|
|
|
props: {
|
|
|
|
editPath: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
2018-07-17 11:47:02 -04:00
|
|
|
canCurrentUserFork: {
|
|
|
|
type: Boolean,
|
2018-06-21 08:22:40 -04:00
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
canModifyBlob: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
handleEditClick(evt) {
|
2019-02-28 03:23:17 -05:00
|
|
|
if (this.canCurrentUserFork && !this.canModifyBlob) {
|
2018-06-21 08:22:40 -04:00
|
|
|
evt.preventDefault();
|
|
|
|
this.$emit('showForkMessage');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2020-04-03 05:09:31 -04:00
|
|
|
<gl-deprecated-button
|
2019-05-31 22:12:45 -04:00
|
|
|
v-gl-tooltip.top
|
2019-02-28 09:14:15 -05:00
|
|
|
:href="editPath"
|
|
|
|
:title="__('Edit file')"
|
|
|
|
class="js-edit-blob"
|
|
|
|
@click.native="handleEditClick"
|
|
|
|
>
|
|
|
|
<icon name="pencil" />
|
2020-04-03 05:09:31 -04:00
|
|
|
</gl-deprecated-button>
|
2018-06-21 08:22:40 -04:00
|
|
|
</template>
|