Skip to content

Commit

Permalink
Add nodeNames to all filters, as this causes serialization issues
Browse files Browse the repository at this point in the history
  • Loading branch information
laurenwalker committed Nov 21, 2019
1 parent f833baa commit 8733075
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/js/models/filters/ChoiceFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ define(['jquery', 'underscore', 'backbone', 'models/filters/Filter'],
return _.extend(Filter.prototype.defaults(), {
chooseMultiple: true,
//@type {object} - A literal JS object with a "label" and "value" attribute
choices: []
choices: [],
nodeName: "choiceFilter"
});
},

Expand Down
3 changes: 2 additions & 1 deletion src/js/models/filters/DateFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ define(['jquery', 'underscore', 'backbone', 'models/filters/Filter'],
max: (new Date()).getUTCFullYear(),
rangeMin: 0,
rangeMax: (new Date()).getUTCFullYear(),
matchSubstring: false
matchSubstring: false,
nodeName: "dateFilter"
});
},

Expand Down
5 changes: 3 additions & 2 deletions src/js/models/filters/ToggleFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ define(['jquery', 'underscore', 'backbone', 'models/filters/Filter'],
trueLabel: "On",
trueValue: null,
falseLabel: "Off",
falseValue: null
falseValue: null,
nodeName: "toggleFilter"
});
},

Expand Down Expand Up @@ -76,7 +77,7 @@ define(['jquery', 'underscore', 'backbone', 'models/filters/Filter'],

// Remove the node if it exists in the DOM already
$(objectDOM).find(nodeName).remove();

// Don't serialize falsey or default values
if((value || value === false) && value != this.defaults()[nodeName]){

Expand Down

0 comments on commit 8733075

Please sign in to comment.