diff --git a/resources/js/components/Category/Editable.vue b/resources/js/components/Category/Editable.vue index 49b251c..7b7c10e 100644 --- a/resources/js/components/Category/Editable.vue +++ b/resources/js/components/Category/Editable.vue @@ -1,35 +1,52 @@ diff --git a/resources/js/components/Term/List.vue b/resources/js/components/Term/List.vue index da45c7b..e6c8fe3 100644 --- a/resources/js/components/Term/List.vue +++ b/resources/js/components/Term/List.vue @@ -23,7 +23,7 @@ > {{ term.text }} diff --git a/resources/js/components/Term/mixins/ConfirmDelete.js b/resources/js/components/Term/mixins/ConfirmDelete.js new file mode 100644 index 0000000..b9c53a2 --- /dev/null +++ b/resources/js/components/Term/mixins/ConfirmDelete.js @@ -0,0 +1,17 @@ +export default { + methods: { + showDeleteModal() { + this.$refs.deleteModal.show(); + }, + hideDeleteModal() { + this.$refs.deleteModal.hide(); + }, + confirmDelete() { + this.$emit('delete-term', this.termId, this.termIndex); + this.hideDeleteModal(); + }, + focusConfirmDeleteButton() { + this.$refs.confirmDeleteButton.focus(); + }, + }, +}; diff --git a/resources/js/components/Term/mixins/ConfirmPreferred.js b/resources/js/components/Term/mixins/ConfirmPreferred.js new file mode 100644 index 0000000..8a5bf2e --- /dev/null +++ b/resources/js/components/Term/mixins/ConfirmPreferred.js @@ -0,0 +1,17 @@ +export default { + methods: { + showPreferredModal() { + this.$refs.preferredModal.show(); + }, + hidePreferredModal() { + this.$refs.preferredModal.hide(); + }, + confirmPreferred() { + this.$emit('make-term-preferred', this.term, this.termIndex); + this.hidePreferredModal(); + }, + focusConfirmPreferredButton() { + this.$refs.confirmPreferredButton.focus(); + }, + }, +}; diff --git a/resources/js/components/Term/mixins/InlineEdit.js b/resources/js/components/Term/mixins/InlineEdit.js new file mode 100644 index 0000000..6328fc9 --- /dev/null +++ b/resources/js/components/Term/mixins/InlineEdit.js @@ -0,0 +1,33 @@ +export default { + computed: { + inlineEdit() { + return this.inEdit; + }, + }, + methods: { + showCancelModal() { + this.$refs.cancelModal.show(); + }, + hideCancelModal() { + this.$refs.cancelModal.hide(); + }, + confirmCancel() { + this.$emit('cancel-inline-edit', this.term, this.termIndex); + this.text = this.originalText; + this.resetTerm(); + this.hideCancelModal(); + }, + focusConfirmCancelButton() { + this.$refs.confirmCancelButton.focus(); + }, + cancelInlineEdit() { + if (this.isDirty()) { + this.showCancelModal(); + } else { + this.$emit('cancel-inline-edit', this.term, this.termIndex); + this.text = this.originalText; + this.resetTerm(); + } + }, + }, +};