Merge branch 'develop' of https://github.com/tainacan/tainacan into develop
This commit is contained in:
commit
e327992dca
|
@ -125,6 +125,8 @@ class Admin {
|
|||
wp_enqueue_script('jcrop');
|
||||
wp_enqueue_script( 'customize-controls' );
|
||||
|
||||
do_action('tainacan-enqueue-admin-scripts');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -384,7 +384,6 @@ export default {
|
|||
.then(() => {
|
||||
// Reload Available Metadatum Types List
|
||||
this.updateListOfMetadata();
|
||||
|
||||
})
|
||||
.catch((error) => { this.$console.log(error)});
|
||||
|
||||
|
@ -444,7 +443,7 @@ export default {
|
|||
}
|
||||
|
||||
},
|
||||
created() {
|
||||
mounted() {
|
||||
|
||||
this.isRepositoryLevel = this.$route.name == 'FiltersPage' ? true : false;
|
||||
if (this.isRepositoryLevel)
|
||||
|
|
|
@ -445,7 +445,8 @@ export default {
|
|||
'updateMetadata',
|
||||
'updateCollectionMetadataOrder',
|
||||
'fetchMetadatumMappers',
|
||||
'updateMetadataMapperMetadata'
|
||||
'updateMetadataMapperMetadata',
|
||||
'cleanMetadata'
|
||||
]),
|
||||
...mapGetters('metadata',[
|
||||
'getMetadatumTypes',
|
||||
|
@ -746,7 +747,6 @@ export default {
|
|||
else
|
||||
this.collectionId = this.$route.params.collectionId;
|
||||
|
||||
|
||||
this.fetchMetadata({collectionId: this.collectionId, isRepositoryLevel: this.isRepositoryLevel, isContextEdit: true, includeDisabled: true})
|
||||
.then(() => {
|
||||
this.isLoadingMetadata = false;
|
||||
|
@ -756,7 +756,8 @@ export default {
|
|||
});
|
||||
}
|
||||
},
|
||||
created() {
|
||||
mounted() {
|
||||
this.cleanMetadata();
|
||||
this.isLoadingMetadatumTypes = true;
|
||||
this.isLoadingMetadata = true;
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ const routes = [
|
|||
{ path: '/taxonomies', name: 'Page', component: Page, meta: {title: i18nGet('title_taxonomies_page'), icon: 'shape'} },
|
||||
{ path: '/taxonomies/new', name: 'TaxonomyCreationForm', component: TaxonomyEditionForm, meta: {title: i18nGet('title_create_taxonomy_page'), icon: 'shape'} },
|
||||
{ path: '/taxonomies/:taxonomyId/edit', name: 'TaxonomyEditionForm', component: TaxonomyEditionForm, meta: {title: i18nGet('title_taxonomy_edition_page'), icon: 'shape'} },
|
||||
{ path: '/taxonomies/:taxonomyId', name: 'TaxonomyPage', component: TaxonomyPage, meta: {title: i18nGet('title_taxonomy_page'), icon: 'shape'} },
|
||||
{ path: '/taxonomies/:taxonomyId', redirect: '/taxonomies/:taxonomyId/edit' },
|
||||
|
||||
{ path: '/events', name: 'EventsPage', component: EventsPage, meta: {title: i18nGet('title_repository_events_page'), icon: 'flash'} },
|
||||
{ path: '/events/:eventId', name: 'EventPage', component: EventPage, meta: {title: i18nGet('title_event_page'), icon: 'flash'} },
|
||||
|
|
|
@ -169,6 +169,7 @@ export default {
|
|||
methods: {
|
||||
...mapActions('collection', [
|
||||
'fetchCollections',
|
||||
'cleanCollections'
|
||||
]),
|
||||
...mapActions('metadata', [
|
||||
'fetchMetadatumMappers'
|
||||
|
@ -201,7 +202,8 @@ export default {
|
|||
this.page = page;
|
||||
this.loadCollections();
|
||||
},
|
||||
loadCollections() {
|
||||
loadCollections() {
|
||||
this.cleanCollections();
|
||||
this.isLoading = true;
|
||||
this.fetchCollections({ 'page': this.page, 'collectionsPerPage': this.collectionsPerPage, 'status': this.status })
|
||||
.then((res) => {
|
||||
|
|
|
@ -144,7 +144,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
if(this.filter.max_options && (this.options.length >= this.filter.max_options || hasChildren)){
|
||||
if (this.filter.max_options && (this.options.length >= this.filter.max_options || hasChildren)) {
|
||||
if(this.options.length > this.filter.max_options){
|
||||
this.options.splice(this.filter.max_options);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div>
|
||||
<component
|
||||
:disabled="disabled"
|
||||
:is="getComponent()"
|
||||
:is="getComponent"
|
||||
:maxtags="maxtags"
|
||||
v-model="valueComponent"
|
||||
:allow-select-to-create="allowSelectToCreate"
|
||||
|
@ -10,9 +10,15 @@
|
|||
:terms="terms"
|
||||
:taxonomy-id="taxonomy"
|
||||
:options="getOptions(0)"/>
|
||||
<a
|
||||
class="add-new-term"
|
||||
v-if="(getComponent == 'tainacan-taxonomy-checkbox' || getComponent == 'tainacan-taxonomy-radio') && terms.length < totalTerms"
|
||||
@click="getTermsFromTaxonomy()">
|
||||
{{ $i18n.get('label_view_more') + ' (' + Number(totalTerms - terms.length) + ' ' + $i18n.get('terms') + ')' }}
|
||||
</a>
|
||||
<add-new-term
|
||||
class="add-new-term"
|
||||
v-if="getComponent() !== 'tainacan-taxonomy-tag-input' && allowNew"
|
||||
v-if="getComponent !== 'tainacan-taxonomy-tag-input' && allowNew"
|
||||
:taxonomy_id="taxonomy"
|
||||
:metadatum="metadatum"
|
||||
:item_id="metadatum.item.id"
|
||||
|
@ -63,6 +69,9 @@
|
|||
collectionId: '',
|
||||
taxonomy: '',
|
||||
terms:[], // object with names
|
||||
totalTerms: 0,
|
||||
offset: 0,
|
||||
termsNumber: 40
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
@ -87,17 +96,29 @@
|
|||
maxtags: '',
|
||||
allowSelectToCreate: false,
|
||||
},
|
||||
methods: {
|
||||
getComponent(){
|
||||
computed: {
|
||||
getComponent() {
|
||||
if(this.forcedComponentType){
|
||||
return this.forcedComponentType;
|
||||
} else if( this.metadatum.metadatum
|
||||
&& this.metadatum.metadatum.metadata_type_options && this.metadatum.metadatum.metadata_type_options.input_type ){
|
||||
return this.metadatum.metadatum.metadata_type_options.input_type;
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getTermsFromTaxonomy(){
|
||||
axios.get('/taxonomy/' + this.taxonomy + '/terms?hideempty=0&order=asc' ).then( res => {
|
||||
let endpoint = '/taxonomy/' + this.taxonomy + '/terms?hideempty=0&order=asc';
|
||||
|
||||
if (this.getComponent == 'tainacan-taxonomy-checkbox' || this.getComponent == 'tainacan-taxonomy-radio')
|
||||
endpoint = endpoint + '&number=' + this.termsNumber + '&offset=' + this.offset;
|
||||
|
||||
axios.get(endpoint)
|
||||
.then( res => {
|
||||
if (this.getComponent == 'tainacan-taxonomy-checkbox' || this.getComponent == 'tainacan-taxonomy-radio') {
|
||||
this.totalTerms = Number(res.headers['x-wp-total']);
|
||||
this.offset += this.termsNumber;
|
||||
}
|
||||
for (let item of res.data) {
|
||||
this.terms.push( item );
|
||||
}
|
||||
|
@ -164,5 +185,6 @@
|
|||
.add-new-term{
|
||||
margin-top: 15px;
|
||||
margin-bottom: 30px;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
</style>
|
|
@ -28,7 +28,7 @@
|
|||
},
|
||||
data(){
|
||||
return {
|
||||
checked: []
|
||||
checked: [],
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
...mapGetters('taxonomy', [
|
||||
'getTerms'
|
||||
]),
|
||||
autoCompleteTerm: _.debounce( function(value){
|
||||
autoCompleteTerm: _.debounce( function(value) {
|
||||
this.termList = [];
|
||||
this.labels = [];
|
||||
this.isFetching = true;
|
||||
|
|
|
@ -110,7 +110,6 @@ export const deleteItem = ({ commit }, { itemId, isPermanently }) => {
|
|||
};
|
||||
|
||||
export const fetchCollections = ({commit} , { page, collectionsPerPage, status }) => {
|
||||
commit('cleanCollections');
|
||||
return new Promise((resolve, reject) => {
|
||||
let endpoint = '/collections?paged='+page+'&perpage='+collectionsPerPage+'&context=edit';
|
||||
|
||||
|
@ -130,6 +129,10 @@ export const fetchCollections = ({commit} , { page, collectionsPerPage, status }
|
|||
});
|
||||
};
|
||||
|
||||
export const cleanCollections = ({ commit }) => {
|
||||
commit('cleanCollections');
|
||||
};
|
||||
|
||||
export const fetchCollection = ({ commit }, id) => {
|
||||
commit('cleanCollection');
|
||||
return new Promise((resolve, reject) =>{
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import axios from '../../../axios/axios';
|
||||
|
||||
export const fetchMetadata = ({commit}, {collectionId, isRepositoryLevel, isContextEdit, includeDisabled}) => {
|
||||
commit('cleanMetadata');
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
let endpoint = '';
|
||||
|
@ -25,7 +24,6 @@ export const fetchMetadata = ({commit}, {collectionId, isRepositoryLevel, isCont
|
|||
resolve(metadata);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
|
@ -122,6 +120,10 @@ export const deleteMetadatum = ({commit}, {collectionId, metadatumId, isReposito
|
|||
});
|
||||
};
|
||||
|
||||
export const cleanMetadata = ({commit}) => {
|
||||
commit('cleanMetadata');
|
||||
};
|
||||
|
||||
export const updateCollectionMetadataOrder = ({ commit }, {collectionId, metadataOrder}) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.tainacan.patch('/collections/' + collectionId, {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
export const getMetadata = state => {
|
||||
|
||||
return state.metadata;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue