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

View File

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