Also hides metadata section tooltips in item submission form.

This commit is contained in:
mateuswetah 2024-07-03 17:04:09 -03:00
parent 92ae74ff91
commit 6601276c02
4 changed files with 43 additions and 9 deletions

View File

@ -411,7 +411,7 @@
</span> </span>
</label> </label>
<help-button <help-button
v-if="metadataSection.description" v-if="metadataSection.description && metadataSection.description_bellow_name !== 'yes'"
:title="metadataSection.name" :title="metadataSection.name"
:message="metadataSection.description" /> :message="metadataSection.description" />
</span> </span>
@ -422,7 +422,7 @@
class="metadata-section-metadata-list"> class="metadata-section-metadata-list">
<p <p
v-if="metadataSection.description && metadataSection.description_bellow_name == 'yes'" v-if="metadataSection.description && metadataSection.description_bellow_name == 'yes'"
class="metadatum-description-help-info"> class="metadata-section-description-help-info metadatum-description-help-info">
{{ metadataSection.description }} {{ metadataSection.description }}
</p> </p>
@ -2041,6 +2041,9 @@ export default {
margin-left: 12px; margin-left: 12px;
} }
} }
.metadata-section-description-help-info {
margin: 0.25em 0 0 1.125rem;
}
.item-edition-tab-content .tab-item>.field:last-child { .item-edition-tab-content .tab-item>.field:last-child {
margin-bottom: 187px; margin-bottom: 187px;
} }

View File

@ -5,6 +5,7 @@
:disabled="disabled" :disabled="disabled"
:placeholder="itemMetadatum.metadatum.placeholder ? itemMetadatum.metadatum.placeholder : ''" :placeholder="itemMetadatum.metadatum.placeholder ? itemMetadatum.metadatum.placeholder : ''"
:model-value="value === 0 || value ? Number(value) : null" :model-value="value === 0 || value ? Number(value) : null"
:data-is-danger="!isInputValid"
lang="en" lang="en"
:min="getMin" :min="getMin"
:max="getMax" :max="getMax"
@ -26,6 +27,11 @@
'blur', 'blur',
'mobile-special-focus' 'mobile-special-focus'
], ],
data() {
return {
isInputValid: true
}
},
computed: { computed: {
getStep() { getStep() {
if (this.itemMetadatum && this.itemMetadatum.metadatum.metadata_type_options && this.itemMetadatum.metadatum.metadata_type_options.step) if (this.itemMetadatum && this.itemMetadatum.metadatum.metadata_type_options && this.itemMetadatum.metadatum.metadata_type_options.step)
@ -49,8 +55,13 @@
methods: { methods: {
onInput(value) { onInput(value) {
const inputRef = this.$refs['tainacan-item-metadatum_id-' + this.itemMetadatum.metadatum.id + (this.itemMetadatum.parent_meta_id ? ('_parent_meta_id-' + this.itemMetadatum.parent_meta_id) : '')]; const inputRef = this.$refs['tainacan-item-metadatum_id-' + this.itemMetadatum.metadatum.id + (this.itemMetadatum.parent_meta_id ? ('_parent_meta_id-' + this.itemMetadatum.parent_meta_id) : '')];
if ( inputRef && !inputRef.checkHtml5Validity())
return; if ( inputRef ) {
this.isInputValid = inputRef.checkHtml5Validity();
if ( !this.isInputValid )
return;
}
// Allowing empty value as a state different of 0 // Allowing empty value as a state different of 0
if ( value === null || value === undefined || value === '' ) if ( value === null || value === undefined || value === '' )

View File

@ -19,7 +19,9 @@
}" }"
class="has-text-secondary tainacan-icon tainacan-icon-1-25em" /> class="has-text-secondary tainacan-icon tainacan-icon-1-25em" />
</span> </span>
<label class="label"> <label
class="label"
:class="{ 'has-text-danger': errorMessage }">
<span <span
v-if="enumerateMetadatum" v-if="enumerateMetadatum"
style="opacity: 0.65;" style="opacity: 0.65;"
@ -237,7 +239,8 @@
(this.itemMetadatum && this.itemMetadatum.metadatum && this.itemMetadatum.metadatum.placeholder ? ' has-placeholder' : '') + (this.itemMetadatum && this.itemMetadatum.metadatum && this.itemMetadatum.metadatum.placeholder ? ' has-placeholder' : '') +
(this.itemMetadatum && this.itemMetadatum.metadatum && this.itemMetadatum.metadatum.description ? ' has-description' : '') + (this.itemMetadatum && this.itemMetadatum.metadatum && this.itemMetadatum.metadatum.description ? ' has-description' : '') +
(this.itemMetadatum && this.itemMetadatum.metadatum && this.itemMetadatum.metadatum.id ? ' tainacan-metadatum-id--' + this.itemMetadatum.metadatum.id : '') + (this.itemMetadatum && this.itemMetadatum.metadatum && this.itemMetadatum.metadatum.id ? ' tainacan-metadatum-id--' + this.itemMetadatum.metadatum.id : '') +
(this.isFocused ? ' is-focused' : ''); (this.isFocused ? ' is-focused' : '') +
(this.errorMessage ? ' is-danger' : '');
} }
}, },
created() { created() {

View File

@ -44,11 +44,28 @@
color: var(--tainacan-danger); color: var(--tainacan-danger);
} }
} }
.input, .textarea { .field.is-danger {
&.is-danger { .input,
background-color: var(--tainacan-red1); .textarea,
.select,
.dropdown,
.autocomplete {
--tainacan-input-border-color: var(--tainacan-danger);
--tainacan-input-background-color: var(--tainacan-red1);
} }
} }
.input,
.textarea,
.select {
&.is-danger {
--tainacan-input-border-color: var(--tainacan-danger);
--tainacan-input-background-color: var(--tainacan-red1);
}
}
input[data-is-danger="true"] {
--tainacan-input-border-color: var(--tainacan-danger);
--tainacan-input-background-color: var(--tainacan-red1);
}
a[disabled="true"] { a[disabled="true"] {
opacity: 0.5; opacity: 0.5;
user-select: none; user-select: none;