gitlab-org--gitlab-foss/app/assets/javascripts/diffs/components/edit_button.vue
Justin Boyson 3c6dc87ea8 Make tooltips consistently render on top
On edit-button simply set position to top.
Made this change directly in template since edit-button
is only used in one place.

Had to wrap the comments toggle button in span tag to make
tooltip show even when disabled as per bootstrap-vue docs.
https://bootstrap-vue.js.org/docs/components/tooltip#overview

Note: Also changexc button to gl-buttonto be consistent
with rest of file.
2019-06-01 02:12:45 +00:00

49 lines
908 B
Vue

<script>
import { GlTooltipDirective, GlButton } from '@gitlab/ui';
import Icon from '~/vue_shared/components/icon.vue';
export default {
components: {
GlButton,
Icon,
},
directives: {
GlTooltip: GlTooltipDirective,
},
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) {
evt.preventDefault();
this.$emit('showForkMessage');
}
},
},
};
</script>
<template>
<gl-button
v-gl-tooltip.top
:href="editPath"
:title="__('Edit file')"
class="js-edit-blob"
@click.native="handleEditClick"
>
<icon name="pencil" />
</gl-button>
</template>