Skip to content
This repository has been archived by the owner on Jan 7, 2018. It is now read-only.

Commit

Permalink
Prevent empty submit of the query builder filters from wiping the form.
Browse files Browse the repository at this point in the history
  • Loading branch information
GUI committed Feb 20, 2015
1 parent 99edddc commit 67a98b0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/assets/javascripts/admin/views/stats/query_form_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,10 @@ Admin.StatsQueryFormView = Ember.View.extend({
}

if(rules) {
$queryBuilder.queryBuilder('setRules', rules);
if(rules.condition) {
$queryBuilder.queryBuilder('setRules', rules);
}

this.send('toggleFilters');
this.send('toggleFilterType', 'builder');
} else if(this.get('controller.query.params.search')) {
Expand All @@ -234,7 +237,7 @@ Admin.StatsQueryFormView = Ember.View.extend({
rules = JSON.parse(query);
}

if(rules) {
if(rules && rules.condition) {
$('#query_builder').queryBuilder('setRules', rules);
} else {
$('#query_builder').queryBuilder('reset');
Expand Down

0 comments on commit 67a98b0

Please sign in to comment.