inclusive: change operator instead of lower/upper limits
This commit is contained in:
@@ -26,26 +26,24 @@ export default Component.extend({
|
||||
init: function init() {
|
||||
this._super();
|
||||
this.set('error', '');
|
||||
Ember.defineProperty(this, 'lower_bound', Ember.computed.alias(`filters.${this.get('key')}_gteq`));
|
||||
Ember.defineProperty(this, 'upper_bound', Ember.computed.alias(`filters.${this.get('key')}_lteq`));
|
||||
const isInclusive = this.get('inclusive');
|
||||
Ember.defineProperty(this, 'lower_bound',
|
||||
Ember.computed.alias(`filters.${this.get('key')}${isInclusive ? '_gteq' : '_gt'}`));
|
||||
Ember.defineProperty(this, 'upper_bound',
|
||||
Ember.computed.alias(`filters.${this.get('key')}${isInclusive ? '_lteq' : '_lt'}`));
|
||||
},
|
||||
actions: {
|
||||
toggle_inclusive() {
|
||||
this.set('inclusive', !this.get('inclusive'));
|
||||
const isInclusive = this.get('inclusive');
|
||||
var lbc = this.get('lower_bound_candidate');
|
||||
var hbc = this.get('upper_bound_candidate');
|
||||
|
||||
if (!isInclusive) {
|
||||
lbc++;
|
||||
hbc--;
|
||||
} else {
|
||||
lbc--
|
||||
hbc++
|
||||
}
|
||||
Ember.defineProperty(this, 'lower_bound',
|
||||
Ember.computed.alias(`filters.${this.get('key')}${isInclusive ? '_gteq' : '_gt'}`));
|
||||
Ember.defineProperty(this, 'upper_bound',
|
||||
Ember.computed.alias(`filters.${this.get('key')}${isInclusive ? '_lteq' : '_lt'}`));
|
||||
|
||||
this.set(`lower_bound_candidate`, lbc);
|
||||
this.set(`upper_bound_candidate`, hbc);
|
||||
delete this.filters[`${this.get('key')}${isInclusive ? '_gt' : '_gteq'}`];
|
||||
delete this.filters[`${this.get('key')}${isInclusive ? '_lt' : '_lteq'}`];
|
||||
},
|
||||
set_filter: function set_filter(key, value) {
|
||||
this.set('error', '');
|
||||
@@ -65,9 +63,9 @@ export default Component.extend({
|
||||
}
|
||||
},
|
||||
clear_filters: function clear_filters() {
|
||||
this.set('lower_bound', '');
|
||||
this.set('inclusive', true);
|
||||
this.set('error', '');
|
||||
this.set('lower_bound', '');
|
||||
this.set('upper_bound', '');
|
||||
this.set('lower_bound_candidate', '1');
|
||||
this.set('upper_bound_candidate', '3');
|
||||
|
||||
@@ -28,7 +28,7 @@ table.ui.celled.striped.compact.table.sortable
|
||||
button.ui.mini.primary.button{action 'set_filter_target_date_this_week'}= t 'date.this_week'
|
||||
'
|
||||
button.ui.mini.primary.button{action 'set_filter_target_date_next_fifteen_weeks'} Nu ↔ 15 weken
|
||||
= filter.pablo-number-range key='pablos' inclusive=true
|
||||
= filter.pablo-number-range key='pablos' inclusive=false
|
||||
= filter.number-range key='age' inclusive=true
|
||||
= filter.dropdown-select-multiple key='dropdown_select_multiple_ids_in' options=scenario_classification_objects labelPath='grumpy'
|
||||
= filter.select-multiple key='select_multiple_modal_ids_in' options=scenario_classification_objects valueKey='id' textKey='grumpy'
|
||||
|
||||
Reference in New Issue
Block a user