Adds compound children to bulk edition modal. #17.

This commit is contained in:
mateuswetah 2020-03-26 10:38:04 -03:00
parent 3bb45a0443
commit 91d76e6b29
2 changed files with 52 additions and 40 deletions

View File

@ -33,10 +33,22 @@
v-for="(metadatum, index) in metadata">
<option
:key="index"
v-if="metadatum.id"
v-if="metadatum.id && metadatum.metadata_type_object.component !== 'tainacan-compound' && metadatum.parent <= 0"
:value="metadatum.id">
{{ metadatum.name }}
</option>
<optgroup
v-if="metadatum.id && metadatum.metadata_type_object.component === 'tainacan-compound'"
:key="index"
:label="metadatum.name">
<option
v-for="(childMetadatum, childIndex) of metadatum.metadata_type_options.children_objects"
:key="childIndex"
v-if="childMetadatum.id"
:value="childMetadatum.id">
{{ childMetadatum.name }}
</option>
</optgroup>
<option
:key="index"
v-if="index === Object.keys(metadata).length-1"
@ -83,15 +95,15 @@
bulkEditionProcedures[criterion].action == editionActionsForMultiple.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) }"
:allow-new="false"
:allow-select-to-create="false"
:maxtags="1"
:class="{'is-field-history': bulkEditionProcedures[criterion].isDone}"
:disabled="bulkEditionProcedures[criterion].isDone"
:is="getMetadataByID(bulkEditionProcedures[criterion].metadatumID).metadata_type_object.component"
:item-metadatum="{metadatum: getMetadataByID(bulkEditionProcedures[criterion].metadatumID)}"
class="tainacan-bulk-edition-field"
@input="addToBulkEditionProcedures($event, 'oldValue', criterion)"
/>
@ -103,17 +115,17 @@
</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) }"
:allow-new="false"
:allow-select-to-create="getMetadataByID(bulkEditionProcedures[criterion].metadatumID)
.metadata_type_options.allow_new_terms === 'yes'"
:maxtags="1"
:class="{'is-field-history': bulkEditionProcedures[criterion].isDone}"
:disabled="bulkEditionProcedures[criterion].isDone"
:is="getMetadataByID(bulkEditionProcedures[criterion].metadatumID).metadata_type_object.component"
:item-metadatum="{metadatum: getMetadataByID(bulkEditionProcedures[criterion].metadatumID)}"
class="tainacan-bulk-edition-field tainacan-bulk-edition-field-not-last"
:disabled="bulkEditionProcedures[criterion].isDone"
@input="addToBulkEditionProcedures($event, 'newValue', criterion)"
/>
</template>
@ -161,17 +173,17 @@
bulkEditionProcedures[criterion].action &&
bulkEditionProcedures[criterion].action != editionActionsForMultiple.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) }"
:allow-new="false"
:allow-select-to-create="getMetadataByID(bulkEditionProcedures[criterion].metadatumID)
.metadata_type_options.allow_new_terms === 'yes'"
:maxtags="1"
:class="{ 'is-field-history': bulkEditionProcedures[criterion].isDone }"
:disabled="bulkEditionProcedures[criterion].isDone || bulkEditionProcedures[criterion].isExecuting"
:is="getMetadataByID(bulkEditionProcedures[criterion].metadatumID).metadata_type_object.component"
:item-metadatum="{metadatum: getMetadataByID(bulkEditionProcedures[criterion].metadatumID)}"
class="tainacan-bulk-edition-field tainacan-bulk-edition-field-last"
:disabled="bulkEditionProcedures[criterion].isDone || bulkEditionProcedures[criterion].isExecuting"
@input="addToBulkEditionProcedures($event, 'newValue', criterion)"
/>
</template>
@ -235,10 +247,7 @@
</button>
<div v-if="bulkEditionProcedures[criterion].isExecuting">
<b-icon
class="mdi-loader"
type="is-success"
icon="loading"/>
<button class="button is-white is-loading" />
</div>
</div>
</div>
@ -340,7 +349,8 @@
collectionId: this.collectionID,
isRepositoryLevel: false,
isContextEdit: true,
includeDisabled: false
includeDisabled: false,
parent: 'any'
}).then((resp) => {
resp.request
.then(() => {
@ -722,20 +732,15 @@
cursor: not-allowed !important;
}
.mdi-loader {
-webkit-animation: spin 2s linear infinite; /* Safari */
animation: spin 2s linear infinite;
.button.is-white.is-loading {
cursor: inherit;
color: var(--tainacan-gray4) !important;
}
/* Safari */
@-webkit-keyframes spin {
0% { -webkit-transform: rotate(0deg); }
100% { -webkit-transform: rotate(360deg); }
.is-pulled-right .is-success {
background-color: transparent !important;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
.add-link {
font-size: 0.875em;
}
</style>

View File

@ -55,4 +55,11 @@
&.is-loading.is-small::after {
font-size: 0.875em;
}
optgroup,
optgroup[label],
optgroup::before {
color: var(--tainacan-gray2);
font-weight: normal;
font-style: italic;
}
}