Commit 9b93a3f2 authored by Phil Hughes's avatar Phil Hughes

Use the tooltip mixin

[ci skip]
parent f53d703f
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
}, },
mounted() { mounted() {
/* /*
GLForm class handles all the toolbar buttons etc. GLForm class handles all the toolbar buttons
*/ */
return new gl.GLForm($(this.$refs['gl-form'])); return new gl.GLForm($(this.$refs['gl-form']));
}, },
......
<script> <script>
import tooltipMixin from '../../mixins/tooltip';
import toolbarButton from './toolbar_button.vue'; import toolbarButton from './toolbar_button.vue';
export default { export default {
mixins: [
tooltipMixin,
],
props: { props: {
previewMarkdown: { previewMarkdown: {
type: Boolean, type: Boolean,
...@@ -82,9 +86,9 @@ ...@@ -82,9 +86,9 @@
class="toolbar-btn js-zen-enter" class="toolbar-btn js-zen-enter"
data-container="body" data-container="body"
tabindex="-1" tabindex="-1"
data-toggle="tooltip"
title="Go full screen" title="Go full screen"
type="button"> type="button"
ref="tooltip">
<i <i
aria-hidden="true" aria-hidden="true"
class="fa fa-arrows-alt fa-fw"> class="fa fa-arrows-alt fa-fw">
......
<script> <script>
import tooltipMixin from '../../mixins/tooltip';
export default { export default {
mixins: [
tooltipMixin,
],
props: { props: {
buttonTitle: { buttonTitle: {
type: String, type: String,
...@@ -24,6 +29,11 @@ ...@@ -24,6 +29,11 @@
default: false, default: false,
}, },
}, },
computed: {
iconClass() {
return `fa-${this.icon}`;
},
},
}; };
</script> </script>
...@@ -32,17 +42,17 @@ ...@@ -32,17 +42,17 @@
type="button" type="button"
class="toolbar-btn js-md hidden-xs" class="toolbar-btn js-md hidden-xs"
tabindex="-1" tabindex="-1"
ref="tooltip"
data-container="body"
:data-md-tag="tag" :data-md-tag="tag"
:data-md-block="tagBlock" :data-md-block="tagBlock"
:data-md-prepend="prepend" :data-md-prepend="prepend"
data-container="body"
data-toggle="tooltip"
:title="buttonTitle" :title="buttonTitle"
:aria-label="buttonTitle"> :aria-label="buttonTitle">
<i <i
aria-hidden="true" aria-hidden="true"
class="fa fa-fw" class="fa fa-fw"
:class="'fa-' + icon"> :class="iconClass">
</i> </i>
</button> </button>
</template> </template>
export default { export default {
mounted() { mounted() {
$(this.$refs.tooltip).tooltip(); this.$nextTick(() => {
$(this.$refs.tooltip).tooltip();
});
}, },
updated() { updated() {
$(this.$refs.tooltip).tooltip('fixTitle'); this.$nextTick(() => {
$(this.$refs.tooltip).tooltip('fixTitle');
});
},
beforeDestroy() {
$(this.$refs.tooltip).tooltip('destroy');
}, },
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment