56 lines
1.6 KiB
Vue
Raw Normal View History

2017-05-22 13:32:52 -04:00
<template lang="pug">
2017-05-26 22:43:34 -04:00
transition(:duration="400")
.modal(v-show='isShown', v-cloak)
transition(name='modal-background')
.modal-background(v-show='isShown')
.modal-container
transition(name='modal-content')
.modal-content(v-show='isShown')
header.is-blue
span {{ $t('modal.anchortitle') }}
2017-05-26 22:43:34 -04:00
section
p.control.is-fullwidth
input.input(type='text', ref='anchorURLinput', v-model='anchorURL')
footer
a.button.is-grey.is-outlined(v-on:click='cancel') {{ $t('modal.discard') }}
a.button.is-blue(v-clipboard='anchorURL', @success="clipboardSuccess", @error="clipboardError") {{ $t('modal.copyclipboard') }}
2017-05-20 23:21:16 -04:00
</template>
<script>
export default {
name: 'anchor',
data () {
2017-05-22 13:32:52 -04:00
return {}
},
computed: {
anchorURL () {
return window.location.href.split('#')[0] + '#' + this.$store.state.anchor.hash
},
isShown () {
return this.$store.state.anchor.shown
}
},
methods: {
cancel () {
this.$store.dispatch('anchor/close')
2017-05-22 13:32:52 -04:00
},
clipboardSuccess () {
this.$store.dispatch('alert', {
style: 'blue',
2017-07-08 17:33:09 -04:00
icon: 'business_notes',
msg: this.$t('modal.anchorsuccess')
2017-05-22 13:32:52 -04:00
})
this.$store.dispatch('anchor/close')
2017-05-22 13:32:52 -04:00
},
clipboardError () {
this.$store.dispatch('alert', {
style: 'red',
2017-07-08 17:33:09 -04:00
icon: 'business_notes',
msg: this.$t('modal.anchorerror')
2017-05-22 13:32:52 -04:00
})
this.$refs.anchorURLinput.select()
2017-05-20 23:21:16 -04:00
}
}
}
</script>