-
+
+
+
+
+
+
+
+ @click.prevent="tryToRemoveTerm(term)">
- { return },
+ onConfirm: () => { this.removeTerm(term);},
+ cancelText: this.$i18n.get('cancel'),
+ confirmText: this.$i18n.get('continue'),
+ type: 'is-secondary'
+ });
+ } else{
+ this.removeTerm(term);
+ }
+
+ },
removeTerm(term) {
+
+ // If all checks passed, term can be deleted
if (term.id == 'new') {
- let index = this.termsList.findIndex(deletedTerm => deletedTerm.id == 'new');
+ let index = this.orderedTermsList.findIndex(deletedTerm => deletedTerm.id == 'new');
if (index >= 0) {
- this.termsList.splice(index, 1);
+ this.orderedTermsList.splice(index, 1);
}
if (this.openedTermId == 'new')
this.openedTermId = '';
delete this.editForms['new'];
} else {
+
this.deleteTerm({categoryId: this.categoryId, termId: term.id})
.then(() => {
@@ -173,20 +222,38 @@ export default {
.catch((error) => {
this.$console.log(error);
});
- }
+
+ // Updates parent IDs for orphans
+ for (let orphanTerm of this.termsList) {
+ if (orphanTerm.parent == term.id) {
+ this.updateTerm({
+ categoryId: this.categoryId,
+ termId: orphanTerm.id,
+ index: '',
+ name: orphanTerm.name,
+ description: orphanTerm.description,
+ parent: term.parent
+ })
+ .catch((error) => {
+ this.$console.log(error);
+ });
+ }
+ }
+ }
},
onTermEditionFinished() {
- let index = this.termsList.findIndex(deletedTerm => deletedTerm.id == 'new');
+ let index = this.orderedTermsList.findIndex(deletedTerm => deletedTerm.id == 'new');
if (index >= 0) {
- this.termsList.splice(index, 1);
+ this.orderedTermsList.splice(index, 1);
}
this.formWithErrors = '';
- this.$delete(this.editForms, this.openedTermId);
+ delete this.editForms[this.openedTermId];
this.openedTermId = '';
+ this.$console.log("EMITED");
},
onTermEditionCanceled() {
this.formWithErrors = '';
- this.$delete(this.editForms, this.openedTermId);
+ delete this.editForms[this.openedTermId];
this.openedTermId = '';
},
buildOrderedTermsList(parentId, termDepth) {
@@ -291,6 +358,9 @@ export default {
position: relative;
i, i:before { font-size: 20px; }
}
+ .button {
+ margin-right: 1em;
+ }
}
&.not-sortable-item, &.not-sortable-item:hover {
@@ -313,19 +383,19 @@ export default {
}
}
- .term-item:hover:not(.not-sortable-item) {
- background-color: $secondary;
- border-color: $secondary;
- color: white !important;
+ // .term-item:hover:not(.not-sortable-item) {
+ // background-color: $secondary;
+ // border-color: $secondary;
+ // color: white !important;
- .label-details, .icon, .not-saved {
- color: white !important;
- }
+ // .label-details, .icon, .not-saved {
+ // color: white !important;
+ // }
- .grip-icon {
- fill: white;
- }
- }
+ // .grip-icon {
+ // fill: white;
+ // }
+ // }
diff --git a/src/admin/scss/tainacan-admin.scss b/src/admin/scss/tainacan-admin.scss
index b194d28fe..430f4252d 100644
--- a/src/admin/scss/tainacan-admin.scss
+++ b/src/admin/scss/tainacan-admin.scss
@@ -156,11 +156,17 @@ html {
.button {
border-radius: 6px !important;
font-weight: normal;
- height: 30px !important;
padding: 2px 15px !important;
margin-top: 0px !important;
margin-bottom: 0px !important;
}
+.button.is-small {
+ height: 26px !important;
+}
+.button:not(.is-small):not(.is-medium):not(.is-large) {
+ height: 30px !important;
+}
+
.select {
padding-top: 0px !important;
select {
diff --git a/src/admin/tainacan-admin-i18n.php b/src/admin/tainacan-admin-i18n.php
index f37fa44c9..38bae24a3 100644
--- a/src/admin/tainacan-admin-i18n.php
+++ b/src/admin/tainacan-admin-i18n.php
@@ -15,6 +15,8 @@ return [
'filter' => __( 'Filter', 'tainacan' ),
'category' => __( 'Category', 'tainacan' ),
'event' => __( 'Event', 'tainacan' ),
+ 'term' => __( 'Term', 'tainacan' ),
+ 'terms' => __( 'Terms', 'tainacan' ),
// Actions
'edit' => __( 'Edit', 'tainacan' ),
@@ -122,8 +124,10 @@ return [
'label_collection_filters' => __( 'Collection Filters', 'tainacan' ),
'label_parent_term' => __( 'Parent Term', 'tainacan' ),
'label_new_term' => __( 'New Term', 'tainacan' ),
+ 'label_new_child' => __( 'New Child', 'tainacan' ),
'label_category_terms' => __( 'Category Terms', 'tainacan' ),
'label_no_parent_term' => __( 'No parent term', 'tainacan' ),
+ 'label_term_without_name' => __( 'Term without name', 'tainacan' ),
// Instructions. More complex sentences to guide user and placeholders
'instruction_dragndrop_fields_collection' => __( 'Drag and drop Fields here to Collection.', 'tainacan' ),
@@ -167,6 +171,7 @@ return [
'info_warning_filters_not_saved' => __('Are you sure? There are filters not saved, changes will be lost.', 'tainacan'),
'info_no_description_provided' => __('No description provided.', 'tainacan'),
'info_warning_terms_not_saved' => __('Are you sure? There are terms not saved, changes will be lost.', 'tainacan'),
+ 'info_warning_orphan_terms' => __('Are you sure? This term is parent of other terms. These will be converted to root terms.', 'tainacan'),
// Tainacan Field Types
'tainacan-text' => __( 'Text', 'tainacan' ),
diff --git a/webpack.config.js b/webpack.config.js
index 60fbadc96..a9a943bc4 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -77,13 +77,13 @@ if (process.env.NODE_ENV === 'production') {
NODE_ENV: '"production"'
}
}),
- new UglifyJsPlugin({
- parallel: true,
- sourceMap: false, //Changes to true to use vue dev tools
- }),
- new webpack.LoaderOptionsPlugin({
- minimize: true
- })
+ // new UglifyJsPlugin({
+ // parallel: true,
+ // sourceMap: false, //Changes to true to use vue dev tools
+ // }),
+ // new webpack.LoaderOptionsPlugin({
+ // minimize: true
+ // })
]);
module.exports.resolve.alias = {
'vue$': 'vue/dist/vue.min.js'