diff --git a/src/admin/tainacan-admin-i18n.php b/src/admin/tainacan-admin-i18n.php
index fe10d4f97..a915b61f5 100644
--- a/src/admin/tainacan-admin-i18n.php
+++ b/src/admin/tainacan-admin-i18n.php
@@ -679,6 +679,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' ),
diff --git a/src/classes/filter-types/numeric-interval/FormNumericInterval.vue b/src/classes/filter-types/numeric-interval/FormNumericInterval.vue
index e453b0cd2..d5d32f4eb 100644
--- a/src/classes/filter-types/numeric-interval/FormNumericInterval.vue
+++ b/src/classes/filter-types/numeric-interval/FormNumericInterval.vue
@@ -2,156 +2,72 @@
-
- {{ $i18n.getHelperTitle('tainacan-filter-numeric-interval', 'custom') }}
-
-
- {{ $i18n.getHelperTitle('tainacan-filter-numeric-interval', 'list') }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -169,43 +85,19 @@
data() {
return {
step: [Number, String],
- inputMode: 'custom',
- showEditStepOptions: false,
- intervals: [],
+ showEditStepOptions: false
}
},
methods: {
onUpdate() {
this.$emit('input', {
- step: this.step,
- intervals: this.intervals,
- inputMode: this.inputMode
+ step: this.step
});
},
- removeInterval(index) {
- this.intervals.splice(index, 1);
- },
- addInterval(index) {
- if (index) {
- this.intervals.splice(index + 1, 0, {
- label: '',
- to: 0,
- from: 0
- })
- } else {
- this.intervals.push({
- label: '',
- to: 0,
- from: 0
- });
- }
- }
},
created() {
this.step = this.value && this.value.step ? this.value.step : 1;
- this.inputMode = this.value && this.value.inputMode ? this.value.inputMode : 'custom';
- this.intervals = this.value && this.value.intervals ? this.value.intervals : [];
}
}
\ No newline at end of file
diff --git a/src/classes/filter-types/numeric-interval/NumericInterval.vue b/src/classes/filter-types/numeric-interval/NumericInterval.vue
index 46e8539f5..5be2b94f2 100644
--- a/src/classes/filter-types/numeric-interval/NumericInterval.vue
+++ b/src/classes/filter-types/numeric-interval/NumericInterval.vue
@@ -1,33 +1,19 @@
-
-
- {{ $i18n.get('label_until') }}
-
-
-
-
-
-
-
+
+
{{ $i18n.get('label_until') }}
+
+
@@ -49,7 +35,6 @@
collectionId: '',
metadatum: '',
options: [],
- selectedInterval: ''
}
},
props: {
@@ -85,16 +70,6 @@
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', {
@@ -111,7 +86,7 @@
// emit the operation for listeners
emit() {
let values = [ this.valueInit, this.valueEnd ];
- let type = ! Number.isInteger( this.valueInit ) || ! Number.isInteger( this.valueEnd ) ? 'DECIMAL' : 'NUMERIC';
+ let type = ! Number.isInteger( this.valueInit ) || ! Number.isInteger( this.valueEnd ) ? 'DECIMAL(20,3)' : 'NUMERIC';
this.$emit('input', {
type: type,
@@ -147,12 +122,6 @@
value: this.valueInit + ' - ' + this.valueEnd
});
}
-
- if (this.options.inputMode == 'list') {
- this.selectedInterval = this.options.intervals.findIndex(
- anInterval => anInterval.from == this.valueInit && anInterval.to == this.valueEnd
- );
- }
} else {
return false;
diff --git a/src/classes/filter-types/numeric-interval/class-tainacan-numeric-interval.php b/src/classes/filter-types/numeric-interval/class-tainacan-numeric-interval.php
index 2336bb6f2..c7d6e2114 100644
--- a/src/classes/filter-types/numeric-interval/class-tainacan-numeric-interval.php
+++ b/src/classes/filter-types/numeric-interval/class-tainacan-numeric-interval.php
@@ -16,8 +16,7 @@ class Numeric_Interval extends Filter_Type {
$this->set_use_max_options(false);
$this->set_default_options([
'step' => 1,
- 'input-mode' => 'custom',
- 'intervals' => []
+ 'input-mode' => 'custom'
]);
$this->set_preview_template('
@@ -68,14 +67,9 @@ class Numeric_Interval extends Filter_Type {
return [
'step' => [
'title' => __( 'Step', 'tainacan' ),
- 'description' => __( 'The amount to be increased or decreased when clicking on filter control buttons.', 'tainacan' ),
- ],
- 'input-mode' => [
- 'title' => __( 'Input mode', 'tainacan' ),
- 'description' => __( 'Input mode', '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')],
- 'list' => ['title' => __('Predefined intervals','tainacan')],
];
}