Fix conflits from develop

This commit is contained in:
Mateus Machado Luna 2019-10-03 15:30:59 -03:00
commit 7e787068e1
48 changed files with 931 additions and 246 deletions

View File

@ -17,7 +17,7 @@
<b-select
:loading="metadataIsLoading"
:class="{'is-field-history': bulkEditionProcedures[criterion].isDone}"
:class="{'is-field-history': bulkEditionProcedures[criterion].isDone, 'hidden-select-arrow': !!bulkEditionProcedures[criterion].metadatumID}"
:disabled="!!bulkEditionProcedures[criterion].metadatumID || metadataIsLoading"
class="tainacan-bulk-edition-field tainacan-bulk-edition-field-not-last"
:placeholder="$i18n.get('instruction_select_a_metadatum')"
@ -40,7 +40,7 @@
</b-select>
<b-select
:class="{'is-field-history': bulkEditionProcedures[criterion].isDone}"
:class="{'is-field-history': bulkEditionProcedures[criterion].isDone, 'hidden-select-arrow': !!bulkEditionProcedures[criterion].action }"
v-if="bulkEditionProcedures[criterion] &&
bulkEditionProcedures[criterion].metadatumID"
:disabled="!!bulkEditionProcedures[criterion].action"
@ -118,7 +118,7 @@
v-else-if="bulkEditionProcedures[criterion] &&
bulkEditionProcedures[criterion].metadatumID == 'status'">
<b-select
:class="{'is-field-history': bulkEditionProcedures[criterion].isDone}"
:class="{'is-field-history': bulkEditionProcedures[criterion].isDone, 'hidden-select-arrow': bulkEditionProcedures[criterion].isDone}"
:disabled="bulkEditionProcedures[criterion].isDone"
class="tainacan-bulk-edition-field tainacan-bulk-edition-field-last"
:placeholder="$i18n.get('instruction_select_a_status2')"
@ -370,10 +370,10 @@
add: this.$i18n.get('add_value'),
redefine: this.$i18n.get('set_new_value'),
remove: this.$i18n.get('remove_value'),
replace: this.$i18n.get('replace_value'),
replace: this.$i18n.get('replace_value')
},
editionActionsForNotMultiple: {
redefine: this.$i18n.get('set_new_value'),
redefine: this.$i18n.get('set_new_value')
},
bulkEditionProcedures: {
1: {
@ -432,7 +432,7 @@
let index = this.editionCriteria.indexOf(criterion);
this.dones[index] = !withError;
this.$set(this.bulkEditionProcedures[criterion], 'isExecuting', false);
},
executeBulkEditionProcedure(criterion){

View File

@ -142,10 +142,12 @@
...mapActions('collection', [
'fetchCollections'
]),
updateExporterOptions(){
runExporter(){
this.runButtonLoading = true;
let formElement = document.getElementById('exporterOptionsForm');
let formData = new FormData(formElement);
let options = {};
for (let [key, value] of formData.entries())
@ -153,21 +155,9 @@
let exporterSessionUpdated = {
body: {
options: options,
},
id: this.exporterSession.id,
};
return this.updateExporterSession(exporterSessionUpdated)
.then(exporterSessionUpdated => this.verifyError(exporterSessionUpdated));
},
runExporter(){
this.runButtonLoading = true;
let exporterSessionUpdated = {
body: {
mapping_selected: this.selectedMapping ? this.selectedMapping : this.selectedMapping,
send_email: this.sendEmail
mapping_selected: this.selectedMapping,
send_email: this.sendEmail,
options: options
},
id: this.exporterSession.id,
};
@ -176,26 +166,28 @@
exporterSessionUpdated['body']['collection'] = {
id: this.selectedCollection
};
}
}
this.updateExporterSession(exporterSessionUpdated)
.then(exporterSessionUpdated => {
this.verifyError(exporterSessionUpdated);
.then(() => {
if (!this.formErrorMessage) {
this.runExporterSession(this.exporterSession.id)
.then((bgp) => {
this.runButtonLoading = false;
this.$router.push(this.$routerHelper.getProcessesPage(bgp.bg_process_id));
})
.catch((error) => {
this.formErrorMessage = error.error_message;
this.runButtonLoading = false;
});
}
this.updateExporterOptions().then(() => {
if(!this.formErrorMessage) {
this.runExporterSession(this.exporterSession.id)
.then((bgp) => {
this.runButtonLoading = false;
this.$router.push(this.$routerHelper.getProcessesPage(bgp.bg_process_id));
})
.catch(() => {
this.runButtonLoading = false;
});
}
});
})
.catch(() => this.runButtonLoading = false);
.catch((error) => {
this.formErrorMessage = error.error_message;
this.runButtonLoading = false;
});
},
formIsValid(){
return (
@ -204,15 +196,6 @@
this.exporterSession.accept_no_mapping) &&
!this.formErrorMessage
);
},
verifyError(response){
if(response.constructor.name === 'Object' &&
(response.data && response.data.status &&
response.data.status.toString().split('')[0] != 2) || response.error_message) {
this.formErrorMessage = response.data.error_message;
} else {
this.exporterSession = response.data;
}
}
},
created(){

View File

@ -704,12 +704,6 @@ export default {
// Loads Filters
this.refreshFilters();
// On repository level we also fetch collection filters
if (this.isRepositoryLevel) {
this.fetchRepositoryCollectionFilters()
.catch(() => this.isLoadingFilters = false);
}
// Obtains collection name
if (!this.isRepositoryLevel) {

View File

@ -64,8 +64,8 @@
type="search"
:aria-label="$i18n.get('instruction_search') + ' ' + $i18n.get('terms')"
autocomplete="on"
:value="searchQuery"
@keyup.enter="searchQuery = $event.target.value;searchTerms(0)"
v-model="searchQuery"
@keyup.enter="searchTerms(0)"
:disabled="isEditingTerm">
<span
@click="searchTerms(0)"

View File

@ -30,11 +30,13 @@ import FilterSelectbox from '../../classes/filter-types/selectbox/Selectbox.vue'
import FilterAutocomplete from '../../classes/filter-types/autocomplete/Autocomplete.vue';
import FilterCheckbox from '../../classes/filter-types/checkbox/Checkbox.vue';
import FilterTaginput from '../../classes/filter-types/taginput/Taginput.vue';
import FilterNumericInterval from '../../classes/filter-types/numeric-interval/NumericInterval.vue';
import FilterTaxonomyCheckbox from '../../classes/filter-types/taxonomy/Checkbox.vue';
import FilterTaxonomyTaginput from '../../classes/filter-types/taxonomy/Taginput.vue';
import FormNumeric from '../../classes/filter-types/numeric/FormNumeric.vue';
import FormNumericInterval from '../../classes/filter-types/numeric-interval/FormNumericInterval.vue';
// import FormDate from '../../classes/filter-types/date/FormDate.vue';
import TainacanFormItem from '../../classes/metadata-types/tainacan-form-item.vue';
@ -50,6 +52,10 @@ import eventBusSearch from '../../js/event-bus-search';
import termsListBus from './terms-list-bus.js';
import { I18NPlugin, UserPrefsPlugin, RouterHelperPlugin, ConsolePlugin, UserCapabilitiesPlugin, StatusHelperPlugin } from './utilities';
import FilterNumericListInterval from '../../classes/filter-types/numeric-list-interval/NumericListInterval.vue';
import FormNumericListInterval from '../../classes/filter-types/numeric-list-interval/FormNumericListInterval.vue';
// Configure and Register Plugins
Vue.use(Buefy, {
defaultTooltipAnimated: true
@ -89,8 +95,13 @@ Vue.component('tainacan-filter-checkbox', FilterCheckbox);
Vue.component('tainacan-filter-taginput', FilterTaginput);
Vue.component('tainacan-filter-taxonomy-checkbox', FilterTaxonomyCheckbox);
Vue.component('tainacan-filter-taxonomy-taginput', FilterTaxonomyTaginput);
Vue.component('tainacan-filter-numeric-interval', FilterNumericInterval);
Vue.component('tainacan-filter-numeric-list-interval', FilterNumericListInterval);
/* Filter Metadata Option forms */
Vue.component('tainacan-filter-form-numeric', FormNumeric);
Vue.component('tainacan-filter-form-numeric-interval', FormNumericInterval);
Vue.component('tainacan-filter-form-numeric-list-interval', FormNumericListInterval);
// Vue.component('tainacan-filter-form-date', FormDate);
/* Others */

View File

@ -12,9 +12,10 @@ import FilterSelectbox from '../../classes/filter-types/selectbox/Selectbox.vue'
import FilterAutocomplete from '../../classes/filter-types/autocomplete/Autocomplete.vue';
import FilterCheckbox from '../../classes/filter-types/checkbox/Checkbox.vue';
import FilterTaginput from '../../classes/filter-types/taginput/Taginput.vue';
import FilterTaxonomyCheckbox from '../../classes/filter-types/taxonomy/Checkbox.vue';
import FilterTaxonomyTaginput from '../../classes/filter-types/taxonomy/Taginput.vue';
import FilterNumericInterval from '../../classes/filter-types/numeric-interval/NumericInterval.vue';
import FilterNumericListInterval from '../../classes/filter-types/numeric-list-interval/NumericListInterval.vue';
import TaincanFiltersList from '../../classes/filter-types/tainacan-filter-item.vue';
import ItemsPage from '../pages/lists/items-page.vue';
@ -56,6 +57,8 @@ Vue.component('tainacan-filter-checkbox', FilterCheckbox);
Vue.component('tainacan-filter-taginput', FilterTaginput);
Vue.component('tainacan-filter-taxonomy-checkbox', FilterTaxonomyCheckbox);
Vue.component('tainacan-filter-taxonomy-taginput', FilterTaxonomyTaginput);
Vue.component('tainacan-filter-numeric-interval', FilterNumericInterval);
Vue.component('tainacan-filter-numeric-list-interval', FilterNumericListInterval);
/* Others */
Vue.component('items-page', ItemsPage);

View File

@ -1066,7 +1066,7 @@
},
onChangeOrderBy(metadatum) {
this.$eventBusSearch.setOrderBy(metadatum);
this.showItemsHiddingDueSorting();
this.showItemsHiddingDueSortingDialog();
},
onChangeOrder() {
this.order == 'DESC' ? this.$eventBusSearch.setOrder('ASC') : this.$eventBusSearch.setOrder('DESC');
@ -1535,7 +1535,7 @@
}
}
this.showItemsHiddingDueSorting();
this.showItemsHiddingDueSortingDialog();
// Watches window resize to adjust filter's top position and compression on mobile
this.adjustSearchControlHeight();

View File

@ -22,7 +22,7 @@
box-shadow: none !important;
text-decoration: none !important;
}
&[disabled] {
&[disabled=disabled] {
background-color: white !important;
}
}

View File

@ -132,8 +132,14 @@
&:focus>option:checked, &:focus>option:hover {
background-color: $turquoise1 !important;
}
}
&[disabled=disabled] {
border: 1px solid $gray1 !important;
}
}
}
.hidden-select-arrow .select::after {
color: transparent !important;
}
.dropdown {
width: 100%;
.dropdown-trigger { width: 100% }

View File

@ -133,9 +133,10 @@ return apply_filters( 'tainacan-admin-i18n', [
'title_exporter_page' => __( 'Exporter', 'tainacan'),
// Labels (used mainly on Aria Labels and Inputs)
'label' => __( 'label', 'tainacan' ),
'label_clean' => __( 'Clear', 'tainacan' ),
'label_clear_filters' => __( 'Clear filters', 'tainacan' ),
'label_and' => __( 'and', 'tainacan' ),
'label_and' => __( 'and', 'tainacan' ),
'label_selected' => __( 'Selected', 'tainacan' ),
'label_relationship_new_search' => __( 'New Search', 'tainacan' ),
'label_relationship_items_found' => __( 'Items found', 'tainacan' ),
@ -479,11 +480,13 @@ return apply_filters( 'tainacan-admin-i18n', [
'instruction_click_or_drag_metadatum_create' => __( 'Click or drag and drop to create a new metadatum', 'tainacan' ),
'instruction_drag_and_drop_filter_sort' => __( 'Drag and drop to change filter order', 'tainacan' ),
'instruction_drag_and_drop_metadatum_sort' => __( 'Drag and drop to change metadatum order', 'tainacan' ),
'instruction_select_a_date' => __( 'Select a date', 'tainacan' ),
'instruction_select_a_month' => __( 'Select a month', 'tainacan' ),
'instruction_type_value_year' => __( 'Type year value', 'tainacan' ),
'instruction_select_the_amount_of_copies' => __( 'Select the amount of copies of the item that you want to create', 'tainacan'),
'instruction_filter_activities_date' => __( 'Range of dates', 'tainacan'),
'instruction_select_a_date' => __( 'Select a date', 'tainacan' ),
'instruction_select_a_month' => __( 'Select a month', 'tainacan' ),
'instruction_type_value_year' => __( 'Type year value', 'tainacan' ),
'instruction_select_the_amount_of_copies' => __( 'Select the amount of copies of the item that you want to create', 'tainacan'),
'instruction_select_a_interval' => __( 'Select an interval', 'tainacan'),
// Info. Other feedback to user.
'info_items_tab_all' => __( 'Every published item, including those visible only to editors.', 'tainacan' ),
@ -646,7 +649,7 @@ return apply_filters( 'tainacan-admin-i18n', [
'info_process_status_cancelled' => __('Cancelled', 'tainacan'),
'info_process_status_paused' => __('Paused', 'tainacan'),
'info_process_status_running' => __('Running', 'tainacan'),
'info_warning_process_cancelled' => __( 'Are you sure? This process will be cancelled', 'tainacan' ),
'info_warning_process_cancelled' => __( 'Are you sure? This process will be cancelled', 'tainacan' ),
'info_empty' => __( 'empty', 'tainacan' ),
'info_url_copied' => __( 'URL link copied', 'tainacan' ),
'info_other_options' => __( 'Other options: ', 'tainacan'),
@ -659,6 +662,8 @@ return apply_filters( 'tainacan-admin-i18n', [
'info_await_while_item_copy' => __( 'Please wait while copy is being created...', 'tainacan'),
'info_await_while_item_copies' => __( 'Please wait while copies are being created. This may take a while...', 'tainacan'),
'info_expose_only_displayed_metadata' => __( 'By checking this option, only metatada that are displayed on the current list will be exposed', 'tainacan' ),
'info_initial_value' => __( 'Initial value', 'tainacan' ),
'info_final_value' => __( 'Final value', 'tainacan' ),
// Tainacan Metadatum Types
'tainacan-text' => __( 'Text', 'tainacan' ),
@ -681,6 +686,7 @@ return apply_filters( 'tainacan-admin-i18n', [
'tainacan-filter-taxonomy-taginput' => __( 'Taxonomy Tag Input', 'tainacan' ),
'tainacan-filter-taxonomy-checkbox' => __( 'Taxonomy Check Box', 'tainacan' ),
'tainacan-filter-taxonomy-selectbox' => __( 'Taxonomy Select Box', 'tainacan' ),
'tainacan-filter-numeric-interval' => __( 'Numeric Interval', 'tainacan' ),
// Datepicker months
'datepicker_month_january' => __( 'January', 'tainacan' ),

View File

@ -153,7 +153,37 @@ export default {
}
}
}
.metadata-alert {
display: flex;
justify-content: space-between;
align-items: center;
margin: 6px $page-side-padding;
border-radius: 3px;
padding: 4px 12px;
color: $yellow2;
background: $yellow1;
animation-name: appear;
animation-duration: 0.5s;
p {
margin: 0 auto;
}
&>div {
display: flex;
.button,
.button:hover,
.button:active,
.button:focus {
background: none;
color:$yellow2;
font-weight: bold;
border: none;
cursor: pointer;
}
}
}
.search-control {
justify-content: flex-start !important;

View File

@ -68,7 +68,7 @@ class REST_Exporters_Controller extends REST_Controller {
],
'options' => [
'type' => 'array/object',
'description' => __( 'The importer options', 'tainacan' ),
'description' => __( 'The exporter options', 'tainacan' ),
]
],
),
@ -172,7 +172,7 @@ class REST_Exporters_Controller extends REST_Controller {
}
return new \WP_REST_Response([
'error_message' => __('Importer Session not found', 'tainacan' ),
'error_message' => __('Exporter Session not found', 'tainacan' ),
'session_id' => $session_id
], 400);
}

View File

@ -46,17 +46,17 @@
export default {
created(){
this.collection = ( this.collection_id ) ? this.collection_id : this.filter.collection_id;
this.metadatum = ( this.metadatum_id ) ? this.metadatum_id : this.filter.metadatum.metadatum_id;
this.collection = this.filter.collection_id;
this.metadatum = this.filter.metadatum.metadatum_id;
const vm = this;
let in_route = '/collection/' + this.collection + '/metadata/' + this.metadatum;
let endpoint = '/collection/' + this.collection + '/metadata/' + this.metadatum;
if(this.isRepositoryLevel || this.collection == 'default'){
if (this.isRepositoryLevel || this.collection == 'default'){
in_route = '/metadata/'+ this.metadatum;
}
axios.get(in_route)
axios.get(endpoint)
.then( res => {
let result = res.data;
if( result && result.metadata_type ){

View File

@ -3,12 +3,6 @@
:style="{ 'height': isLoadingOptions ? (Number(filter.max_options)*28) + 'px' : 'auto' }"
:class="{ 'skeleton': isLoadingOptions }"
class="block">
<!-- <span
v-if="isLoadingOptions"
style="width: 100%; position: absolute;"
class="icon has-text-centered loading-icon">
<div class="control has-icons-right is-loading is-clearfix" />
</span> -->
<div
v-for="(option, index) in options.slice(0, filter.max_options)"
v-if="!isLoadingOptions"
@ -29,15 +23,6 @@
class="has-text-gray">&nbsp;{{ "(" + option.total_items + ")" }}</span>
</span>
</label>
<!-- <b-checkbox
v-if="index <= filter.max_options - 1"
v-model="selected"
:native-value="option.value">
<span class="checkbox-label-text">{{ option.label }}</span>
<span
v-if="option.total_items != undefined"
class="has-text-gray">{{ "(" + option.total_items + ")" }}</span>
</b-checkbox> -->
<button
class="view-all-button link-style"
v-if="option.showViewAllButton && index == options.slice(0, filter.max_options).length - 1"
@ -60,8 +45,8 @@
export default {
created(){
this.collection = ( this.collection_id ) ? this.collection_id : this.filter.collection_id;
this.metadatum = ( this.metadatum_id ) ? this.metadatum_id : this.filter.metadatum.metadatum_id;
this.collection = this.filter.collection_id;
this.metadatum = this.filter.metadatum.metadatum_id;
let route = '/collection/' + this.collection + '/metadata/' + this.metadatum +'?nopaging=1';

View File

@ -73,16 +73,16 @@
export default {
mixins: [ wpAjax, dateInter ],
created() {
this.collection = ( this.collection_id ) ? this.collection_id : this.filter.collection_id;
this.metadatum = ( this.metadatum_id ) ? this.metadatum_id : this.filter.metadatum.metadatum_id;
this.collection = this.filter.collection_id;
this.metadatum = this.filter.metadatum.metadatum_id;
let in_route = '/collection/' + this.collection + '/metadata/' + this.metadatum;
let endpoint = '/collection/' + this.collection + '/metadata/' + this.metadatum;
if(this.isRepositoryLevel || this.collection == 'default'){
if (this.isRepositoryLevel || this.collection == 'default'){
in_route = '/metadata/'+ this.metadatum;
}
axios.get(in_route)
axios.get(endpoint)
.then( res => {
let result = res.data;
if( result && result.metadata_type ){
@ -113,11 +113,7 @@
}
},
props: {
filter: {
type: Object // concentrate all attributes metadatum id and type
},
metadatum_id: [Number], // not required, but overrides the filter metadatum id if is set
collection_id: [Number], // not required, but overrides the filter metadatum id if is set
filter: Object,
labelId: '',
query: Object,
isRepositoryLevel: Boolean,

View File

@ -116,16 +116,16 @@
export default {
mixins: [ wpAjax, dateInter ],
created() {
this.collection = ( this.collection_id ) ? this.collection_id : this.filter.collection_id;
this.metadatum = ( this.metadatum_id ) ? this.metadatum_id : (typeof this.filter.metadatum.metadatum_id == 'object' ? this.filter.metadatum.metadatum_id.metadatum_id : this.filter.metadatum.metadatum_id);
this.collection = this.filter.collection_id;
this.metadatum = (typeof this.filter.metadatum.metadatum_id == 'object' ? this.filter.metadatum.metadatum_id.metadatum_id : this.filter.metadatum.metadatum_id);
this.options = this.filter.filter_type_options;
let in_route = '/collection/' + this.collection + '/metadata/' + this.metadatum;
let endpoint = '/collection/' + this.collection + '/metadata/' + this.metadatum;
if (this.isRepositoryLevel || this.collection == 'default')
in_route = '/metadata/'+ this.metadatum;
axios.get(in_route)
axios.get(endpoint)
.then( res => {
let result = res.data;
if ( result && result.metadata_type ){
@ -153,11 +153,7 @@
}
},
props: {
filter: {
type: Object // concentrate all attributes metadatum id and type
},
metadatum_id: [Number], // not required, but overrides the filter metadatum id if is set
collection_id: [Number], // not required, but overrides the filter metadatum id if is set
filter: Object,
labelId: '',
query: Object,
isRepositoryLevel: Boolean,

View File

@ -12,11 +12,7 @@ export const filter_type_mixin = {
}
},
props: {
filter: {
type: Object // concentrate all attributes metadatum id and type
},
metadatum_id: [Number], // not required, but overrides the filter metadatum id if is set
collection_id: [Number], // not required, but overrides the filter metadatum id if is set
filter: Object,
id: '',
query: {}
},
@ -54,7 +50,7 @@ export const filter_type_mixin = {
if (isRepositoryLevel || this.filter.collection_id == 'default')
url = `/facets/${metadatumId}?getSelected=${getSelected}&`;
else
url = `/collection/${this.collection}/facets/${metadatumId}?getSelected=${getSelected}&`;
url = `/collection/${this.filter.collection_id}/facets/${metadatumId}?getSelected=${getSelected}&`;
if (offset != undefined && number != undefined) {
if (!this.isUsingElasticSearch)

View File

@ -0,0 +1,103 @@
<template>
<div>
<b-field :addons="false">
<label class="label is-inline">
{{ $i18n.getHelperTitle('tainacan-filter-numeric-interval', 'step') }}<span>&nbsp;*&nbsp;</span>
<help-button
:title="$i18n.getHelperTitle('tainacan-filter-numeric-interval', 'step')"
:message="$i18n.getHelperMessage('tainacan-filter-numeric-interval', 'step')"/>
</label>
<div
v-if="!showEditStepOptions"
class="is-flex">
<b-select
name="step_options"
v-model="step"
@input="onUpdate">
<option value="0.001">0.001</option>
<option value="0.01">0.01</option>
<option value="0.1">0.1</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="5">5</option>
<option value="10">10</option>
<option value="100">100</option>
<option value="1000">1000</option>
<option
v-if="step && ![0.001,0.01,0.1,1,2,5,10,100,1000].find( (element) => element == step )"
:value="step">
{{ step }}</option>
</b-select>
<button
class="button is-white is-pulled-right"
:aria-label="$i18n.get('edit')"
@click.prevent="showEditStepOptions = true">
<span
v-tooltip="{
content: $i18n.get('edit'),
autoHide: true,
placement: 'bottom'
}"
class="icon">
<i class="tainacan-icon tainacan-icon-18px tainacan-icon-edit has-text-secondary"/>
</span>
</button>
</div>
<div
v-if="showEditStepOptions"
class="is-flex">
<b-input
name="max_options"
v-model="step"
@input="onUpdate"
type="number"
step="1" />
<button
@click.prevent="showEditStepOptions = false"
class="button is-white is-pulled-right">
<span
v-tooltip="{
content: $i18n.get('close'),
autoHide: true,
placement: 'bottom'
}"
class="icon">
<i class="tainacan-icon tainacan-icon-18px tainacan-icon-close has-text-secondary"/>
</span>
</button>
</div>
</b-field>
</div>
</template>
<script>
export default {
props: {
filter: {
type: Object
},
value: [String, Number, Array],
id: '',
disabled: false,
},
data() {
return {
step: [Number, String],
showEditStepOptions: false
}
},
methods: {
onUpdate() {
this.$emit('input', {
step: this.step
});
},
},
created() {
this.step = this.value && this.value.step ? this.value.step : 1;
}
}
</script>

View File

@ -0,0 +1,147 @@
<template>
<div>
<b-numberinput
:aria-labelledby="labelId"
size="is-small"
@input="validate_values()"
:step="options.step"
v-model="valueInit"/>
<p class="is-size-7 has-text-centered is-marginless">{{ $i18n.get('label_until') }}</p>
<b-numberinput
:aria-labelledby="labelId"
size="is-small"
@input="validate_values()"
:step="options.step"
v-model="valueEnd"/>
</div>
</template>
<script>
export default {
created() {
this.collectionId = this.filter.collection_id;
this.metadatumId = this.filter.metadatum.metadatum_id;
this.options = this.filter.filter_type_options;
this.$eventBusSearch.$on('removeFromFilterTag', this.cleanSearchFromTags);
},
data(){
return {
valueInit: 0,
valueEnd: 10,
isValid: false,
collectionId: '',
metadatum: '',
options: [],
}
},
props: {
filter: Object,
labelId: '',
query: Object,
isRepositoryLevel: Boolean
},
methods: {
// only validate if the first value is higher than first
validate_values: _.debounce( function (){
if ( parseFloat( this.valueInit ) > parseFloat( this.valueEnd )) {
//this.valueEnd = parseFloat( this.valueInit ) + 1;
//this.error_message();
return;
}
this.emit();
}, 600),
// message for error
error_message(){
if ( !this.isTouched ) return false;
this.$buefy.toast.open({
duration: 3000,
message: this.$i18n.get('info_error_first_value_greater'),
position: 'is-bottom',
type: 'is-danger'
})
},
cleanSearchFromTags(filterTag) {
if (filterTag.filterId == this.filter.id)
this.clearSearch();
},
clearSearch(){
this.$emit('input', {
filter: 'range',
compare: 'BETWEEN',
metadatum_id: this.metadatumId,
collection_id: this.collectionId,
value: ''
});
this.valueEnd = null;
this.valueInit = null;
},
// emit the operation for listeners
emit() {
let values = [ this.valueInit, this.valueEnd ];
let type = ! Number.isInteger( this.valueInit ) || ! Number.isInteger( this.valueEnd ) ? 'DECIMAL(20,3)' : 'NUMERIC';
this.$emit('input', {
type: type,
//filter: 'range',
compare: 'BETWEEN',
metadatum_id: this.metadatumId,
collection_id: this.collectionId,
value: values
});
if (values[0] != undefined && values[1] != undefined) {
this.$eventBusSearch.$emit( 'sendValuesToTags', {
filterId: this.filter.id,
value: values[0] + ' - ' + values[1]
});
}
},
selectedValues(){
if ( !this.query || !this.query.metaquery || !Array.isArray( this.query.metaquery ) )
return false;
let index = this.query.metaquery.findIndex(newMetadatum => newMetadatum.key == this.metadatumId );
if ( index >= 0 ){
let metaquery = this.query.metaquery[ index ];
if ( metaquery.value && metaquery.value.length > 1 ) {
this.valueInit = metaquery.value[0];
this.valueEnd = metaquery.value[1];
}
if (metaquery.value[0] != undefined && metaquery.value[1] != undefined) {
this.$eventBusSearch.$emit( 'sendValuesToTags', {
filterId: this.filter.id,
value: this.valueInit + ' - ' + this.valueEnd
});
}
} else {
return false;
}
},
},
mounted() {
this.selectedValues();
},
beforeDestroy() {
this.$eventBusSearch.$off('removeFromFilterTag', this.cleanSearchFromTags);
}
}
</script>
<style scoped>
.field {
margin-bottom: 0.125rem !important;
}
p.is-size-7 {
margin-bottom: 0.125rem !important;
}
</style>

View File

@ -0,0 +1,87 @@
<?php
namespace Tainacan\Filter_Types;
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
/**
* Class TainacanMetadatumType
*/
class Numeric_Interval extends Filter_Type {
function __construct(){
$this->set_supported_types(['float']);
$this->set_component('tainacan-filter-numeric-interval');
$this->set_form_component('tainacan-filter-form-numeric-interval');
$this->set_use_max_options(false);
$this->set_default_options([
'step' => 1,
'input-mode' => 'custom'
]);
$this->set_preview_template('
<div>
<div class="b-numberinput field is-grouped">
<p class="control">
<button type="button" class="button is-primary is-small">
<span class="icon is-small">
<i class="mdi mdi-minus"></i>
</span>
</button>
</p>
<div class="control is-small is-clearfix">
<input type="number" step="0.01" class="input is-small" value="6">
</div>
<p class="control">
<button type="button" class="button is-primary is-small">
<span class="icon is-small">
<i class="mdi mdi-plus"></i>
</span>
</button>
</p>
</div>
<p class="is-size-7 has-text-centered is-marginless">until</p>
<div class="b-numberinput field is-grouped">
<p class="control">
<button type="button" class="button is-primary is-small">
<span class="icon is-small">
<i class="mdi mdi-minus"></i>
</span>
</button>
</p>
<div class="control is-small is-clearfix">
<input type="number" step="0.01" class="input is-small" value="10">
</div>
<p class="control">
<button type="button" class="button is-primary is-small">
<span class="icon is-small">
<i class="mdi mdi-plus"></i>
</span>
</button>
</p>
</div>
</div>
');
}
public function get_form_labels(){
return [
'step' => [
'title' => __( 'Step', 'tainacan' ),
'description' => __( 'The amount to be increased or decreased when clicking on filter control buttons. This alo defines whether the input accepts decimal numbers.', 'tainacan' ),
],
'custom' => ['title' => __('Custom interval','tainacan')],
];
}
/**
* @param $filter
* @return string
* @internal param $metadatum
*/
public function render( $filter ){
return '<tainacan-filter-numeric-interval
name="'.$filter->get_name().'"
collection_id="'.$filter->get_collection_id().'"
metadatum_id="'.$filter->get_metadatum()->get_id().'"></tainacan-filter-numeric-interval>';
}
}

View File

@ -0,0 +1,139 @@
<template>
<b-field :addons="false">
<label class="label is-inline">
{{ $i18n.getHelperTitle('tainacan-filter-numeric-list-interval', 'predefined_intervals') }}<span>&nbsp;</span>
<help-button
:title="$i18n.getHelperTitle('tainacan-filter-numeric-list-interval', 'predefined_intervals')"
:message="$i18n.getHelperMessage('tainacan-filter-numeric-list-interval', 'predefined_intervals')"/>
</label>
<div v-if="intervals.length == 0" >
<br>
<a
role="button"
@click="addInterval()"
class="is-inline add-link">
<span class="icon is-small">
<i class="tainacan-icon has-text-secondary tainacan-icon-add"/>
</span>
&nbsp;{{ $i18n.get('add_value') }}
</a>
</div>
<transition-group name="filter-item">
<div
class="options-input"
v-for="(interval, index) of intervals"
:key="index">
<b-field>
<b-input
expanded="true"
:placeholder="$i18n.get('label')"
@input="onUpdate"
v-model="interval.label" />
</b-field>
<b-field>
<b-input
type="number"
:placeholder="$i18n.get('info_initial_value')"
@input="onUpdate"
v-model="interval.from" />
<b-input
type="number"
:placeholder="$i18n.get('info_final_value')"
@input="onUpdate"
v-model="interval.to" />
</b-field>
<p class="control">
<a
role="button"
@click="addInterval(index)"
class="is-inline add-link"
:title="$i18n.get('add_value')">
<span class="icon is-small">
<i class="tainacan-icon has-text-secondary tainacan-icon-add"/>
</span>
&nbsp;{{ $i18n.get('add_value') }}
</a>
</p>
<p class="control">
<a
role="button"
@click="removeInterval(index)"
class="is-inline add-link"
:title="$i18n.get('remove_value')">
<span class="icon is-small">
<i class="tainacan-icon has-text-secondary tainacan-icon-repprovedcircle"/>
</span>
&nbsp;{{ $i18n.get('remove_value') }}
</a>
</p>
</div>
</transition-group>
</b-field>
</template>
<script>
export default {
props: {
filter: {
type: Object
},
value: [String, Number, Array],
id: '',
disabled: false,
},
data() {
return {
intervals: [],
}
},
methods: {
onUpdate() {
this.$emit('input', {
intervals: this.intervals,
});
},
removeInterval(index) {
this.intervals.splice(index, 1);
},
addInterval(index) {
if (index != undefined) {
this.intervals.splice(index + 1, 0, {
label: '',
to: null,
from: null
})
} else {
this.intervals.push({
label: '',
to: null,
from: null
});
}
}
},
created() {
this.intervals = this.value && this.value.intervals ? this.value.intervals : [];
}
}
</script>
<style scoped lang="scss">
@import '../../scss/_variables.scss';
.options-input {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.field:first-child {
width: 100%;
margin-top: 1rem;
margin-bottom: -1px;
}
.field.has-addons {
margin-bottom: 0.125rem;
}
}
</style>

View File

@ -0,0 +1,137 @@
<template>
<div>
<b-select
:placeholder="$i18n.get('instruction_select_a_interval')"
@input="changeInterval"
v-model="selectedInterval">
<option
v-for="(interval, index) in options.intervals"
:value="index"
:key="index">
{{ interval.label }}
</option>
</b-select>
</div>
</template>
<script>
export default {
created() {
this.collectionId = this.filter.collection_id;
this.metadatumId = this.filter.metadatum.metadatum_id;
this.options = this.filter.filter_type_options;
this.$eventBusSearch.$on('removeFromFilterTag', this.cleanSearchFromTags);
},
data() {
return {
valueInit: 0,
valueEnd: 10,
isValid: false,
collectionId: '',
metadatum: '',
options: [],
selectedInterval: ''
}
},
props: {
filter: {
type: Object // concentrate all attributes metadatum id and type
},
labelId: '',
query: Object,
isRepositoryLevel: Boolean,
},
methods: {
cleanSearchFromTags(filterTag) {
if (filterTag.filterId == this.filter.id)
this.clearSearch();
},
changeInterval() {
if (this.selectedInterval !== '') {
this.valueInit = this.options.intervals[this.selectedInterval].from;
this.valueEnd = this.options.intervals[this.selectedInterval].to;
this.emit();
} else {
this.clearSearch();
}
},
clearSearch(){
this.$emit('input', {
filter: 'range',
compare: 'BETWEEN',
metadatum_id: this.metadatumId,
collection_id: this.collectionId,
value: ''
});
this.valueEnd = null;
this.valueInit = null;
},
// emit the operation for listeners
emit() {
let values = [ this.valueInit, this.valueEnd ];
let type = ! Number.isInteger( this.valueInit ) || ! Number.isInteger( this.valueEnd ) ? 'DECIMAL' : 'NUMERIC';
this.$emit('input', {
type: type,
compare: 'BETWEEN',
metadatum_id: this.metadatumId,
collection_id: this.collectionId,
value: values
});
if (values[0] != undefined && values[1] != undefined) {
this.$eventBusSearch.$emit( 'sendValuesToTags', {
filterId: this.filter.id,
value: this.options.intervals[this.selectedInterval].label + `(${values[0]}-${values[1]})`
//value: values[0] + ' - ' + values[1]
});
}
},
selectedValues(){
if ( !this.query || !this.query.metaquery || !Array.isArray( this.query.metaquery ) )
return false;
let index = this.query.metaquery.findIndex(newMetadatum => newMetadatum.key == this.metadatumId );
if ( index >= 0 ) {
let metaquery = this.query.metaquery[ index ];
if ( !metaquery.value ||
!metaquery.value.length > 1 ||
metaquery.value[0] == undefined ||
metaquery.value[1] == undefined )
return false
this.valueInit = metaquery.value[0];
this.valueEnd = metaquery.value[1];
this.selectedInterval = this.options.intervals.findIndex(
anInterval => anInterval.from == this.valueInit && anInterval.to == this.valueEnd
);
this.$eventBusSearch.$emit( 'sendValuesToTags', {
filterId: this.filter.id,
value: this.options.intervals[this.selectedInterval].label + `(${this.valueInit}-${this.valueEnd})`
});
} else {
return false;
}
},
},
mounted() {
this.selectedValues();
},
beforeDestroy() {
this.$eventBusSearch.$off('removeFromFilterTag', this.cleanSearchFromTags);
}
}
</script>
<style scoped>
.field {
margin-bottom: 0.125rem !important;
}
p.is-size-7 {
margin-bottom: 0.125rem !important;
}
</style>

View File

@ -0,0 +1,85 @@
<?php
namespace Tainacan\Filter_Types;
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
/**
* Class TainacanMetadatumType
*/
class Numeric_List_Interval extends Filter_Type {
function __construct(){
$this->set_supported_types(['float']);
$this->set_component('tainacan-filter-numeric-list-interval');
$this->set_form_component('tainacan-filter-form-numeric-list-interval');
$this->set_use_max_options(false);
$this->set_default_options([
'intervals' => []
]);
$this->set_preview_template('
<div>
<div class="b-numberinput field is-grouped">
<p class="control">
<button type="button" class="button is-primary is-small">
<span class="icon is-small">
<i class="mdi mdi-minus"></i>
</span>
</button>
</p>
<div class="control is-small is-clearfix">
<input type="number" step="0.01" class="input is-small" value="6">
</div>
<p class="control">
<button type="button" class="button is-primary is-small">
<span class="icon is-small">
<i class="mdi mdi-plus"></i>
</span>
</button>
</p>
</div>
<p class="is-size-7 has-text-centered is-marginless">until</p>
<div class="b-numberinput field is-grouped">
<p class="control">
<button type="button" class="button is-primary is-small">
<span class="icon is-small">
<i class="mdi mdi-minus"></i>
</span>
</button>
</p>
<div class="control is-small is-clearfix">
<input type="number" step="0.01" class="input is-small" value="10">
</div>
<p class="control">
<button type="button" class="button is-primary is-small">
<span class="icon is-small">
<i class="mdi mdi-plus"></i>
</span>
</button>
</p>
</div>
</div>
');
}
public function get_form_labels() {
return [
'predefined_intervals' => [
'title' => __('Predefined intervals','tainacan'),
'description' => __('Predefined intervals','tainacan')
],
];
}
/**
* @param $filter
* @return string
* @internal param $metadatum
*/
public function render( $filter ) {
return '<tainacan-filter-numeric-list-interval
name="'.$filter->get_name().'"
collection_id="'.$filter->get_collection_id().'"
metadatum_id="'.$filter->get_metadatum()->get_id().'"></tainacan-filter-numeric-interval>';
}
}

View File

@ -75,16 +75,16 @@
export default {
mixins: [ wpAjax ],
created() {
this.collection = ( this.collection_id ) ? this.collection_id : this.filter.collection_id;
this.metadatum = ( this.metadatum_id ) ? this.metadatum_id : (typeof this.filter.metadatum.metadatum_id == 'object' ? this.filter.metadatum.metadatum_id.metadatum_id : this.filter.metadatum.metadatum_id);
this.collection = this.filter.collection_id;
this.metadatum = (typeof this.filter.metadatum.metadatum_id == 'object' ? this.filter.metadatum.metadatum_id.metadatum_id : this.filter.metadatum.metadatum_id);
this.options = this.filter.filter_type_options;
let in_route = '/collection/' + this.collection + '/metadata/' + this.metadatum;
let endpoint = '/collection/' + this.collection + '/metadata/' + this.metadatum;
if (this.isRepositoryLevel || this.collection == 'default')
in_route = '/metadata/'+ this.metadatum;
axios.get(in_route)
axios.get(endpoint)
.then( res => {
let result = res.data;
if ( result && result.metadata_type ){
@ -112,11 +112,7 @@
}
},
props: {
filter: {
type: Object // concentrate all attributes metadatum id and type
},
metadatum_id: [Number], // not required, but overrides the filter metadatum id if is set
collection_id: [Number], // not required, but overrides the filter metadatum id if is set
filter: Object,
labelId: '',
query: Object,
isRepositoryLevel: Boolean,

View File

@ -30,17 +30,17 @@
export default {
created(){
this.collection = ( this.collection_id ) ? this.collection_id : this.filter.collection_id;
this.metadatum = ( this.metadatum_id ) ? this.metadatum_id : this.filter.metadatum.metadatum_id;
this.collection = this.filter.collection_id;
this.metadatum = this.filter.metadatum.metadatum_id;
const vm = this;
let in_route = '/collection/' + this.collection + '/metadata/' + this.metadatum;
let endpoint = '/collection/' + this.collection + '/metadata/' + this.metadatum;
if(this.isRepositoryLevel || this.collection == 'default'){
if (this.isRepositoryLevel || this.collection == 'default'){
in_route = '/metadata/'+ this.metadatum;
}
axios.get(in_route)
axios.get(endpoint)
.then( res => {
let result = res.data;
if( result && result.metadata_type ){

View File

@ -49,17 +49,17 @@
export default {
created(){
this.collection = ( this.collection_id ) ? this.collection_id : this.filter.collection_id;
this.metadatum = ( this.metadatum_id ) ? this.metadatum_id : this.filter.metadatum.metadatum_id;
this.collection = this.filter.collection_id;
this.metadatum = this.filter.metadatum.metadatum_id;
const vm = this;
let in_route = '/collection/' + this.collection + '/metadata/' + this.metadatum;
let endpoint = '/collection/' + this.collection + '/metadata/' + this.metadatum;
if(this.isRepositoryLevel || this.collection == 'default'){
if (this.isRepositoryLevel || this.collection == 'default'){
in_route = '/metadata/'+ this.metadatum + '?nopaging=1';
}
axios.get(in_route)
axios.get(endpoint)
.then( res => {
let result = res.data;
if( result && result.metadata_type ){

View File

@ -1,8 +1,6 @@
<template>
<b-field
class="filter-item-forms"
:message="getErrorMessage"
:type="filterTypeMessage">
class="filter-item-forms">
<b-collapse
class="show"
:open.sync="open"
@ -48,8 +46,6 @@
</template>
<script>
import { mapActions } from 'vuex';
export default {
name: 'TainacanFilterItem',
props: {
@ -61,33 +57,11 @@
data(){
return {
inputs: [],
filterTypeMessage:''
}
},
computed: {
getErrorMessage() {
let msg = '';
let errors = this.$eventBusSearch.getErrors( this.filter.id );
if ( errors) {
this.setFilterTypeMessage('is-danger');
for (let index in errors) {
msg += errors[index] + '\n';
}
} else {
this.setFilterTypeMessage('');
}
return msg;
}
},
methods: {
...mapActions('search', [
'setPage'
]),
listen( inputEvent ){
this.$eventBusSearch.$emit( 'input', ( inputEvent.metadatum_id ) ? inputEvent : inputEvent.detail[0] );
},
setFilterTypeMessage( message ){
this.filterTypeMessage = message;
}
}
}

View File

@ -53,8 +53,8 @@
export default {
created(){
this.collection = ( this.collection_id ) ? this.collection_id : this.filter.collection_id;
this.metadatum = ( this.metadatum_id ) ? this.metadatum_id : this.filter.metadatum.metadatum_id ;
this.collection = this.filter.collection_id;
this.metadatum = this.filter.metadatum.metadatum_id ;
this.type = this.filter.metadatum.metadata_type;
this.loadOptions();
@ -87,15 +87,9 @@
}
},
props: {
filter: {
type: Object // concentrate all attributes metadatum id and type
},
metadatum_id: [Number], // not required, but overrides the filter metadatum id if is set
collection_id: [Number], // not required, but overrides the filter metadatum id if is set
filter: Object,
labelId: '',
query: {
type: Object // concentrate all attributes metadatum id and type
}
query: Object
},
watch: {
selected: function(){

View File

@ -41,17 +41,17 @@
export default {
created(){
this.collection = ( this.collection_id ) ? this.collection_id : this.filter.collection_id;
this.metadatum = ( this.metadatum_id ) ? this.metadatum_id : this.filter.metadatum.metadatum_id ;
this.collection = this.filter.collection_id;
this.metadatum = this.filter.metadatum.metadatum_id;
this.type = this.filter.metadatum.metadata_type;
let in_route = '/collection/' + this.collection + '/metadata/' + this.metadatum;
let endpoint = '/collection/' + this.collection + '/metadata/' + this.metadatum;
if(this.isRepositoryLevel || this.collection == 'default'){
in_route = '/metadata/'+ this.metadatum;
if (this.isRepositoryLevel || this.collection == 'default'){
endpoint = '/metadata/'+ this.metadatum;
}
axios.get(in_route)
axios.get(endpoint)
.then( res => {
let metadatum = res.data;
this.selectedValues( metadatum.metadata_type_options.taxonomy_id );
@ -73,11 +73,7 @@
}
},
props: {
filter: {
type: Object // concentrate all attributes metadatum id and type
},
metadatum_id: [Number], // not required, but overrides the filter metadatum id if is set
collection_id: [Number], // not required, but overrides the filter metadatum id if is set
filter: Object,
labelId: '',
query: {
type: Object // concentrate all attributes metadatum id and type

View File

@ -44,12 +44,12 @@
v-for="(option, index) in metadata"
:key="index"
class="field">
<b-checkbox
name="metadata_type_relationship[search][]"
<b-radio
name="metadata_type_relationship[search]"
v-model="modelSearch"
:native-value="option.id">
{{ option.name }}
</b-checkbox>
</b-radio>
</div>
</b-field>
@ -98,7 +98,7 @@
hasMetadata: false,
loadingMetadata: false,
modelRepeated: 'yes',
modelSearch:[],
modelSearch:'',
collectionType: '',
collectionMessage: ''
}
@ -111,7 +111,7 @@
} else {
this.metadata = [];
this.hasMetadata = false;
this.modelSearch = [];
this.modelSearch = '';
this.emitValues();
}
@ -180,7 +180,7 @@
this.metadata = [];
for (let metadatum of metadata) {
if (metadatum.metadata_type !== "Tainacan\\Metadata_Types\\Relationship" && metadatum.metadata_type !== "Tainacan\\Metadata_Types\\Taxonomy") {
if (metadatum.metadata_type !== "Tainacan\\Metadata_Types\\Relationship") {
this.metadata.push( metadatum );
this.hasMetadata = true;
this.checkMetadata()
@ -207,14 +207,14 @@
},
checkMetadata(){
if( this.value && this.value.search.length > 0 ){
if( this.value && this.value.search ){
this.modelSearch = this.value.search;
} else {
try {
const json = JSON.parse( this.search );
this.modelSearch = json;
} catch(e){
this.modelSearch = [];
this.modelSearch = '';
}
}
},

View File

@ -119,20 +119,16 @@
let query = [];
if ( this.metadatum.metadatum.metadata_type_options &&
this.metadatum.metadatum.metadata_type_options.search &&
this.metadatum.metadatum.metadata_type_options.search.length > 0)
this.metadatum.metadatum.metadata_type_options.search)
{
query['metaquery'] = [];
const metaquery = query['metaquery'];
metaquery['relation'] = 'OR'
for ( let i = 0; i < this.metadatum.metadatum.metadata_type_options.search.length; i++ ){
metaquery[i] = {
key: this.metadatum.metadatum.metadata_type_options.search[i],
value: search,
compare: 'LIKE'
}
query['metaquery'][0] = {
key: this.metadatum.metadatum.metadata_type_options.search,
value: search,
compare: 'LIKE'
}
query['metaquery'] = metaquery;
} else {
query['search'] = search;
}

View File

@ -93,10 +93,10 @@ class Relationship extends Metadata_Type {
'collection_id' => __('The related collection is required','tainacan')
];
}
if ( !is_array($this->get_option('search')) ) {
// empty is ok
if ( !empty($this->get_option('search')) && !is_numeric($this->get_option('search')) ) {
return [
'search' => __('Search option must be an array','tainacan')
'search' => __('Search option must be a numeric Metadatum ID','tainacan')
];
}

View File

@ -141,6 +141,8 @@ $Tainacan_Filters->register_filter_type('Tainacan\Filter_Types\Taginput');
$Tainacan_Filters->register_filter_type('Tainacan\Filter_Types\Checkbox');
$Tainacan_Filters->register_filter_type('Tainacan\Filter_Types\TaxonomyTaginput');
$Tainacan_Filters->register_filter_type('Tainacan\Filter_Types\TaxonomyCheckbox');
$Tainacan_Filters->register_filter_type('Tainacan\Filter_Types\Numeric_Interval');
$Tainacan_Filters->register_filter_type('Tainacan\Filter_Types\Numeric_List_Interval');
$Tainacan_Taxonomies = \Tainacan\Repositories\Taxonomies::get_instance();

View File

@ -112,10 +112,18 @@ class CSV extends Exporter {
$metadata = $collection->get_metadata();
foreach ($metadata as $meta) {
$line[] = $meta->get_name();
$meta_type = explode('\\', $meta->get_metadata_type()) ;
$meta_type = strtolower($meta_type[sizeof($meta_type)-1]);
$desc_title_meta = $meta->get_name() .
($meta->is_multiple() ? '|multiple': '') .
($meta->is_required() ? '|required': '') .
('|display_' . $meta->get_display()) .
($meta->is_collection_key() ? '|collection_key_yes' : '') .
('|' . $meta_type);
$line[] = $desc_title_meta;
}
}
}

View File

@ -25,6 +25,7 @@ registerBlockType('tainacan/carousel-collections-list', {
</svg>,
category: 'tainacan-blocks',
keywords: [ __( 'collections', 'tainacan' ), __( 'carousel', 'tainacan' ), __( 'slider', 'tainacan' ) ],
description: __('List collections on a Carousel, using search or collection selection.', 'tainacan'),
attributes: {
content: {
type: 'array',

View File

@ -19,6 +19,7 @@ registerBlockType('tainacan/collections-list', {
</svg>,
category: 'tainacan-blocks',
keywords: [ __( 'Tainacan', 'tainacan' ), __( 'collections', 'tainacan' ), __( 'repository', 'tainacan' ) ],
description: __('Expose collections from your Tainacan repository', 'tainacan'),
attributes: {
selectedCollectionsObject: {
type: 'array',

View File

@ -123,8 +123,9 @@
</button>
<div
v-else
class="spinner-container">
{{ facets.length > 0 ? '' : $root.__('Nothing found.', 'tainacan') }}
class="spinner-container"
:style="{ display: facets.length > 0 ? 'none' : 'flex'}">
{{ $root.__('Nothing found.', 'tainacan') }}
</div>
</div>
</div>

View File

@ -25,6 +25,7 @@ registerBlockType('tainacan/facets-list', {
</svg>,
category: 'tainacan-blocks',
keywords: [ __( 'facets', 'tainacan' ), __( 'search', 'tainacan' ), __( 'terms', 'tainacan' ) ],
description: __('List facets from a Tainacan Collection or Repository', 'tainacan'),
attributes: {
content: {
type: 'array',

View File

@ -25,6 +25,7 @@ registerBlockType('tainacan/carousel-items-list', {
</svg>,
category: 'tainacan-blocks',
keywords: [ __( 'items', 'tainacan' ), __( 'carousel', 'tainacan' ), __( 'slider', 'tainacan' ) ],
description: __('List items on a Carousel, using search or item selection.', 'tainacan'),
attributes: {
content: {
type: 'array',

View File

@ -25,6 +25,7 @@ registerBlockType('tainacan/dynamic-items-list', {
</svg>,
category: 'tainacan-blocks',
keywords: [ __( 'items', 'tainacan' ), __( 'search', 'tainacan' ), __( 'collection', 'tainacan' ) ],
description: __('Dynamically list items from a Tainacan items search', 'tainacan'),
attributes: {
content: {
type: 'array',

View File

@ -19,6 +19,7 @@ registerBlockType('tainacan/items-list', {
</svg>,
category: 'tainacan-blocks',
keywords: [ __( 'Tainacan', 'tainacan' ), __( 'items', 'tainacan' ), __( 'collection', 'tainacan' ) ],
description: __('Expose items from your Tainacan collections', 'tainacan'),
attributes: {
selectedItemsObject: {
type: 'array',

View File

@ -28,6 +28,7 @@ registerBlockType('tainacan/search-bar', {
</svg>,
category: 'tainacan-blocks',
keywords: [ __( 'items', 'tainacan' ), __( 'search', 'tainacan' ), __( 'bar', 'tainacan' ) ],
description: __('Set up a custom search bar to redirect to an item\'s list', 'tainacan'),
attributes: {
content: {
type: 'array',

View File

@ -18,6 +18,7 @@ registerBlockType('tainacan/terms-list', {
</svg>,
category: 'tainacan-blocks',
keywords: [ __( 'Tainacan', 'tainacan' ), __( 'terms', 'tainacan' ), __( 'taxonomy', 'tainacan' ) ],
description: __('Expose terms from your Tainacan taxonomies', 'tainacan'),
attributes: {
selectedTermsObject: {
type: 'array',

View File

@ -217,20 +217,6 @@ export default {
this.$store.dispatch('search/remove_fetch_only_meta', metadatum );
this.updateURLQueries();
},
getErrors( filter_id ){
let error = this.errors.find( errorItem => errorItem.metadatum_id === filter_id );
return ( error ) ? error.errors : false;
},
// listener(){
// const components = this.getAllComponents();
// for (let eventElement of components){
// eventElement.addEventListener('input', (event) => {
// if( event.detail ) {
// this.add_metaquery( event.detail[0] );
// }
// });
// }
// },
setPage(page) {
this.$store.dispatch('search/setPage', page);
this.updateURLQueries();

View File

@ -26,26 +26,28 @@ export const createExporterSession = ({commit}, slug) => {
export const updateExporterSession = ({commit}, exporterSessionUpdated) => {
return tainacan.patch(`/exporters/session/${exporterSessionUpdated.id}`, exporterSessionUpdated.body)
.then(response => {
commit('setExporterSession');
return response;
})
.catch(error => {
console.error(error.response.data);
});
return new Promise(( resolve, reject ) => {
tainacan.patch(`/exporters/session/${exporterSessionUpdated.id}`, exporterSessionUpdated.body)
.then(response => {
commit('setExporterSession');
resolve( response.data );
})
.catch(error => {
reject( error.response.data );
});
});
};
export const runExporterSession = ({commit}, exporterSessionID) => {
return tainacan.post(`/exporters/session/${exporterSessionID}/run`)
.then(response => {
commit('setBackGroundProcessID', response.data);
return response.data;
})
.catch(error => {
console.error(error.response.data);
})
return new Promise(( resolve, reject ) => {
tainacan.post(`/exporters/session/${exporterSessionID}/run`)
.then(response => {
commit('setBackGroundProcessID', response.data);
resolve(response.data);
})
.catch(error => {
reject( error.response.data );
})
});
};

View File

@ -354,7 +354,25 @@ class Migrations {
$wpdb->query( "UPDATE $wpdb->postmeta SET meta_value = 'default' WHERE
post_id IN (
SELECT ID FROM $wpdb->posts WHERE post_type = 'tainacan-filter'
) AND meta_key = 'collection_id' AND meta_value = 'filter_in_repository'" );
) AND meta_key = 'collection_id' AND meta_value = 'filter_in_repository'"
);
}
static function update_relationship_metadata_search_option() {
global $wpdb;
$q = "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'metadata_type' AND meta_value = 'Tainacan\\\\Metadata_Types\\\\Relationship'";
$ids = $wpdb->get_col($q);
foreach ($ids as $id) {
$meta = get_post_meta($id, 'metadata_type_options', true);
if ( is_array($meta) && isset($meta['search']) && is_array($meta['search']) && isset($meta['search'][0]) && is_numeric($meta['search'][0]) ) {
$meta['search'] = $meta['search'][0];
update_post_meta($id, 'metadata_type_options', $meta);
}
}
}

View File

@ -381,7 +381,7 @@ class Facets extends TAINACAN_UnitApiTestCase {
'metadata_type_options' => [
'allow_new_terms' => 'yes',
'collection_id' => $collection1->get_id(),
'search' => []
'search' => ''
]
),
true

View File

@ -455,7 +455,7 @@ class Metadata extends TAINACAN_UnitTestCase {
'status' => 'publish',
'metadata_type_options' => [
'collection_id' => $collection2->get_id(),
'search' => [$collection2->get_core_title_metadatum()->get_id()]
'search' => $collection2->get_core_title_metadatum()->get_id()
]
),
true