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

37 lines
719 B
Vue
Raw Normal View History

2018-11-08 19:23:39 +05:30
<script>
export default {
props: {
editPath: {
type: String,
required: true,
},
canCurrentUserFork: {
type: Boolean,
required: true,
},
canModifyBlob: {
type: Boolean,
required: false,
default: false,
},
},
methods: {
handleEditClick(evt) {
if (!this.canCurrentUserFork || this.canModifyBlob) {
// if we can Edit, do default Edit button behavior
return;
}
if (this.canCurrentUserFork) {
evt.preventDefault();
this.$emit('showForkMessage');
}
},
},
};
</script>
<template>
2019-02-13 22:33:31 +05:30
<a :href="editPath" class="btn btn-default js-edit-blob" @click="handleEditClick"> Edit </a>
2018-11-08 19:23:39 +05:30
</template>