Merge branch 'develop' of https://github.com/tainacan/tainacan into develop

This commit is contained in:
vnmedeiros 2020-04-22 16:54:25 -03:00
commit 006594d2de
19 changed files with 255 additions and 207 deletions

View File

@ -237,9 +237,7 @@ export default {
'updateItemDocument',
]),
...mapActions('bulkedition', [
'createEditGroup',
'createSequenceEditGroup',
'setStatusInBulk'
'createSequenceEditGroup'
]),
uploadFiles() {
@ -311,7 +309,7 @@ export default {
this.isCreatingSequenceEditGroup = true;
this.createSequenceEditGroup({
object: onlyItemIds,
collectionID: this.collectionId
collectionId: this.collectionId
}).then((group) => {
let sequenceId = group.id;
this.isCreatingSequenceEditGroup = false;
@ -330,7 +328,7 @@ export default {
totalItems: onlyItemIds.length,
selectedForBulk: onlyItemIds,
objectType: this.$i18n.get('items'),
collectionID: this.collectionId
collectionId: this.collectionId
},
width: 'calc(100% - (2 * var(--tainacan-one-column)))',
trapFocus: true

View File

@ -855,7 +855,11 @@ export default {
this.isLoading = true;
// Obtains current Item ID from Sequence
this.fetchItemIdInSequence({ collectionId: this.collectionId, sequenceId: this.sequenceId, itemPosition: this.itemPosition })
this.fetchItemIdInSequence({
collectionId: this.collectionId,
sequenceId: this.sequenceId,
itemPosition: this.itemPosition
})
.then(() => {
this.itemId = this.itemIdInSequence;
this.loadExistingItem();
@ -903,7 +907,11 @@ export default {
this.$userPrefs.set('sequence_' + this.sequenceId + '_position', this.itemPosition);
// Obtains current Item ID from Sequence
this.fetchItemIdInSequence({ collectionId: this.collectionId, sequenceId: this.sequenceId, itemPosition: this.itemPosition })
this.fetchItemIdInSequence({
collectionId: this.collectionId,
sequenceId: this.sequenceId,
itemPosition: this.itemPosition
})
.then(() => {
this.itemId = this.itemIdInSequence;
this.loadExistingItem();
@ -980,7 +988,6 @@ export default {
]),
...mapActions('bulkedition', [
'fetchItemIdInSequence',
'fetchGroup',
'fetchSequenceGroup'
]),
...mapGetters('bulkedition', [

View File

@ -1007,7 +1007,7 @@ export default {
'untrashItemsInBulk'
]),
...mapGetters('bulkedition', [
'getGroupID'
'getGroupId'
]),
...mapActions('item', [
'fetchItem'
@ -1042,7 +1042,7 @@ export default {
totalItems: Object.keys(this.queryAllItemsSelected).length ? this.totalItems : this.selectedItems.length,
selectedForBulk: Object.keys(this.queryAllItemsSelected).length ? this.queryAllItemsSelected : this.selectedItems,
objectType: this.$i18n.get('items'),
collectionID: this.$route.params.collectionId,
collectionId: this.$route.params.collectionId,
},
width: 'calc(100% - (2 * var(--tainacan-one-column)))',
trapFocus: true
@ -1051,9 +1051,9 @@ export default {
sequenceEditSelectedItems() {
this.createSequenceEditGroup({
object: Object.keys(this.queryAllItemsSelected).length ? this.queryAllItemsSelected : this.selectedItems,
collectionID: this.collectionId
collectionId: this.collectionId
}).then(() => {
let sequenceId = this.getGroupID();
let sequenceId = this.getGroupId();
this.$router.push(this.$routerHelper.getCollectionSequenceEditPath(this.collectionId, sequenceId, 1));
});
},
@ -1101,14 +1101,14 @@ export default {
this.$emit('updateIsLoading', this.isLoading);
this.createEditGroup({
collectionID: this.collectionId,
collectionId: this.collectionId,
object: [itemId]
}).then(() => {
let groupID = this.getGroupID();
let groupId = this.getGroupId();
this.untrashItemsInBulk({
collectionID: this.collectionId,
groupID: groupID
collectionId: this.collectionId,
groupId: groupId
}).then(() => {
this.$eventBusSearch.loadItems();
});
@ -1155,14 +1155,14 @@ export default {
this.$emit('updateIsLoading', this.isLoading);
this.createEditGroup({
collectionID: this.collectionId,
collectionId: this.collectionId,
object: Object.keys(this.queryAllItemsSelected).length ? this.queryAllItemsSelected : this.selectedItems
}).then(() => {
let groupID = this.getGroupID();
let groupId = this.getGroupId();
this.untrashItemsInBulk({
collectionID: this.collectionId,
groupID: groupID
collectionId: this.collectionId,
groupId: groupId
}).then(() => {
this.$eventBusSearch.loadItems();
});
@ -1185,22 +1185,22 @@ export default {
this.$emit('updateIsLoading', this.isLoading);
this.createEditGroup({
collectionID: this.collectionId,
collectionId: this.collectionId,
object: Object.keys(this.queryAllItemsSelected).length ? this.queryAllItemsSelected : this.selectedItems
}).then(() => {
let groupID = this.getGroupID();
let groupId = this.getGroupId();
if (this.isOnTrash) {
this.deleteItemsInBulk({
collectionID: this.collectionId,
groupID: groupID
collectionId: this.collectionId,
groupId: groupId
}).then(() => {
this.$eventBusSearch.loadItems();
});
} else {
this.trashItemsInBulk({
collectionID: this.collectionId,
groupID: groupID
collectionId: this.collectionId,
groupId: groupId
}).then(() => {
this.$eventBusSearch.loadItems();
});

View File

@ -510,7 +510,7 @@ export default {
}
.gray-icon .icon i::before,
.gray-icon i::before {
max-width: 26px;
max-width: 1.25em;
}
}

View File

@ -24,17 +24,17 @@
<b-select
:loading="metadataIsLoading"
:class="{'is-field-history': bulkEditionProcedures[criterion].isDone, 'hidden-select-arrow': !!bulkEditionProcedures[criterion].metadatumID}"
:disabled="!!bulkEditionProcedures[criterion].metadatumID || metadataIsLoading"
:class="{ 'is-field-history': bulkEditionProcedures[criterion].isDone, 'hidden-select-arrow': !!bulkEditionProcedures[criterion].metadatum }"
:disabled="!!bulkEditionProcedures[criterion].metadatum || metadataIsLoading"
class="tainacan-bulk-edition-field tainacan-bulk-edition-field-not-last"
:placeholder="$i18n.get('instruction_select_a_metadatum')"
@input="addToBulkEditionProcedures($event, 'metadatumID', criterion)">
@input="addToBulkEditionProcedures($event, 'metadatum', criterion)">
<template
v-for="(metadatum, index) in metadata">
<option
:key="index"
v-if="metadatum.id && metadatum.metadata_type_object.component !== 'tainacan-compound' && metadatum.parent <= 0"
:value="metadatum.id">
:value="metadatum">
{{ metadatum.name }}
</option>
<optgroup
@ -45,30 +45,32 @@
v-for="(childMetadatum, childIndex) of metadatum.metadata_type_options.children_objects"
:key="childIndex"
v-if="childMetadatum.id"
:value="childMetadatum.id">
:value="childMetadatum">
{{ childMetadatum.name }}
</option>
</optgroup>
</template>
<option value="status">
<option :value="{ id: 'status' }">
{{ $i18n.get('label_status') }}
</option>
<option value="comments">
<option :value="{ id: 'comments' }">
{{ $i18n.get('label_allow_comments') }}
</option>
<option :value="{ id: 'created_by' }">
{{ $i18n.get('label_created_by') }}
</option>
</b-select>
<b-select
:class="{'is-field-history': bulkEditionProcedures[criterion].isDone, 'hidden-select-arrow': !!bulkEditionProcedures[criterion].action }"
v-if="bulkEditionProcedures[criterion] &&
bulkEditionProcedures[criterion].metadatumID"
v-if="bulkEditionProcedures[criterion] && bulkEditionProcedures[criterion].metadatum"
:disabled="!!bulkEditionProcedures[criterion].action"
:value="bulkEditionProcedures[criterion].action ? bulkEditionProcedures[criterion].action : undefined"
class="tainacan-bulk-edition-field tainacan-bulk-edition-field-not-last"
:placeholder="$i18n.get('instruction_select_a_action')"
@input="addToBulkEditionProcedures($event, 'action', criterion)">
<option
v-for="(edtAct, key) in getValidEditionActions(bulkEditionProcedures[criterion].metadatumID)"
v-for="(edtAct, key) in getValidEditionActions(bulkEditionProcedures[criterion].metadatum)"
:value="edtAct"
:key="key">
{{ edtAct }}
@ -85,14 +87,13 @@
<!-- Replace -->
<template
v-if="bulkEditionProcedures[criterion] &&
bulkEditionProcedures[criterion].metadatumID &&
bulkEditionProcedures[criterion].action == editionActionsForMultiple.replace">
bulkEditionProcedures[criterion].metadatum &&
bulkEditionProcedures[criterion].action == editionActions.replace">
<component
:is="getMetadataByID(bulkEditionProcedures[criterion].metadatumID).metadata_type_object.component"
:forced-component-type="getMetadataByID(bulkEditionProcedures[criterion].metadatumID)
.metadata_type_object.component.includes('taxonomy') ? 'tainacan-taxonomy-tag-input' : ''"
:item-metadatum="{ metadatum: getMetadataByID(bulkEditionProcedures[criterion].metadatumID) }"
:is="bulkEditionProcedures[criterion].metadatum.metadata_type_object.component"
:forced-component-type="bulkEditionProcedures[criterion].metadatum.metadata_type_object.component.includes('taxonomy') ? 'tainacan-taxonomy-tag-input' : ''"
:item-metadatum="{ metadatum: bulkEditionProcedures[criterion].metadatum }"
:allow-new="false"
:allow-select-to-create="false"
:maxtags="1"
@ -109,13 +110,11 @@
</div>
<component
:is="getMetadataByID(bulkEditionProcedures[criterion].metadatumID).metadata_type_object.component"
:forced-component-type="getMetadataByID(bulkEditionProcedures[criterion].metadatumID)
.metadata_type_object.component.includes('taxonomy') ? 'tainacan-taxonomy-tag-input' : ''"
:item-metadatum="{ metadatum: getMetadataByID(bulkEditionProcedures[criterion].metadatumID) }"
:is="bulkEditionProcedures[criterion].metadatum.metadata_type_object.component"
:forced-component-type="bulkEditionProcedures[criterion].metadatum.metadata_type_object.component.includes('taxonomy') ? 'tainacan-taxonomy-tag-input' : ''"
:item-metadatum="{ metadatum: bulkEditionProcedures[criterion].metadatum }"
:allow-new="false"
:allow-select-to-create="getMetadataByID(bulkEditionProcedures[criterion].metadatumID)
.metadata_type_options.allow_new_terms === 'yes'"
:allow-select-to-create="bulkEditionProcedures[criterion].metadatum.metadata_type_options.allow_new_terms === 'yes'"
:maxtags="1"
:class="{'is-field-history': bulkEditionProcedures[criterion].isDone}"
class="tainacan-bulk-edition-field tainacan-bulk-edition-field-not-last"
@ -126,8 +125,7 @@
<!-- Not replace -->
<template
v-else-if="bulkEditionProcedures[criterion] &&
bulkEditionProcedures[criterion].metadatumID == 'status'">
v-else-if="bulkEditionProcedures[criterion] && bulkEditionProcedures[criterion].metadatum && bulkEditionProcedures[criterion].metadatum.id == 'status'">
<b-select
:class="{'is-field-history': bulkEditionProcedures[criterion].isDone, 'hidden-select-arrow': bulkEditionProcedures[criterion].isDone}"
:disabled="bulkEditionProcedures[criterion].isDone"
@ -144,8 +142,7 @@
</template>
<template
v-else-if="bulkEditionProcedures[criterion] &&
bulkEditionProcedures[criterion].metadatumID == 'comments'">
v-else-if="bulkEditionProcedures[criterion] && bulkEditionProcedures[criterion].metadatum && bulkEditionProcedures[criterion].metadatum.id == 'comments'">
<b-select
:class="{'is-field-history': bulkEditionProcedures[criterion].isDone, 'hidden-select-arrow': bulkEditionProcedures[criterion].isDone}"
:disabled="bulkEditionProcedures[criterion].isDone"
@ -163,9 +160,9 @@
<template
v-else-if="bulkEditionProcedures[criterion] &&
bulkEditionProcedures[criterion].metadatumID &&
bulkEditionProcedures[criterion].metadatum &&
bulkEditionProcedures[criterion].action &&
bulkEditionProcedures[criterion].action == editionActionsForMultiple.copy">
bulkEditionProcedures[criterion].action == editionActions.copy">
<b-select
:loading="metadataIsLoading"
:class="{'is-field-history': bulkEditionProcedures[criterion].isDone, 'hidden-select-arrow': !!bulkEditionProcedures[criterion].metadatumIdCopyFrom }"
@ -174,7 +171,7 @@
:placeholder="$i18n.get('instruction_select_a_metadatum')"
@input="addToBulkEditionProcedures($event, 'metadatumIdCopyFrom', criterion)">
<template
v-for="(metadatum, index) in metadata">
v-for="(metadatum, index) in getAllowedMetadataForCopy(criterion)">
<option
:key="index"
v-if="metadatum.id && metadatum.metadata_type_object.component !== 'tainacan-compound' && metadatum.parent <= 0"
@ -200,17 +197,15 @@
<template
v-else-if="bulkEditionProcedures[criterion] &&
bulkEditionProcedures[criterion].metadatumID &&
bulkEditionProcedures[criterion].metadatum &&
bulkEditionProcedures[criterion].action &&
bulkEditionProcedures[criterion].action != editionActionsForMultiple.clear">
bulkEditionProcedures[criterion].action != editionActions.clear">
<component
:is="getMetadataByID(bulkEditionProcedures[criterion].metadatumID).metadata_type_object.component"
:forced-component-type="getMetadataByID(bulkEditionProcedures[criterion].metadatumID)
.metadata_type_object.component.includes('taxonomy') ? 'tainacan-taxonomy-tag-input' : ''"
:item-metadatum="{ metadatum: getMetadataByID(bulkEditionProcedures[criterion].metadatumID) }"
:is="bulkEditionProcedures[criterion].metadatum.metadata_type_object.component"
:forced-component-type="bulkEditionProcedures[criterion].metadatum.metadata_type_object.component.includes('taxonomy') ? 'tainacan-taxonomy-tag-input' : ''"
:item-metadatum="{ metadatum: bulkEditionProcedures[criterion].metadatum }"
:allow-new="false"
:allow-select-to-create="getMetadataByID(bulkEditionProcedures[criterion].metadatumID)
.metadata_type_options.allow_new_terms === 'yes'"
:allow-select-to-create="bulkEditionProcedures[criterion].metadatum.metadata_type_options.allow_new_terms === 'yes'"
:maxtags="1"
:class="{ 'is-field-history': bulkEditionProcedures[criterion].isDone }"
class="tainacan-bulk-edition-field tainacan-bulk-edition-field-last"
@ -259,10 +254,10 @@
</div>
<button
:disabled="!groupID"
:disabled="!groupId"
v-if="!bulkEditionProcedures[criterion].isDone &&
!bulkEditionProcedures[criterion].isExecuting &&
bulkEditionProcedures[criterion].metadatumID &&
bulkEditionProcedures[criterion].metadatum &&
bulkEditionProcedures[criterion].action"
@click="executeBulkEditionProcedure(criterion)"
class="button is-white is-pulled-right">
@ -328,17 +323,12 @@
totalItems: Array,
objectType: String,
selectedForBulk: Object,
collectionID: Number
collectionId: Number
},
data() {
return {
statuses: {
draft: 'draft',
publish: 'publish',
private: 'private'
},
editionCriteria: [1],
editionActionsForMultiple: {
editionActions: {
add: this.$i18n.get('add_value'),
redefine: this.$i18n.get('set_new_value'),
replace: this.$i18n.get('replace_value'),
@ -346,11 +336,6 @@
clear: this.$i18n.get('clear_values'),
copy: this.$i18n.get('copy_value')
},
editionActionsForNotMultiple: {
redefine: this.$i18n.get('set_new_value'),
clear: this.$i18n.get('clear_values'),
copy: this.$i18n.get('copy_value')
},
bulkEditionProcedures: {
1: {
isDone: false,
@ -359,7 +344,7 @@
tooltipShow: true,
}
},
groupID: null,
groupId: null,
dones: [false],
metadataIsLoading: false,
metadataSearchCancel: undefined
@ -371,7 +356,7 @@
}
},
created(){
if (this.collectionID) {
if (this.collectionId) {
this.metadataIsLoading = true;
// Cancels previous Request
@ -379,30 +364,31 @@
this.metadataSearchCancel.cancel('Metadata search Canceled.');
this.fetchMetadata({
collectionId: this.collectionID,
collectionId: this.collectionId,
isRepositoryLevel: false,
isContextEdit: true,
includeDisabled: false,
parent: 'any'
}).then((resp) => {
resp.request
.then(() => {
this.metadataIsLoading = false;
}).catch(() => {
this.metadataIsLoading = false;
});
})
.then((resp) => {
resp.request
.then(() => {
this.metadataIsLoading = false;
}).catch(() => {
this.metadataIsLoading = false;
});
// Search Request Token for cancelling
this.metadataSearchCancel = resp.source;
})
.catch(() => this.metadataIsLoading = false);
// Search Request Token for cancelling
this.metadataSearchCancel = resp.source;
})
.catch(() => this.metadataIsLoading = false);
}
this.createEditGroup({
object: this.selectedForBulk,
collectionID: this.collectionID ? this.collectionID : 'default'
collectionId: this.collectionId ? this.collectionId : 'default'
}).then(() => {
this.groupID = this.getGroupID();
this.groupId = this.getGroupId();
});
},
mounted() {
@ -417,7 +403,7 @@
},
methods: {
...mapGetters('bulkedition', [
'getGroupID'
'getGroupId'
]),
...mapActions('bulkedition', [
'createEditGroup',
@ -439,111 +425,107 @@
]),
finalizeProcedure(criterion){
let withError = false;
this.$set(this.bulkEditionProcedures[criterion], 'isDone', true);
let index = this.editionCriteria.indexOf(criterion);
this.dones[index] = !withError;
this.dones[this.editionCriteria.indexOf(criterion)] = true;
this.$set(this.bulkEditionProcedures[criterion], 'isExecuting', false);
},
executeBulkEditionProcedure(criterion){
let procedure = this.bulkEditionProcedures[criterion];
if (procedure.action === this.editionActionsForMultiple.redefine) {
if (procedure.action === this.editionActions.redefine) {
this.$set(this.bulkEditionProcedures[criterion], 'isExecuting', true);
if (procedure.metadatumID === 'status'){
if (procedure.metadatum.id === 'status'){
this.setStatusInBulk({
collectionID: this.collectionID,
groupID: this.groupID,
collectionId: this.collectionId,
groupId: this.groupId,
bodyParams: { value: procedure.newValue }
}).then(() => {
this.finalizeProcedure(criterion);
});
} if(procedure.metadatumID === 'comments'){
} if(procedure.metadatum.id === 'comments'){
this.setCommentStatusInBulk({
collectionID: this.collectionID,
groupID: this.groupID,
collectionId: this.collectionId,
groupId: this.groupId,
bodyParams: { value: procedure.newValue }
}).then(() => {
this.finalizeProcedure(criterion);
});
} else {
this.setValueInBulk({
collectionID: this.collectionID,
groupID: this.groupID,
collectionId: this.collectionId,
groupId: this.groupId,
bodyParams: {
metadatum_id: procedure.metadatumID,
metadatum_id: procedure.metadatum.id,
value: procedure.newValue
}
}).then(() => {
this.finalizeProcedure(criterion);
});
}
} else if (procedure.action === this.editionActionsForMultiple.add) {
} else if (procedure.action === this.editionActions.add) {
this.$set(this.bulkEditionProcedures[criterion], 'isExecuting', true);
this.addValueInBulk({
collectionID: this.collectionID,
groupID: this.groupID,
collectionId: this.collectionId,
groupId: this.groupId,
bodyParams: {
metadatum_id: procedure.metadatumID,
metadatum_id: procedure.metadatum.id,
value: procedure.newValue,
}
}).then(() => {
this.finalizeProcedure(criterion);
});
} else if (procedure.action === this.editionActionsForMultiple.replace) {
} else if (procedure.action === this.editionActions.replace) {
this.$set(this.bulkEditionProcedures[criterion], 'isExecuting', true);
this.replaceValueInBulk({
collectionID: this.collectionID,
groupID: this.groupID,
collectionId: this.collectionId,
groupId: this.groupId,
bodyParams: {
metadatum_id: procedure.metadatumID,
metadatum_id: procedure.metadatum.id,
old_value: procedure.oldValue,
new_value: procedure.newValue,
}
}).then(() => {
this.finalizeProcedure(criterion);
});
} else if (procedure.action === this.editionActionsForMultiple.remove) {
} else if (procedure.action === this.editionActions.remove) {
this.$set(this.bulkEditionProcedures[criterion], 'isExecuting', true);
this.removeValueInBulk({
collectionID: this.collectionID,
groupID: this.groupID,
collectionId: this.collectionId,
groupId: this.groupId,
bodyParams: {
metadatum_id: procedure.metadatumID,
metadatum_id: procedure.metadatum.id,
value: procedure.newValue,
}
}).then(() => {
this.finalizeProcedure(criterion);
});
} else if (procedure.action === this.editionActionsForMultiple.clear) {
} else if (procedure.action === this.editionActions.clear) {
this.$set(this.bulkEditionProcedures[criterion], 'isExecuting', true);
this.clearValuesInBulk({
collectionID: this.collectionID,
groupID: this.groupID,
collectionId: this.collectionId,
groupId: this.groupId,
bodyParams: {
metadatum_id: procedure.metadatumID
metadatum_id: procedure.metadatum.id
}
}).then(() => {
this.finalizeProcedure(criterion);
});
} else if (procedure.action === this.editionActionsForMultiple.copy) {
} else if (procedure.action === this.editionActions.copy) {
this.$set(this.bulkEditionProcedures[criterion], 'isExecuting', true);
this.copyValuesInBulk({
collectionID: this.collectionID,
groupID: this.groupID,
collectionId: this.collectionId,
groupId: this.groupId,
bodyParams: {
metadatum_id: procedure.metadatumID,
metadatum_id_copy_from: procedure.metadatumIdCopyFrom,
metadatum_id: parseInt(procedure.metadatum.id),
metadatum_id_copy_from: parseInt(procedure.metadatumIdCopyFrom),
}
}).then(() => {
this.finalizeProcedure(criterion);
@ -585,23 +567,64 @@
this.dones.splice(criterionIndex, 1)
}
},
getValidEditionActions(metadatumID) {
const isMultiple = this.getMetadataByID(metadatumID).multiple == 'yes';
let validEditionActions = {};
getValidEditionActions(metadatum) {
let validEditionActions = JSON.parse(JSON.stringify(this.editionActions));
for (let [actionKey, action] of Object.entries(isMultiple ? this.editionActionsForMultiple : this.editionActionsForNotMultiple)) {
if ((metadatumID != 'status' && metadatumID != 'comments') || actionKey != 'clear')
validEditionActions[actionKey] = action;
for (let actionKey of Object.keys(this.editionActions)) {
// Not multiple metadata have less options
if (metadatum.multiple != 'yes' && (actionKey == 'add' || actionKey == 'replace' || actionKey == 'remove')) {
delete validEditionActions[actionKey];
continue;
}
// These special metadata are even more limited
if ((metadatum.id == 'status' || metadatum.id == 'comments') && (actionKey == 'clear' || actionKey == 'copy')) {
delete validEditionActions[actionKey];
continue;
} else if (metadatum.id == 'created_by' && (actionKey == 'clear' || actionKey == 'redefine')) {
delete validEditionActions[actionKey];
continue;
}
// For allowing copy, we also need to check more details of the metadata
if (actionKey == 'copy' && metadatum.metadata_type_object) {
const otherMetadatumOfSameTypeIndex = this.metadata.findIndex(otherMetadatum => {
return (
otherMetadatum.id != metadatum.id &&
otherMetadatum.metadata_type_object.component == metadatum.metadata_type_object.component &&
otherMetadatum.parent <= 0
);
});
if (otherMetadatumOfSameTypeIndex < 0) {
delete validEditionActions[actionKey];
}
}
}
return validEditionActions;
},
getMetadataByID(id) {
let found = this.metadata.find((element) => {
return element.id == id;
});
getAllowedMetadataForCopy(criterion) {
if (this.bulkEditionProcedures[criterion] &&
this.bulkEditionProcedures[criterion].metadatum &&
this.bulkEditionProcedures[criterion].action &&
this.bulkEditionProcedures[criterion].action == this.editionActions.copy) {
return found ? found : {};
const selectedMetadatum = this.bulkEditionProcedures[criterion].metadatum;
if (selectedMetadatum.metadata_type_object && selectedMetadatum.metadata_type_object.component) {
return this.metadata.filter((metadatum) => {
return (
metadatum.metadata_type_object.component === selectedMetadatum.metadata_type_object.component &&
metadatum.metadata_type_object.component === selectedMetadatum.metadata_type_object.component
)
});
} else if (selectedMetadatum.id == 'created_by') {
return this.metadata.filter(metadatum => metadatum.metadata_type_object.component == 'tainacan-user' && metadatum.parent <= 0)
}
}
return [];
},
addToBulkEditionProcedures(value, key, criterion) {
if (Array.isArray(value))

View File

@ -134,8 +134,7 @@
]),
...mapActions('bulkedition', [
'createEditGroup',
'createSequenceEditGroup',
'setStatusInBulk'
'createSequenceEditGroup'
]),
generateCopies() {
this.isLoading = true;
@ -164,7 +163,7 @@
this.isCreatingSequenceEditGroup = true;
this.createSequenceEditGroup({
object: onlyItemIds,
collectionID: this.collectionId
collectionId: this.collectionId
}).then((group) => {
let sequenceId = group.id;
this.isCreatingSequenceEditGroup = false;
@ -184,7 +183,7 @@
totalItems: onlyItemIds.length,
selectedForBulk: onlyItemIds,
objectType: this.$i18n.get('items'),
collectionID: this.collectionId
collectionId: this.collectionId
},
width: 'calc(100% - (2 * var(--tainacan-one-column)))',
trapFocus: true

View File

@ -2,7 +2,7 @@ import axios from '../../../axios';
export const createEditGroup = ({commit}, parameters) => {
let object = parameters.object;
let collectionID = parameters.collectionID;
let collectionId = parameters.collectionId;
let bulkEditParams = null;
@ -23,7 +23,7 @@ export const createEditGroup = ({commit}, parameters) => {
}
return new Promise ((resolve, reject) => {
axios.tainacan.post(`/collection/${collectionID}/bulk-edit`, bulkEditParams)
axios.tainacan.post(`/collection/${collectionId}/bulk-edit`, bulkEditParams)
.then(response => {
commit('setGroup', response.data);
resolve(response.data);
@ -66,15 +66,15 @@ export const fetchSequenceGroup = ({commit}, { collectionId, groupId }) => {
};
export const setValueInBulk = ({commit}, parameters) => {
let groupID = parameters.groupID;
let collectionID = parameters.collectionID;
let groupId = parameters.groupId;
let collectionId = parameters.collectionId;
/**
* @var bodyParams { metadatum_id, new_value } Object
* */
let bodyParams = parameters.bodyParams;
return axios.tainacan.post(`/collection/${collectionID}/bulk-edit/${groupID}/set`, bodyParams)
return axios.tainacan.post(`/collection/${collectionId}/bulk-edit/${groupId}/set`, bodyParams)
.then(response => {
commit('setLastUpdated');
return response;
@ -85,15 +85,15 @@ export const setValueInBulk = ({commit}, parameters) => {
};
export const addValueInBulk = ({commit}, parameters) => {
let groupID = parameters.groupID;
let collectionID = parameters.collectionID;
let groupId = parameters.groupId;
let collectionId = parameters.collectionId;
/**
* @var bodyParams { metadatum_id, new_value } Object
* */
let bodyParams = parameters.bodyParams;
return axios.tainacan.post(`/collection/${collectionID}/bulk-edit/${groupID}/add`, bodyParams)
return axios.tainacan.post(`/collection/${collectionId}/bulk-edit/${groupId}/add`, bodyParams)
.then(response => {
return response;
})
@ -103,45 +103,45 @@ export const addValueInBulk = ({commit}, parameters) => {
};
export const removeValueInBulk = ({commit}, parameters) => {
let groupID = parameters.groupID;
let collectionID = parameters.collectionID;
let groupId = parameters.groupId;
let collectionId = parameters.collectionId;
/**
* @var bodyParams { metadatum_id, new_value } Object
* */
let bodyParams = parameters.bodyParams;
return axios.tainacan.post(`/collection/${collectionID}/bulk-edit/${groupID}/remove`, bodyParams)
return axios.tainacan.post(`/collection/${collectionId}/bulk-edit/${groupId}/remove`, bodyParams)
.catch(error => {
console.error(error);
});
};
export const clearValuesInBulk = ({commit}, parameters) => {
let groupID = parameters.groupID;
let collectionID = parameters.collectionID;
let groupId = parameters.groupId;
let collectionId = parameters.collectionId;
/**
* @var bodyParams { metadatum_id, new_value } Object
* */
let bodyParams = parameters.bodyParams;
return axios.tainacan.post(`/collection/${collectionID}/bulk-edit/${groupID}/clear`, bodyParams)
return axios.tainacan.post(`/collection/${collectionId}/bulk-edit/${groupId}/clear`, bodyParams)
.catch(error => {
console.error(error);
});
};
export const replaceValueInBulk = ({commit}, parameters) => {
let groupID = parameters.groupID;
let collectionID = parameters.collectionID;
let groupId = parameters.groupId;
let collectionId = parameters.collectionId;
/**
* @var bodyParams { metadatum_id, old_value, new_value } Object
* */
let bodyParams = parameters.bodyParams;
return axios.tainacan.post(`/collection/${collectionID}/bulk-edit/${groupID}/replace`, bodyParams)
return axios.tainacan.post(`/collection/${collectionId}/bulk-edit/${groupId}/replace`, bodyParams)
.then(response => {
return response;
})
@ -151,8 +151,8 @@ export const replaceValueInBulk = ({commit}, parameters) => {
};
export const setStatusInBulk = ({commit}, parameters) => {
let groupID = parameters.groupID;
let collectionID = parameters.collectionID;
let groupId = parameters.groupId;
let collectionId = parameters.collectionId;
/**
* The new status value (draft, publish or private)
@ -160,7 +160,7 @@ export const setStatusInBulk = ({commit}, parameters) => {
* */
let bodyParams = parameters.bodyParams;
return axios.tainacan.post(`/collection/${collectionID}/bulk-edit/${groupID}/set_status`, bodyParams)
return axios.tainacan.post(`/collection/${collectionId}/bulk-edit/${groupId}/set_status`, bodyParams)
.then(response => {
commit('setLastUpdated');
return response;
@ -171,8 +171,8 @@ export const setStatusInBulk = ({commit}, parameters) => {
};
export const setCommentStatusInBulk = ({commit}, parameters) => {
let groupID = parameters.groupID;
let collectionID = parameters.collectionID;
let groupId = parameters.groupId;
let collectionId = parameters.collectionId;
/**
* The new status value (draft, publish or private)
@ -180,7 +180,7 @@ export const setCommentStatusInBulk = ({commit}, parameters) => {
* */
let bodyParams = parameters.bodyParams;
return axios.tainacan.post(`/collection/${collectionID}/bulk-edit/${groupID}/set_comment_status`, bodyParams)
return axios.tainacan.post(`/collection/${collectionId}/bulk-edit/${groupId}/set_comment_status`, bodyParams)
.then(response => {
commit('setLastUpdated');
return response;
@ -191,10 +191,10 @@ export const setCommentStatusInBulk = ({commit}, parameters) => {
};
export const trashItemsInBulk = ({commit}, parameters) => {
let groupID = parameters.groupID;
let collectionID = parameters.collectionID;
let groupId = parameters.groupId;
let collectionId = parameters.collectionId;
return axios.tainacan.post(`/collection/${collectionID}/bulk-edit/${groupID}/trash`)
return axios.tainacan.post(`/collection/${collectionId}/bulk-edit/${groupId}/trash`)
.then(response => {
commit('setLastUpdated');
return response;
@ -205,10 +205,10 @@ export const trashItemsInBulk = ({commit}, parameters) => {
};
export const untrashItemsInBulk = ({commit}, parameters) => {
let groupID = parameters.groupID;
let collectionID = parameters.collectionID;
let groupId = parameters.groupId;
let collectionId = parameters.collectionId;
return axios.tainacan.post(`/collection/${collectionID}/bulk-edit/${groupID}/untrash`)
return axios.tainacan.post(`/collection/${collectionId}/bulk-edit/${groupId}/untrash`)
.then(response => {
return response;
})
@ -218,10 +218,10 @@ export const untrashItemsInBulk = ({commit}, parameters) => {
};
export const deleteItemsInBulk = ({commit}, parameters) => {
let groupID = parameters.groupID;
let collectionID = parameters.collectionID;
let groupId = parameters.groupId;
let collectionId = parameters.collectionId;
return axios.tainacan.post(`/collection/${collectionID}/bulk-edit/${groupID}/delete_items`)
return axios.tainacan.post(`/collection/${collectionId}/bulk-edit/${groupId}/delete_items`)
.then(response => {
commit('setLastUpdated');
return response;
@ -233,15 +233,15 @@ export const deleteItemsInBulk = ({commit}, parameters) => {
export const copyValuesInBulk = ({commit}, parameters) => {
let groupID = parameters.groupID;
let collectionID = parameters.collectionID;
let groupId = parameters.groupId;
let collectionId = parameters.collectionId;
/**
* @var bodyParams { metadatum_id, new_value } Object
* */
let bodyParams = parameters.bodyParams;
return axios.tainacan.post(`/collection/${collectionID}/bulk-edit/${groupID}/copy_value`, bodyParams)
return axios.tainacan.post(`/collection/${collectionId}/bulk-edit/${groupId}/copy_value`, bodyParams)
.then(response => {
commit('setLastUpdated');
return response;
@ -269,7 +269,7 @@ export const fetchItemIdInSequence = ({commit}, { collectionId, sequenceId, item
export const createSequenceEditGroup = ({commit}, parameters) => {
let object = parameters.object;
let collectionID = parameters.collectionID;
let collectionId = parameters.collectionId;
let sequenceEditParams = null;
@ -285,7 +285,7 @@ export const createSequenceEditGroup = ({commit}, parameters) => {
}
return new Promise ((resolve, reject) => {
axios.tainacan.post(`/collection/${collectionID}/sequence-edit`, sequenceEditParams)
axios.tainacan.post(`/collection/${collectionId}/sequence-edit`, sequenceEditParams)
.then(response => {
commit('setGroup', response.data);
resolve(response.data);

View File

@ -1,4 +1,4 @@
export const getGroupID = state => {
export const getGroupId = state => {
return state.group.id;
};

View File

@ -603,7 +603,7 @@
}
.gray-icon .icon i::before,
.gray-icon i::before {
max-width: 26px;
max-width: 1.25em;
}
.icon {

View File

@ -245,7 +245,7 @@
}
.gray-icon .icon i::before,
.gray-icon i::before {
max-width: 26px;
max-width: 1.25em;
}
.icon {

View File

@ -545,7 +545,7 @@ export default {
}
.gray-icon .icon i::before,
.gray-icon i::before {
max-width: 26px;
max-width: 1.25em;
}
.icon {

View File

@ -209,7 +209,14 @@
}"
class="tainacan-icon" />
</span>
<span class="metadatum-name">
<span
v-tooltip="{
content: metadatum.name + (metadatum.parent_name ? (' (' + $i18n.get('info_child_of') + ' ' + metadatum.parent_name + ')') : ''),
autoHide: true,
classes: ['tooltip', isRepositoryLevel ? 'repository-tooltip' : ''],
placement: 'auto-start'
}"
class="metadatum-name">
{{ metadatum.name }}
<span
v-if="metadatum.parent_name"
@ -1051,8 +1058,7 @@ export default {
font-weight: bold;
margin-left: 0.4em;
display: inline-block;
max-width: 180px;
width: 60%;
width: calc(100% - 80px);
}
&:after,
&:before {

View File

@ -111,7 +111,8 @@
<button
class="button is-secondary"
slot="trigger">
<span>{{ $i18n.getFrom('items','add_new') }}</span>
<span class="is-hidden-touch">{{ $i18n.getFrom('items','add_new') }}</span>
<span class="is-hidden-desktop">{{ $i18n.get('add') }}</span>
<span class="icon">
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-arrowdown" />
</span>
@ -228,7 +229,8 @@
<button
:aria-label="$i18n.get('label_sorting_direction')"
class="button is-white"
slot="trigger">
slot="trigger"
style="padding-right: 3px !important;">
<span class="icon is-small gray-icon">
<i
:class="order == 'DESC' ? 'tainacan-icon-sortdescending' : 'tainacan-icon-sortascending'"
@ -405,7 +407,7 @@
<span class="gray-icon">
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-viewas"/>
</span>
<span class="is-hidden-mobile">{{ $i18n.get('label_view_as') }}</span>
<span class="is-hidden-tablet-only is-hidden-desktop-only">{{ $i18n.get('label_view_as') }}</span>
</button>
</div>
@ -1488,6 +1490,9 @@
display: flex;
align-items: center;
}
.button.is-white {
padding: 2px 10px !important;
}
.field {
align-items: center;
@ -1502,7 +1507,7 @@
.gray-icon i::before {
font-size: 1.3125em !important;
color: var(--tainacan-info-color) !important;
max-width: 26px;
max-width: 1.25em;
}
.view-mode-icon {

View File

@ -437,7 +437,7 @@
}
.gray-icon .icon i::before,
.gray-icon i::before {
max-width: 26px;
max-width: 1.25em;
}
.icon {

View File

@ -224,7 +224,7 @@
text-align: left;
margin-left: 2px;
padding-left: 0.875em;
border-left: 1px solid var(--tainacan-gray3);
border-left: 1px solid var(--tainacan-gray2);
.tainacan-compound-metadatum .label {
text-align: left;
@ -241,10 +241,10 @@
display: block;
max-height: 1px;
width: 35px;
background: var(--tainacan-gray3);
background: var(--tainacan-gray2);
content: none;
color: transparent;
margin: 1em auto;
margin: 1em auto 1em -0.875em;
}
}

View File

@ -193,7 +193,7 @@ a:hover {
.tainacan-compound-group {
margin-left: 2px;
padding-left: 0.875em;
border-left: 1px solid var(--tainacan-gray3);
border-left: 1px solid var(--tainacan-gray2);
.tainacan-compound-metadatum .label {
margin-bottom: 0.25em;
@ -208,10 +208,10 @@ a:hover {
display: block;
max-height: 1px;
width: 60px;
background: var(--tainacan-gray3);
background: var(--tainacan-gray2);
content: none;
color: transparent;
margin: 1em auto;
margin: 1em auto 1em -0.875em;
}
}

View File

@ -89,6 +89,7 @@ return apply_filters( 'tainacan-admin-i18n', [
'undo' => __( 'Undo', 'tainacan' ),
'delete' => __( 'Delete', 'tainacan' ),
'skip' => __( 'Skip', 'tainacan' ),
'add' => __( 'Add', 'tainacan' ),
// Wordpress CommentsStatus
'comments_status_open' => __( 'Open', 'tainacan' ),

View File

@ -201,7 +201,7 @@
<template v-if="!hideSortByButton">
<span
class="label"
style="padding-left: 2px;">
style="padding-left: 2px !important;">
{{ $i18n.get('info_by_inner') }}
</span>
<b-dropdown
@ -337,7 +337,7 @@
<span class="gray-icon">
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-viewas"/>
</span>
<span class="is-hidden-touch is-hidden-desktop-only">{{ $i18n.get('label_view_as') }}</span>
<span class="is-hidden-tablet-only is-hidden-desktop-only ">{{ $i18n.get('label_view_as') }}</span>
</button>
</div>
</div>
@ -1322,6 +1322,10 @@
background: transparent;
}
.button.is-white {
padding: 2px 10px !important;
}
.field {
align-items: center;
}
@ -1330,12 +1334,17 @@
.gray-icon .icon {
color: var(--tainacan-info-color) !important;
padding-right: 10px;
justify-content: space-between;
&.is-small {
width: 1em;
height: 1em;
}
}
.gray-icon .icon i::before,
.gray-icon i::before {
font-size: 1.3125em !important;
color: var(--tainacan-info-color) !important;
max-width: 26px;
max-width: 1.25em;
}
.dropdown-menu {

View File

@ -195,7 +195,7 @@ export default {
.tainacan-compound-group {
margin-left: 2px;
padding-left: 0.875em;
border-left: 1px solid var(--tainacan-gray3);
border-left: 1px solid var(--tainacan-gray2);
.tainacan-compound-metadatum .label {
margin-bottom: 0.25em;
@ -210,10 +210,10 @@ export default {
display: block;
max-height: 1px;
width: 60px;
background: var(--tainacan-gray3);
background: var(--tainacan-gray2);
content: none;
color: transparent;
margin: 1em auto;
margin: 1em auto 1em -0.875em;
}
}