Skip to content

Commit

Permalink
merged master
Browse files Browse the repository at this point in the history
  • Loading branch information
alechirsch committed Oct 1, 2018
2 parents 0892ac6 + dae9d05 commit c2bd889
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions addon/components/search-flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default Ember.Component.extend({
return parameter.toLowerCase() === param.name.toLowerCase();
});
},
processQueries: Ember.observer('query,parameters', function () {
processQueries: Ember.observer('query', 'parameters', function () {
if (this.get('queryGeneratedByComponent')) {
this.set('queryGeneratedByComponent', false);
return;
Expand Down Expand Up @@ -64,7 +64,7 @@ export default Ember.Component.extend({
});
});
}),
availableParameters: Ember.computed('parameters,filters.[],[email protected],[email protected]', function () {
availableParameters: Ember.computed('parameters', 'filters.[]', '[email protected]', '[email protected]', function () {
return this.get('parameters').reject(parameter => {
return !parameter.name || !parameter.title || (parameter.allowMultiple === false && this.get('filters').find(filter => {
return filter.get('parameter.name') === parameter.name;
Expand Down Expand Up @@ -129,7 +129,7 @@ export default Ember.Component.extend({
this.get('onQueryUpdated')(query);
}
},
canAddNewFilter: Ember.computed('isSelectingParameter,filters.[],[email protected],maxFilters', function () {
canAddNewFilter: Ember.computed('isSelectingParameter', 'filters.[]', '[email protected]', 'maxFilters', function () {
if (this.get('isSelectingParameter')) {
return false;
}
Expand All @@ -139,7 +139,7 @@ export default Ember.Component.extend({
return !this.get('filters').isAny('isFocused');
}),
actions: {
newFilter() {
newFilter(event) {
if (event.which === 13) { // Enter key
// Must prevent the filter from auto selecting an option
this.set('didHitEnter', true);
Expand Down Expand Up @@ -182,4 +182,4 @@ export default Ember.Component.extend({
this.generateQuery();
},
}
});
});
12 changes: 6 additions & 6 deletions addon/components/search-flow/input-dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default Ember.Component.extend({
this.$('.search-flow_input').css('width', tempDiv.width() + 3);
tempDiv.remove();
},
availableOptions: Ember.computed('options.[],value', function () {
availableOptions: Ember.computed('options.[]', 'value', function () {
let options = this.get('options');
if (!options || !this.get('filter.isFocused')) {
return Ember.A([]);
Expand All @@ -72,7 +72,7 @@ export default Ember.Component.extend({
if (this.get('filter.parameter.sort')){
options = options.sortBy('title');
}

// Insert contains option into list
if (this.get('filter.parameter.contains') && this.get('value') && options.length) {
options.unshift(Ember.Object.create({ title: `Contains: ${this.get('value')}`, value: this.get('value'), isContains: true }));
Expand Down Expand Up @@ -114,7 +114,7 @@ export default Ember.Component.extend({
this.get('newFilter')(activeOption.get('value'));
}
else {

this.set('filter.value', activeOption.get('value'));
if (activeOption.get('isContains')) {
this.set('filter.isContains', true);
Expand All @@ -135,7 +135,7 @@ export default Ember.Component.extend({
this.send('selectOption', this.get('activeOption'));
}
},
inputKeyDown() {
inputKeyDown(_, event) {
if (event.which === 38) { // Up
event.preventDefault();
let previousItem = this.get(`availableOptions.${this.get('activeOption.index') - 1}`);
Expand All @@ -158,7 +158,7 @@ export default Ember.Component.extend({
this.blurInput();
}
},
inputKeyUp() {
inputKeyUp(_, event) {
// Prevent the up or down key from moving the cursor when releasing the key
if (event.which === 38 || event.which === 40) { // Up or Down
event.preventDefault();
Expand All @@ -183,7 +183,7 @@ export default Ember.Component.extend({

// Set the value to what the original filter value was
this.set('filter.isFocused', false);
if (this.get('filter.isContains')) {
if (this.get('filter.isContains')) {
this.set('value', `Contains: ${this.get('filter.value')}`);
}
this.get('inputBlurred')(this.get('isParameterSelection'), this.get('filter'), this.get('shouldRemoveFilter'));
Expand Down
6 changes: 3 additions & 3 deletions addon/templates/components/search-flow.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{#each filters as |filter|}}
<div class="search-flow__query">
<div class="search-flow__query-title">
{{filter.parameter.title}} :
{{filter.parameter.title}} :
</div>
<div class="search-flow__query-value">
{{search-flow/input-dropdown
Expand Down Expand Up @@ -30,7 +30,7 @@
</div>
{{/if}}
{{#if availableParameters.length}}
<button class="search-flow_add{{unless canAddNewFilter ' search-flow_add-hidden'}}" {{action 'newFilter'}}>
<button class="search-flow_add{{unless canAddNewFilter ' search-flow_add-hidden'}}" onclick={{action 'newFilter'}}>
<svg class="add-icon" width="18px" height="18px" viewBox="608 440 44 44" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs></defs>
<path d="M627,476.001 C617.611,476.001 610,468.389 610,459 C610,449.611 617.611,442 627,442 C636.389,442 644,449.611 644,459 C644,468.389 636.389,476.001 627,476.001 Z M651.707,482.293 L641.108,471.694 C644.14,468.328 646,463.887 646,459 C646,448.507 637.494,440 627,440 C616.507,440 608,448.507 608,459 C608,469.494 616.507,478 627,478 C631.887,478 636.328,476.14 639.694,473.108 L650.293,483.707 C650.474,483.889 650.724,484 651,484 C651.553,484 652,483.553 652,483 C652,482.725 651.889,482.475 651.707,482.293 Z M636,458 L628,458 L628,450 C628,449.448 627.553,449 627,449 C626.447,449 626,449.448 626,450 L626,458 L618,458 C617.447,458 617,458.448 617,459 C617,459.553 617.447,460 618,460 L626,460 L626,468 C626,468.553 626.447,469 627,469 C627.553,469 628,468.553 628,468 L628,460 L636,460 C636.553,460 637,459.553 637,459 C637,458.448 636.553,458 636,458 L636,458 Z" id="add-search-icon" stroke="none" fill="#3B71AA" fill-rule="evenodd"></path>
Expand Down Expand Up @@ -58,4 +58,4 @@
{{/each}}
{{/if}}
</div>
{{yield}}
{{yield}}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ember-search-flow",
"version": "0.6.0",
"version": "0.6.3",
"description": "Multi-faceted search for ember.",
"directories": {
"doc": "doc",
Expand Down

0 comments on commit c2bd889

Please sign in to comment.