Adds enumeration to item submission block. Wraps enumerations in classes. #827.

This commit is contained in:
mateuswetah 2023-11-16 19:07:50 -03:00
parent eda24e73e3
commit c01b9e336c
6 changed files with 21 additions and 7 deletions

View File

@ -400,7 +400,8 @@
</span>
<span
v-if="metadataSections.length > 1 && collection.item_enable_metadata_enumeration === 'yes'"
style="opacity: 0.65;">
style="opacity: 0.65;"
class="metadata-section-enumeration">
{{ Number(sectionIndex) + 1 }}.
</span>
{{ metadataSection.name }}&nbsp;

View File

@ -32,7 +32,8 @@
<label class="label has-tooltip">
<span
v-if="enumerateMetadatum"
style="opacity: 0.65;">
style="opacity: 0.65;"
class="metadatum-section-enumeration">
{{ enumerateMetadatum }}.
</span>
{{ childItemMetadatum.metadatum.name }}
@ -168,7 +169,7 @@
},
watch: {
/* This will create the input object structure for
* <tainacan-item-form :item-metadatum="childItemMetadatum" />
* <tainacan-form-item :item-metadatum="childItemMetadatum" />
* looking at the values from the parent (this.itemMetadatum)
*/
'itemMetadatum.value': {

View File

@ -22,7 +22,8 @@
<label class="label">
<span
v-if="enumerateMetadatum"
style="opacity: 0.65;">
style="opacity: 0.65;"
class="metadatum-section-enumeration">
{{ enumerateMetadatum }}.
</span>
{{ itemMetadatum.metadatum.name }}

View File

@ -167,7 +167,7 @@
this.taxonomyId = metadata_type_options.taxonomy_id;
this.taxonomy = metadata_type_options.taxonomy;
this.allowNewFromOptions = this.allowNew === false ? false : metadata_type_options.allow_new_terms == 'yes' && this.$userCaps.hasCapability('tnc_rep_edit_taxonomies');
this.allowNewFromOptions = this.allowNew === false ? false : metadata_type_options.allow_new_terms == 'yes' && (!this.$userCaps || this.$userCaps.hasCapability('tnc_rep_edit_taxonomies'));
this.getTermsId();
},

View File

@ -310,7 +310,7 @@ export const fetchCollectionForExposer = ({ commit }, collectionId) => {
export const fetchCollectionForItemSubmission = ({ commit }, collectionId) => {
return new Promise((resolve, reject) => {
let endpoint = '/collections/' + collectionId + '?fetch_only=name,allows_submission,submission_use_recaptcha';
let endpoint = '/collections/' + collectionId + '?fetch_only=name,allows_submission,submission_use_recaptcha,item_enable_metadata_enumeration';
axios.tainacan.get(endpoint)
.then(res => {
resolve( res.data );

View File

@ -461,7 +461,15 @@
}"
class="has-text-secondary tainacan-icon tainacan-icon-1-25em"/>
</span>
<label>{{ metadataSection.name }}</label>
<label>
<span
v-if="metadataSections.length > 1 && collectionItemMetadataEnumeration === 'yes'"
style="opacity: 0.65;"
class="metadata-section-enumeration">
{{ Number(sectionIndex) + 1 }}.
</span>
{{ metadataSection.name }}
</label>
<help-button
v-if="!hideHelpButtons &&
!helpInfoBellowLabel &&
@ -505,6 +513,7 @@
:hide-help-buttons="hideHelpButtons"
:help-info-bellow-label="helpInfoBellowLabel"
:is-collapsed="metadataCollapses[index]"
:enumerate-metadatum="metadataSections.length > 1 && collectionItemMetadataEnumeration === 'yes' ? ( (Number(sectionIndex) + 1) + '.' + (Number(index) + 1) ) : false"
@changeCollapse="onChangeCollapse($event, index)"/>
<!-- JS-side hook for extra content -->
@ -782,6 +791,7 @@ export default {
data(){
return {
collecionAllowsItemSubmission: true,
collectionItemMetadataEnumeration: 'no',
isLoading: false,
isLoadingMetadataSections: false,
isSubmitting: false,
@ -899,6 +909,7 @@ export default {
// Gets update info from the collecion in case it has been updated
this.collecionAllowsItemSubmission = collection.allows_submission == 'yes' ? true : false;
this.collectionItemMetadataEnumeration = collection.item_enable_metadata_enumeration;
this.useCaptcha = collection.submission_use_recaptcha;
// Initialize clear data from store