aboutsummaryrefslogtreecommitdiff
path: root/src/js/fiveui/js/rules.js
diff options
context:
space:
mode:
authorGravatar Trevor Elliott <trevor@galois.com>2013-07-03 17:50:16 -0700
committerGravatar Trevor Elliott <trevor@galois.com>2013-07-03 17:50:16 -0700
commit0455574b16410cc0241e749071f7b242a65ba94e (patch)
tree04495f00b4777ac8e13843422c9416f43c695407 /src/js/fiveui/js/rules.js
parenta2e6f86c5b1d33d7d37afe7af807701d2ee74e9b (diff)
Add an enabled field to the rule set model
This is to start addressing issue #14.
Diffstat (limited to 'src/js/fiveui/js/rules.js')
-rw-r--r--src/js/fiveui/js/rules.js17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/js/fiveui/js/rules.js b/src/js/fiveui/js/rules.js
index 8f40c7d..94d714f 100644
--- a/src/js/fiveui/js/rules.js
+++ b/src/js/fiveui/js/rules.js
@@ -32,8 +32,7 @@ fiveui.RuleSet = function(config) {
_.defaults(this, fiveui.RuleSet.sanitize(config));
};
-fiveui.RuleSet.sanitize = function(obj) {
- var defs = {
+fiveui.RuleSet.defaults = {
id: null,
name: '',
description: '',
@@ -42,8 +41,12 @@ fiveui.RuleSet.sanitize = function(obj) {
patterns: [],
dependencies: [],
license: '',
+ enabled: true,
};
+fiveui.RuleSet.sanitize = function(obj) {
+ var defs = fiveui.RuleSet.defaults;
+
// scrub out any values that aren't in the defaults list, fill in any that are
// missing. pick will implicitly return a copy, so it's OK to not clone obj
// here.
@@ -182,15 +185,7 @@ fiveui.RuleSet.load = function(manifest_url, options) {
*/
fiveui.RuleSetModel = Backbone.Model.extend({
- defaults: {
- id: null,
- name: '',
- description: '',
- source: '',
- rules: [],
- dependencies: [],
- patterns: [],
- },
+ defaults: fiveui.RuleSet.defaults,
sync: function(method, model, options) {