-
+
conditionalValues.indexOf(aValue) < 0);
+ eventBusItemMetadata.conditionalSections[conditionalSectionId].hide = Array.isArray(itemMetadatumValues) ? itemMetadatumValues.every(aValue => conditionalValues.indexOf(aValue) < 0) : conditionalValues.indexOf(itemMetadatumValues) < 0;
}
}
diff --git a/src/views/admin/components/edition/metadata-section-edition-form.vue b/src/views/admin/components/edition/metadata-section-edition-form.vue
index 5fcf3632c..3b3e315bf 100644
--- a/src/views/admin/components/edition/metadata-section-edition-form.vue
+++ b/src/views/admin/components/edition/metadata-section-edition-form.vue
@@ -179,8 +179,9 @@
:extra-classes="isRepositoryLevel ? 'tainacan-repository-tooltip' : ''" />
+ v-model="selectedConditionalMetadatumId"
+ :placeholder="$i18n.get('label_select_metadatum')"
+ @input="reloadConditionalValueComponent()">
- {{ availableConditionalMetadata.find((availableMetadatum) => availableMetadatum.id == selectedConditionalMetadatum).name }}
+ {{ selectedConditionalMetadatum.name }}
-
-
- {{ conditionalValue }}
-
-
+
@@ -266,9 +268,10 @@
closedByForm: false,
entityName: 'metadataSection',
isUpdating: false,
- selectedConditionalMetadatum: undefined,
+ selectedConditionalMetadatumId: undefined,
selectedConditionalValue: [],
- hideConditionalSectionSettings: false
+ hideConditionalSectionSettings: false,
+ shouldUpdateConditionalValue: true
}
},
computed: {
@@ -276,18 +279,21 @@
'getMetadataSections'
]),
availableConditionalMetadata() {
- if (this.getMetadataSections.length) {
+ if ( this.getMetadataSections.length ) {
const otherMetadataSections = this.getMetadataSections.filter(aMetadataSection => aMetadataSection.id != this.form.id);
const availableMetadata = [];
for (let aMetadataSection of otherMetadataSections)
availableMetadata.push.apply(availableMetadata, aMetadataSection.metadata_object_list);
- return availableMetadata.filter(aMetadatum => aMetadatum.metadata_type === 'Tainacan\\Metadata_Types\\Selectbox');
+ return availableMetadata.filter(aMetadatum => aMetadatum.metadata_type === 'Tainacan\\Metadata_Types\\Selectbox' || aMetadatum.metadata_type === 'Tainacan\\Metadata_Types\\Taxonomy');
}
- return {};
+ return [];
},
isConditionalSection() {
return this.form.is_conditional_section == 'yes';
- }
+ },
+ selectedConditionalMetadatum() {
+ return this.availableConditionalMetadata.find(aMetadatum => aMetadatum.id == this.selectedConditionalMetadatumId)
+ },
},
created() {
this.form = JSON.parse(JSON.stringify(this.originalMetadataSection));
@@ -297,7 +303,7 @@
if ( this.form.is_conditional_section == 'yes' && Object.keys(this.form.conditional_section_rules).length ) {
const conditionalMetadatum = Object.keys(this.form.conditional_section_rules)[0];
- this.selectedConditionalMetadatum = conditionalMetadatum;
+ this.selectedConditionalMetadatumId = conditionalMetadatum;
this.selectedConditionalValue = this.form.conditional_section_rules[conditionalMetadatum];
}
@@ -316,10 +322,9 @@
'updateMetadataSection'
]),
saveEdition(metadataSection) {
-
- if ( this.form.is_conditional_section == 'yes' && this.selectedConditionalMetadatum && this.selectedConditionalValue ) {
+ if ( this.form.is_conditional_section == 'yes' && this.selectedConditionalMetadatumId && this.selectedConditionalValue ) {
this.form.conditional_section_rules = {}
- this.form.conditional_section_rules[this.selectedConditionalMetadatum] = this.selectedConditionalValue;
+ this.form.conditional_section_rules[this.selectedConditionalMetadatumId] = this.selectedConditionalValue;
} else
this.form.conditional_section_rules = null;
@@ -359,6 +364,15 @@
this.closedByForm = true;
this.$emit('onEditionCanceled');
},
+ selectConditionalValue(selected) {
+ const selectedValues = Array.isArray(selected) ? selected : [ selected ];
+ this.selectedConditionalValue = selectedValues.map( aSelected => aSelected.value ? aSelected.value : aSelected );
+ },
+ reloadConditionalValueComponent() {
+ this.shouldUpdateConditionalValue = false;
+ this.selectedConditionalValue = [];
+ this.$nextTick(() => this.shouldUpdateConditionalValue = true);
+ }
}
}
@@ -459,6 +473,23 @@
}
}
}
+
+ /deep/ .is-special-hidden-for-mobile,
+ /deep/ .is-special-hidden-for-mobile:focus,
+ /deep/ .is-special-hidden-for-mobile:focus-visible {
+ opacity: 0;
+ width: 0;
+ height: 0 !important;
+ min-height: 0;
+ min-width: 0;
+ padding: 0 !important;
+ line-height: 0px !important;
+ border: none !important;
+ border-color: transparent !important;
+ border-width: 0px !important;
+ font-size: 0px !important;
+ display: block !important;
+ }
.form-submit {
background-color: var(--tainacan-gray1);
position: sticky;
diff --git a/src/views/admin/components/edition/taxonomy-edition-form.vue b/src/views/admin/components/edition/taxonomy-edition-form.vue
index d29d50fab..20e49b94c 100644
--- a/src/views/admin/components/edition/taxonomy-edition-form.vue
+++ b/src/views/admin/components/edition/taxonomy-edition-form.vue
@@ -555,7 +555,7 @@
.status-radios {
display: flex;
}
- .status-radios .control-lable {
+ .status-radios .control-label {
display: flex;
align-items: center;
}
diff --git a/src/views/admin/components/lists/collections-list.vue b/src/views/admin/components/lists/collections-list.vue
index 9c48239ea..5cd85b59a 100644
--- a/src/views/admin/components/lists/collections-list.vue
+++ b/src/views/admin/components/lists/collections-list.vue
@@ -9,7 +9,9 @@
{{ $i18n.get('label_select_all_collections_page') }}
+ :native-value="allCollectionsOnPageSelected">
+ {{ $i18n.get('label_select_all_collections_page') }}
+
@@ -575,7 +577,7 @@ export default {
.selection-control {
padding: 6px 0px 0px 12px;
- background: var(--tainacan-white);
+ background: var(--tainacan-background-color);
height: 40px;
.select-all {
diff --git a/src/views/admin/components/lists/items-list.vue b/src/views/admin/components/lists/items-list.vue
index 54ec8bd29..370acfd29 100644
--- a/src/views/admin/components/lists/items-list.vue
+++ b/src/views/admin/components/lists/items-list.vue
@@ -2693,7 +2693,7 @@ export default {
.selection-control {
margin-bottom: 6px;
padding: 6px 0px 0px 12px;
- background: var(--tainacan-white);
+ background: var(--tainacan-background-color);
height: 40px;
display: flex;
align-items: center;
diff --git a/src/views/admin/components/lists/processes-list.vue b/src/views/admin/components/lists/processes-list.vue
index 47f96aea0..4bb6d9bf5 100644
--- a/src/views/admin/components/lists/processes-list.vue
+++ b/src/views/admin/components/lists/processes-list.vue
@@ -517,12 +517,16 @@
.sub-header {
@include logs-container();
+
+ .header-item {
+ min-height: 1.875em;
+ }
}
.selection-control {
padding: 6px 0px 0px 12px;
- background: var(--tainacan-white);
+ background: var(--tainacan-background-color);
height: 40px;
.select-all {
diff --git a/src/views/admin/components/lists/taxonomies-list.vue b/src/views/admin/components/lists/taxonomies-list.vue
index 80d0f68a7..b2c4f0281 100644
--- a/src/views/admin/components/lists/taxonomies-list.vue
+++ b/src/views/admin/components/lists/taxonomies-list.vue
@@ -10,7 +10,9 @@
{{ $i18n.get('label_select_all_taxonomies_page') }}
+ :native-value="allOnPageSelected">
+ {{ $i18n.get('label_select_all_taxonomies_page') }}
+
@@ -438,7 +440,7 @@
.selection-control {
padding: 6px 0px 0px 12px;
- background: var(--tainacan-white);
+ background: var(--tainacan-background-color);
height: 40px;
.select-all {
diff --git a/src/views/admin/components/metadata-types/core-description/class-tainacan-core-description.php b/src/views/admin/components/metadata-types/core-description/class-tainacan-core-description.php
index 87534742b..999952dbf 100644
--- a/src/views/admin/components/metadata-types/core-description/class-tainacan-core-description.php
+++ b/src/views/admin/components/metadata-types/core-description/class-tainacan-core-description.php
@@ -19,11 +19,24 @@ class Core_Description extends Metadata_Type {
$this->set_core(true);
$this->set_related_mapped_prop('description');
$this->set_component('tainacan-textarea');
+ $this->set_form_component('tainacan-form-textarea');
$this->set_name( __('Core Description', 'tainacan') );
$this->set_description( __('The "Core Description" is a compulsory metadata automatically created for all collections by default. This is the main description displayed in items lists and where the basic research tools will do their searches.', 'tainacan') );
$this->set_sortable( false );
}
+ /**
+ * @inheritdoc
+ */
+ public function get_form_labels(){
+ return [
+ 'maxlength' => [
+ 'title' => __( 'Maximum of characters', 'tainacan' ),
+ 'description' => __( 'Limits the character input to a maximum value an displays a counter.', 'tainacan' ),
+ ]
+ ];
+ }
+
/**
* generate the metadata for this metadatum type
*/
diff --git a/src/views/admin/components/metadata-types/numeric/FormNumeric.vue b/src/views/admin/components/metadata-types/numeric/FormNumeric.vue
index 9b88683f9..dfe5739b3 100644
--- a/src/views/admin/components/metadata-types/numeric/FormNumeric.vue
+++ b/src/views/admin/components/metadata-types/numeric/FormNumeric.vue
@@ -69,6 +69,32 @@
+
+
+ {{ $i18n.getHelperTitle('tainacan-numeric', 'min') }}
+
+
+
+
+
+
+ {{ $i18n.getHelperTitle('tainacan-numeric', 'max') }}
+
+
+
+
@@ -80,15 +106,25 @@
data() {
return {
step: [Number, String],
+ min: [Number, null],
+ max: [Number, null],
showEditStepOptions: false
}
},
created() {
this.step = this.value && this.value.step ? this.value.step : 0.01;
+ this.min = this.value && this.value.min ? Number(this.value.min) : null;
+ this.max = this.value && this.value.max ? Number(this.value.max) : null;
},
methods: {
onUpdateStep(value) {
- this.$emit('input', { step: value });
+ this.$emit('input', { step: value, min: this.min, max: this.max });
+ },
+ onUpdateMin(value) {
+ this.$emit('input', { step: this.step, min: value, max: this.max });
+ },
+ onUpdateMax(value) {
+ this.$emit('input', { step: this.step, min: this.min, max: value });
}
}
}
diff --git a/src/views/admin/components/metadata-types/numeric/Numeric.vue b/src/views/admin/components/metadata-types/numeric/Numeric.vue
index 9c94041e4..29b04b2bc 100644
--- a/src/views/admin/components/metadata-types/numeric/Numeric.vue
+++ b/src/views/admin/components/metadata-types/numeric/Numeric.vue
@@ -1,15 +1,17 @@
-
+ :min="getMin"
+ :max="getMax"
+ :step="getStep" />
+
+
diff --git a/src/views/admin/components/metadata-types/numeric/class-tainacan-numeric.php b/src/views/admin/components/metadata-types/numeric/class-tainacan-numeric.php
index 2536ceb23..cd2f0dca2 100644
--- a/src/views/admin/components/metadata-types/numeric/class-tainacan-numeric.php
+++ b/src/views/admin/components/metadata-types/numeric/class-tainacan-numeric.php
@@ -34,6 +34,14 @@ class Numeric extends Metadata_Type {
'step' => [
'title' => __( 'Step', 'tainacan' ),
'description' => __( 'The amount to be increased or decreased when clicking on the metadatum control buttons. This also defines whether the input accepts decimal numbers.', 'tainacan' ),
+ ],
+ 'min' => [
+ 'title' => __( 'Minimum', 'tainacan' ),
+ 'description' => __( 'The minimum value that the input will accept.', 'tainacan' ),
+ ],
+ 'max' => [
+ 'title' => __( 'Maximum', 'tainacan' ),
+ 'description' => __( 'The maximum value that the input will accept.', 'tainacan' ),
]
];
}
diff --git a/src/views/admin/components/metadata-types/relationship/Relationship.vue b/src/views/admin/components/metadata-types/relationship/Relationship.vue
index eeb6f373d..2d3a50009 100644
--- a/src/views/admin/components/metadata-types/relationship/Relationship.vue
+++ b/src/views/admin/components/metadata-types/relationship/Relationship.vue
@@ -25,7 +25,7 @@
:placeholder="itemMetadatum.metadatum.placeholder ? itemMetadatum.metadatum.placeholder : $i18n.get('instruction_type_existing_item')"
:loading="isLoading"
:aria-close-label="$i18n.get('remove_value')"
- :class="{'has-selected': selected != undefined && selected != []}"
+ :class="{ 'has-selected': selected != undefined && selected != [] }"
field="label"
@typing="search"
check-infinite-scroll
diff --git a/src/views/admin/components/metadata-types/selectbox/Selectbox.vue b/src/views/admin/components/metadata-types/selectbox/Selectbox.vue
index 03a672c2c..bc510c86f 100644
--- a/src/views/admin/components/metadata-types/selectbox/Selectbox.vue
+++ b/src/views/admin/components/metadata-types/selectbox/Selectbox.vue
@@ -33,7 +33,7 @@
disabled: false,
},
computed: {
- getOptions(){
+ getOptions() {
if (this.itemMetadatum && this.itemMetadatum.metadatum.metadata_type_options && this.itemMetadatum.metadatum.metadata_type_options.options ) {
const metadata = this.itemMetadatum.metadatum.metadata_type_options.options;
return ( metadata ) ? metadata.split("\n") : [];
diff --git a/src/views/admin/components/metadata-types/taxonomy/Taxonomy.vue b/src/views/admin/components/metadata-types/taxonomy/Taxonomy.vue
index fa4a0b4ac..94a043bbe 100644
--- a/src/views/admin/components/metadata-types/taxonomy/Taxonomy.vue
+++ b/src/views/admin/components/metadata-types/taxonomy/Taxonomy.vue
@@ -1,12 +1,10 @@
-
-
-
- addRecentlyCreatedTerm($event.term)"
- @onEditionCanceled="() => $console.log('Editing canceled')"
- @onErrorFound="($event) => $console.log('Form with errors: ' + $event)" />
-
+
+
+
+ addRecentlyCreatedTerm($event.term)"
+ @onEditionCanceled="() => $console.log('Editing canceled')"
+ @onErrorFound="($event) => $console.log('Form with errors: ' + $event)" />
+
-
-
- addTermToBeCreated($event)"
- @onEditionCanceled="() => isTermCreationPanelOpen = false"
- @onErrorFound="($event) => $console.log('Form with errors: ' + $event)" />
-
+
+
+ addTermToBeCreated($event)"
+ @onEditionCanceled="() => isTermCreationPanelOpen = false"
+ @onErrorFound="($event) => $console.log('Form with errors: ' + $event)" />
+
+
@@ -90,6 +90,7 @@
import TainacanTaxonomyTagInput from './TaxonomyTaginput.vue';
import CheckboxRadioMetadataInput from '../../other/checkbox-radio-metadata-input.vue';
import { tainacan as axios } from '../../../js/axios.js';
+ import { mapActions } from 'vuex';
export default {
components: {
@@ -103,7 +104,6 @@
forcedComponentType: '',
maxtags: '',
allowNew: false,
- allowSelectToCreate: false,
isMobileScreen: false,
},
data(){
@@ -116,7 +116,8 @@
isTermCreationModalOpen: false,
isTermCreationPanelOpen: false,
newTermName: '',
- allowNewFromOptions: false
+ allowNewFromOptions: false,
+ isFetchingTerms: false
}
},
computed: {
@@ -165,21 +166,54 @@
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.getTermsId();
},
methods: {
+ ...mapActions('taxonomy', [
+ 'fetchTerms'
+ ]),
getTermsId() {
let values = [];
-
- if (this.value && this.itemMetadatum.metadatum && this.getComponent != 'tainacan-taxonomy-tag-input') {
+
+
+ if ( this.value && this.itemMetadatum.metadatum && this.getComponent != 'tainacan-taxonomy-tag-input' ) {
values = this.value.map(term => term.id).filter(term => term !== undefined);
this.valueComponent = (values.length > 0 && this.itemMetadatum.metadatum && this.itemMetadatum.metadatum.multiple === 'no') ? values[0] : values;
+
} else if (this.value && this.itemMetadatum.metadatum && this.getComponent == 'tainacan-taxonomy-tag-input') {
- values = this.value.map((term) => { return { label: term.name, value: term.id } });
- this.valueComponent = values;
+
+ // This first scenario happens in the item edition form, as the item metadata returns the terms as objects
+ if ( this.value[0] && this.value[0] && this.value[0].id ) {
+ values = this.value.map((term) => { return { label: term.name, value: term.id } });
+ this.valueComponent = values;
+
+ // If the term is not returned as object, we're in bulk edition modal or in the metadata section condition metadata input, where value is a an array of IDs
+ } else if ( this.value.length ) {
+ this.isFetchingTerms = true;
+ this.fetchTerms({
+ taxonomyId: this.taxonomyId,
+ fetchOnly: {
+ fetch_only: {
+ 0: 'name',
+ 1: 'id'
+ }
+ },
+ all: true,
+ include: this.value
+ }).then((res) => {
+ values = res.terms.map((term) => { return { label: term.name, value: term.id } });
+ this.valueComponent = values;
+ this.isFetchingTerms = false;
+ }).catch((error) => {
+ this.isFetchingTerms = false;
+ throw error;
+ });
+ } else {
+ this.valueComponent = [];
+ }
}
},
addRecentlyCreatedTerm(term) {
diff --git a/src/views/admin/components/metadata-types/taxonomy/TaxonomyTaginput.vue b/src/views/admin/components/metadata-types/taxonomy/TaxonomyTaginput.vue
index 4a436fa2c..3d03b3cde 100644
--- a/src/views/admin/components/metadata-types/taxonomy/TaxonomyTaginput.vue
+++ b/src/views/admin/components/metadata-types/taxonomy/TaxonomyTaginput.vue
@@ -5,12 +5,11 @@
:id="'tainacan-item-metadatum_id-' + itemMetadatum.metadatum.id + (itemMetadatum.parent_meta_id ? ('_parent_meta_id-' + itemMetadatum.parent_meta_id) : '')"
size="is-small"
icon="magnify"
- :allow-new="false"
@add="emitAdd"
@remove="emitRemove"
v-model="selected"
- :data="labels"
- :maxtags="maxtags"
+ :data="options"
+ :maxtags="maxtags != undefined ? maxtags : (itemMetadatum.metadatum.multiple == 'yes' || allowNew === true ? (maxMultipleValues !== undefined ? maxMultipleValues : null) : '1')"
field="label"
:remove-on-keys="[]"
:dropdown-position="isLastMetadatum ? 'top' :'auto'"
@@ -21,10 +20,12 @@
:loading="isFetching"
:class="{ 'has-selected': selected != undefined && selected != [] }"
autocomplete
- @typing="loadTerms"
+ @typing="search"
check-infinite-scroll
- @infinite-scroll="loadMoreTerms"
- :has-counter="false">
+ @infinite-scroll="searchMore"
+ :has-counter="false"
+ :append-to-body="!itemMetadatum.item"
+ :open-on-focus="false">