Registers term-edition-modal globally on admin js, so that item-submission js does not use it and thus do not require customizer js.
This commit is contained in:
parent
de7537d63f
commit
ce387fb019
|
@ -41,12 +41,26 @@
|
|||
{{ $i18n.get('label_new_term') }}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<b-modal
|
||||
v-model="isTermCreationModalOpen"
|
||||
trap-focus
|
||||
aria-role="dialog"
|
||||
aria-modal
|
||||
:can-cancel="['outside', 'escape']">
|
||||
<term-edition-form
|
||||
:taxonomy-id="taxonomyId"
|
||||
:edit-form="{ id: 'new', name: newTermName ? newTermName : '' }"
|
||||
:is-modal="true"
|
||||
@onEditionFinished="($event) => addRecentlyCreatedTerm($event.term)"
|
||||
@onEditionCanceled="() => $console.log('Edition canceled')"
|
||||
@onErrorFound="($event) => $console.log('Form with errors: ' + $event)" />
|
||||
</b-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import TainacanTaxonomyTagInput from './TaxonomyTaginput.vue';
|
||||
import TermEditionForm from '../../edition/term-edition-form.vue';
|
||||
import CheckboxRadioMetadataInput from '../../other/checkbox-radio-metadata-input.vue';
|
||||
import { tainacan as axios } from '../../../js/axios.js';
|
||||
|
||||
|
@ -62,6 +76,8 @@
|
|||
forcedComponentType: '',
|
||||
maxtags: '',
|
||||
allowSelectToCreate: false,
|
||||
isTermCreationModalOpen: false,
|
||||
newTermName: ''
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
|
@ -142,23 +158,8 @@
|
|||
}
|
||||
},
|
||||
openTermCreationModal(newTerm) {
|
||||
this.$buefy.modal.open({
|
||||
parent: this,
|
||||
component: TermEditionForm,
|
||||
canCancel: ['outside', 'escape'],
|
||||
props: {
|
||||
taxonomyId: this.taxonomyId,
|
||||
editForm: { id: 'new', name: newTerm.name ? newTerm.name : '' },
|
||||
isModal: true
|
||||
},
|
||||
events: {
|
||||
onEditionFinished: ($event) => this.addRecentlyCreatedTerm($event.term),
|
||||
onEditionCanceled: () => this.$console.log('Edition canceled'),
|
||||
onErrorFound: ($event) => this.$console.log('Form with errors: ' + $event)
|
||||
},
|
||||
trapFocus: true
|
||||
});
|
||||
|
||||
this.newTermName = newTerm.name;
|
||||
this.isTermCreationModalOpen = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,9 @@ import FilterNumericListInterval from '../components/filter-types/numeric-list-i
|
|||
import FilterTaxonomyCheckbox from '../components/filter-types/taxonomy/Checkbox.vue';
|
||||
import FilterTaxonomyTaginput from '../components/filter-types/taxonomy/Taginput.vue';
|
||||
|
||||
// Term edition form must be imported here so that it is not necessary on item-submission bundle
|
||||
import TermEditionForm from '../components/edition/term-edition-form.vue';
|
||||
|
||||
import FormFilterNumeric from '../components/filter-types/numeric/FormNumeric.vue';
|
||||
import FormFilterNumericInterval from '../components/filter-types/numeric-interval/FormNumericInterval.vue';
|
||||
import FormFilterNumericListInterval from '../components/filter-types/numeric-list-interval/FormNumericListInterval.vue';
|
||||
|
@ -104,6 +107,7 @@ Vue.component('tainacan-form-taxonomy', FormTaxonomy);
|
|||
Vue.component('tainacan-form-selectbox', FormSelectbox);
|
||||
Vue.component('tainacan-form-numeric', FormNumeric);
|
||||
Vue.component('tainacan-form-user', FormUser);
|
||||
Vue.component('term-edition-form', TermEditionForm);
|
||||
|
||||
/* Filters */
|
||||
Vue.component('tainacan-filter-numeric', FilterNumeric);
|
||||
|
|
|
@ -168,7 +168,7 @@ function tainacan_blocks_register_tainacan_item_submission_form(){
|
|||
wp_register_script(
|
||||
'tainacan-item-submission',
|
||||
$TAINACAN_BASE_URL . '/assets/js/item_submission.js',
|
||||
['underscore', 'jcrop', 'media-editor', 'media-views', 'customize-controls'],
|
||||
['underscore'],
|
||||
TAINACAN_VERSION
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue