diff --git a/src/views/admin/components/edition/item-edition-form.vue b/src/views/admin/components/edition/item-edition-form.vue
index 773d16520..bd4899dd0 100644
--- a/src/views/admin/components/edition/item-edition-form.vue
+++ b/src/views/admin/components/edition/item-edition-form.vue
@@ -411,7 +411,7 @@
@@ -422,7 +422,7 @@
class="metadata-section-metadata-list">
+ class="metadata-section-description-help-info metadatum-description-help-info">
{{ metadataSection.description }}
@@ -1326,9 +1326,16 @@ export default {
parentMetaId: 0
});
}
-
- if ( this.collection && this.item )
- wp.hooks.doAction('tainacan_item_edition_item_loaded', JSON.parse(JSON.stringify(this.collection)), JSON.parse(JSON.stringify(this.item)));
+ /**
+ * Fires action tainacan_item_edition_item_loaded
+ * once the existing item is loaded. We cannot reliabilily send collection here since
+ * it is loaded async outside of the component.
+ */
+ wp.hooks.doAction(
+ 'tainacan_item_edition_item_loaded',
+ this.collection ? JSON.parse(JSON.stringify(this.collection)) : false,
+ this.item ? JSON.parse(JSON.stringify(this.item)) : false
+ );
// Loads metadata and attachments
this.loadMetadata();
@@ -1371,8 +1378,17 @@ export default {
}
}
- if ( this.collection && this.item && metadata)
- wp.hooks.doAction('tainacan_item_edition_metadata_loaded', JSON.parse(JSON.stringify(this.collection)), JSON.parse(JSON.stringify(this.item)), metadata);
+ /**
+ * Fires action tainacan_item_edition_metadata_loaded
+ * once the metadata is loaded. We cannot reliabilily send collection here since
+ * it is loaded async outside of the component.
+ */
+ wp.hooks.doAction(
+ 'tainacan_item_edition_metadata_loaded',
+ this.colection ? JSON.parse(JSON.stringify(this.collection)) : false,
+ this.item ? JSON.parse(JSON.stringify(this.item)) : false,
+ metadata ? metadata : []
+ );
this.isLoading = false;
});
@@ -1770,9 +1786,17 @@ export default {
this.urlIframeWidth = this.form.document_options['forced_iframe_width'];
if (this.form.document_options !== undefined && this.form.document_options['forced_iframe_height'] !== undefined)
this.urlIframeHeight = this.form.document_options['forced_iframe_height'];
-
- if ( this.collection && this.item )
- wp.hooks.doAction('tainacan_item_edition_item_loaded', JSON.parse(JSON.stringify(this.collection)), JSON.parse(JSON.stringify(this.item)));
+
+ /**
+ * Fires action tainacan_item_edition_item_loaded
+ * once the existing item is loaded. We cannot reliabilily send collection here since
+ * it is loaded async outside of the component.
+ */
+ wp.hooks.doAction(
+ 'tainacan_item_edition_item_loaded',
+ this.collection ? JSON.parse(JSON.stringify(this.collection)) : false,
+ this.item ? JSON.parse(JSON.stringify(this.item)) : false
+ );
this.loadMetadata();
this.setLastUpdated(this.item.modification_date);
@@ -2041,6 +2065,9 @@ export default {
margin-left: 12px;
}
}
+ .metadata-section-description-help-info {
+ margin: 0.25em 0 0 1.125rem;
+ }
.item-edition-tab-content .tab-item>.field:last-child {
margin-bottom: 187px;
}
diff --git a/src/views/admin/components/metadata-types/numeric/TainacanNumeric.vue b/src/views/admin/components/metadata-types/numeric/TainacanNumeric.vue
index 1f95785ee..2341e2041 100644
--- a/src/views/admin/components/metadata-types/numeric/TainacanNumeric.vue
+++ b/src/views/admin/components/metadata-types/numeric/TainacanNumeric.vue
@@ -5,6 +5,7 @@
:disabled="disabled"
:placeholder="itemMetadatum.metadatum.placeholder ? itemMetadatum.metadatum.placeholder : ''"
:model-value="value === 0 || value ? Number(value) : null"
+ :data-is-danger="!isInputValid"
lang="en"
:min="getMin"
:max="getMax"
@@ -26,6 +27,11 @@
'blur',
'mobile-special-focus'
],
+ data() {
+ return {
+ isInputValid: true
+ }
+ },
computed: {
getStep() {
if (this.itemMetadatum && this.itemMetadatum.metadatum.metadata_type_options && this.itemMetadatum.metadatum.metadata_type_options.step)
@@ -49,8 +55,13 @@
methods: {
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) : '')];
- if ( inputRef && !inputRef.checkHtml5Validity())
- return;
+
+ if ( inputRef ) {
+ this.isInputValid = inputRef.checkHtml5Validity();
+
+ if ( !this.isInputValid )
+ return;
+ }
// Allowing empty value as a state different of 0
if ( value === null || value === undefined || value === '' )
diff --git a/src/views/admin/components/metadata-types/tainacan-form-item.vue b/src/views/admin/components/metadata-types/tainacan-form-item.vue
index 6960bc8a9..65f07ecc5 100644
--- a/src/views/admin/components/metadata-types/tainacan-form-item.vue
+++ b/src/views/admin/components/metadata-types/tainacan-form-item.vue
@@ -19,7 +19,9 @@
}"
class="has-text-secondary tainacan-icon tainacan-icon-1-25em" />
-