Merge branch 'release/0.16' of https://github.com/tainacan/tainacan into release/0.16
This commit is contained in:
commit
73d0c7311d
|
@ -291,7 +291,7 @@ class REST_Item_Metadata_Controller extends REST_Controller {
|
|||
$endpoint_args['parent_meta_id'] = [
|
||||
'type' => 'array/string/object/integer',
|
||||
'items' => ['type' => 'array/string/object/integer'],
|
||||
'description' => __('The parent meta ID for group children item metadatas')
|
||||
'description' => __('The parent meta ID for the item metadata children group')
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -325,7 +325,7 @@ class Bulk_Edit_Process extends Generic_Process {
|
|||
}
|
||||
}
|
||||
|
||||
$this->add_error_log( __('Not possible to copy permission for different types', 'tainacan') );
|
||||
$this->add_error_log( __('Not possible to copy metadata values of different types', 'tainacan') );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,10 @@
|
|||
<span class="icon is-small">
|
||||
<i class="tainacan-icon has-text-secondary tainacan-icon-add"/>
|
||||
</span>
|
||||
{{ $i18n.get('label_add_value') }}
|
||||
{{ $i18n.get('label_add_value') }}
|
||||
<span class="icon">
|
||||
<i class="tainacan-icon has-text-secondary tainacan-icon-loading"/>
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
@ -102,6 +105,7 @@
|
|||
data() {
|
||||
return {
|
||||
isRemovingGroup: false,
|
||||
isCreatingGroup: false,
|
||||
children: [],
|
||||
collapseAllChildren: true,
|
||||
childItemMetadataGroups: []
|
||||
|
@ -226,6 +230,15 @@
|
|||
this.childItemMetadataGroups[groupIndex][index].collapse = !event;
|
||||
},
|
||||
addGroup() {
|
||||
|
||||
this.isCreatingGroup = true;
|
||||
|
||||
// Sends value to api so we can obtain the parent_meta_id
|
||||
eventBusItemMetadata.fetchCompoundFirstParentMetaId({
|
||||
itemId: this.itemMetadatum.item.id,
|
||||
metadatumId: this.itemMetadatum.metadatum.id
|
||||
}).then((parentMetaId) => {
|
||||
|
||||
// Create a new placeholder parent_meta_id group here.
|
||||
let newEmptyGroup = [];
|
||||
|
||||
|
@ -238,7 +251,7 @@
|
|||
let childObject = {
|
||||
item: this.itemMetadatum.item,
|
||||
metadatum: child,
|
||||
parent_meta_id: 0,
|
||||
parent_meta_id: parentMetaId,
|
||||
value: '',
|
||||
value_as_html: '',
|
||||
value_as_string: '',
|
||||
|
@ -248,12 +261,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
// Sends value to api so we can obtain the parent_meta_id
|
||||
eventBusItemMetadata.$emit('input', {
|
||||
itemId: this.itemMetadatum.item.id,
|
||||
metadatumId: newEmptyGroup[0].metadatum.id,
|
||||
values: newEmptyGroup[0].value,
|
||||
parentMetaId: newEmptyGroup[0].parent_meta_id
|
||||
this.isCreatingGroup = true;
|
||||
});
|
||||
},
|
||||
removeGroup(groupIndex) {
|
||||
|
|
|
@ -16,7 +16,7 @@ class Compound extends Metadata_Type {
|
|||
// call metadatum type constructor
|
||||
parent::__construct();
|
||||
$this->set_name( __('Compound', 'tainacan') );
|
||||
$this->set_description( __('A compound metadata can have different types with groups of values.', 'tainacan') );
|
||||
$this->set_description( __('A compound metadatum can have groups of values of different types.', 'tainacan') );
|
||||
$this->set_primitive_type('compound');
|
||||
$this->set_component('tainacan-compound');
|
||||
$this->set_form_component('tainacan-form-compound');
|
||||
|
|
|
@ -87,6 +87,9 @@ export const eventBusItemMetadata = new Vue({
|
|||
},
|
||||
clearAllErrors() {
|
||||
this.errors = [];
|
||||
},
|
||||
fetchCompoundFirstParentMetaId({ itemId, metadatumId }) {
|
||||
return this.$store.dispatch('item/fetchCompoundFirstParentMetaId', { item_id: itemId, metadatum_id: metadatumId });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -40,6 +40,27 @@ export const fetchItemMetadata = ({ commit }, item_id) => {
|
|||
});
|
||||
};
|
||||
|
||||
|
||||
// Actions related to Item's metadata
|
||||
export const fetchCompoundFirstParentMetaId = ({ commit }, { item_id, metadatum_id }) => {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.tainacan.patch(`/item/${item_id}/metadata/${metadatum_id}`, { value: [] })
|
||||
.then( res => {
|
||||
const parentMetaId = res.data.parent_meta_id;
|
||||
resolve(parentMetaId);
|
||||
})
|
||||
.catch( error => {
|
||||
reject({
|
||||
error: error.response.data.errors,
|
||||
error_message: error.response.data.error_message,
|
||||
item_metadata: error.response.data.item_metadata
|
||||
});
|
||||
})
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
export const deleteItemMetadataGroup = ({ commit }, { item_id, metadatum_id, parent_meta_id }) => {
|
||||
|
||||
return new Promise((resolve) => {
|
||||
|
|
|
@ -483,7 +483,7 @@ registerBlockType('tainacan/faceted-search', {
|
|||
/>
|
||||
<ToggleControl
|
||||
label={__('Start with Filters hidden', 'tainacan')}
|
||||
help={ startWithFiltersHidden ? __('Render the list with filters hidden at first" button', 'tainacan') : __('Toggle to render the list with filters visible at first', 'tainacan')}
|
||||
help={ startWithFiltersHidden ? __('Render the list with filters hidden at first', 'tainacan') : __('Toggle to render the list with filters visible at first', 'tainacan')}
|
||||
checked={ startWithFiltersHidden }
|
||||
onChange={ ( isChecked ) => {
|
||||
startWithFiltersHidden = isChecked;
|
||||
|
@ -493,7 +493,7 @@ registerBlockType('tainacan/faceted-search', {
|
|||
/>
|
||||
<ToggleControl
|
||||
label={__('Filters as a Modal', 'tainacan')}
|
||||
help={ filtersAsModal ? __('Render the filters area as modal instead of a collapse" button', 'tainacan') : __('Toggle to show filters list as a collapse instead of a modal', 'tainacan')}
|
||||
help={ filtersAsModal ? __('Render the filters area as modal instead of a side panel" button', 'tainacan') : __('Toggle to show filters list as a side panel instead of a modal', 'tainacan')}
|
||||
checked={ filtersAsModal }
|
||||
onChange={ ( isChecked ) => {
|
||||
filtersAsModal = isChecked;
|
||||
|
|
Loading…
Reference in New Issue