+
Add Term
@@ -26,46 +43,64 @@
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..17234b9
--- /dev/null
+++ b/resources/js/components/Term/mixins/InlineEdit.js
@@ -0,0 +1,45 @@
+import state from '../../../states/concept';
+
+export default {
+ data() {
+ return {
+ state,
+ };
+ },
+ computed: {
+ inlineEdit() {
+ return this.inEdit;
+ },
+ },
+ methods: {
+ conceptEditMode: function () {
+ return this.state.editMode;
+ },
+ 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.inlineEdit || this.conceptEditMode()) {
+ return;
+ }
+ if (this.isDirty()) {
+ this.showCancelModal();
+ return;
+ }
+
+ this.confirmCancel();
+ },
+ },
+};
diff --git a/resources/js/config/catgegories.js b/resources/js/config/categories.js
similarity index 100%
rename from resources/js/config/catgegories.js
rename to resources/js/config/categories.js
diff --git a/resources/views/concepts/show.blade.php b/resources/views/concepts/show.blade.php
index 492782d..bf23163 100644
--- a/resources/views/concepts/show.blade.php
+++ b/resources/views/concepts/show.blade.php
@@ -31,6 +31,7 @@
id="concept"
:concept-props="{{ $concept }}"
:term-props="{{ $concept->terms }}"
+ :categories-props="{{ $concept->conceptCategories }}"
:sources-props="{{ $concept->sources }}"
can-edit-vocabulary="{{ json_encode($isVocabularyEditor) }}"
>
diff --git a/routes/api.php b/routes/api.php
index 3c74c9d..a8b3ec3 100644
--- a/routes/api.php
+++ b/routes/api.php
@@ -24,9 +24,7 @@
Route::put('concepts/{id}/relate_concept', 'ConceptController@relateConcepts');
Route::put('concepts/{id}/deprecate', 'API\ConceptController@deprecate');
-Route::apiResource('concepts', 'API\ConceptController')->except([
- 'update',
-]);
+Route::apiResource('concepts', 'API\ConceptController');
Route::get('concepts_summary', function () {
// Return only the preferred term