No longer require backbone-seen, instead the seen-ness of the path is
managed as part of holder.
Showing
4 changed files
with
5 additions
and
7 deletions
... | @@ -14,7 +14,6 @@ | ... | @@ -14,7 +14,6 @@ |
14 | "src/lib" | 14 | "src/lib" |
15 | ], | 15 | ], |
16 | "dependencies": { | 16 | "dependencies": { |
17 | "backbone-seen": "git@gitlab.brainfood.com:brainfood/backbone-seen.git", | ||
18 | "backbone": "", | 17 | "backbone": "", |
19 | "backbone-validation": "", | 18 | "backbone-validation": "", |
20 | "jquery": "", | 19 | "jquery": "", | ... | ... |
... | @@ -28,8 +28,7 @@ require = (function() { | ... | @@ -28,8 +28,7 @@ require = (function() { |
28 | rivets: '../lib/rivets/dist/rivets', | 28 | rivets: '../lib/rivets/dist/rivets', |
29 | bootstrap: '../lib/bootstrap/dist/js/bootstrap', | 29 | bootstrap: '../lib/bootstrap/dist/js/bootstrap', |
30 | jquery: '../lib/jquery/dist/jquery', | 30 | jquery: '../lib/jquery/dist/jquery', |
31 | 'rivets-backbone-adapter': '../lib/rivets-backbone-adapter/rivets-backbone', | 31 | 'rivets-backbone-adapter': '../lib/rivets-backbone-adapter/rivets-backbone' |
32 | 'backbone-seen': '../lib/backbone-seen/src/scripts/backbone-seen' | ||
33 | } | 32 | } |
34 | }; | 33 | }; |
35 | 34 | ... | ... |
... | @@ -38,12 +38,13 @@ define(function(require) { | ... | @@ -38,12 +38,13 @@ define(function(require) { |
38 | var holder = this.validationHolder = { | 38 | var holder = this.validationHolder = { |
39 | //marker: el.parentNode.insertBefore(document.createComment(" rivets: " + this.type + " "), el), | 39 | //marker: el.parentNode.insertBefore(document.createComment(" rivets: " + this.type + " "), el), |
40 | observer: observer, | 40 | observer: observer, |
41 | seen: {}, | ||
41 | focus: function() { | 42 | focus: function() { |
42 | render(el, 'focus', false); | 43 | render(el, 'focus', false); |
43 | }, | 44 | }, |
44 | blur: function() { | 45 | blur: function() { |
45 | if (observer.target) { | 46 | if (observer.target) { |
46 | observer.target.seen(observer.key.path, true); | 47 | holder.seen[observer.key.path] = true; |
47 | } | 48 | } |
48 | render(el, 'blur', false); | 49 | render(el, 'blur', false); |
49 | if (observer.target) { | 50 | if (observer.target) { |
... | @@ -52,7 +53,7 @@ define(function(require) { | ... | @@ -52,7 +53,7 @@ define(function(require) { |
52 | }, | 53 | }, |
53 | validated: function(isValid, model, errors) { | 54 | validated: function(isValid, model, errors) { |
54 | var errorList = errors[observer.key.path]; | 55 | var errorList = errors[observer.key.path]; |
55 | if (errorList && observer.target && observer.target.seen(holder.observer.key.path)) { | 56 | if (errorList && observer.target && holder.seen[holder.observer.key.path]) { |
56 | render(el, 'validated', errorList); | 57 | render(el, 'validated', errorList); |
57 | } else { | 58 | } else { |
58 | render(el, 'validated', false); | 59 | render(el, 'validated', false); | ... | ... |
... | @@ -8,7 +8,6 @@ define(function(require) { | ... | @@ -8,7 +8,6 @@ define(function(require) { |
8 | var Backbone = require('backbone'); | 8 | var Backbone = require('backbone'); |
9 | var rivets = require('rivets'); | 9 | var rivets = require('rivets'); |
10 | require('backbone-validation'); | 10 | require('backbone-validation'); |
11 | var BackboneSeen = require('backbone-seen'); | ||
12 | require('rivets-backbone-adapter'); | 11 | require('rivets-backbone-adapter'); |
13 | _.extend(Backbone.Model.prototype, Backbone.Validation.mixin); | 12 | _.extend(Backbone.Model.prototype, Backbone.Validation.mixin); |
14 | //rivets.config.rootInterface = ':'; | 13 | //rivets.config.rootInterface = ':'; |
... | @@ -47,7 +46,7 @@ define(function(require) { | ... | @@ -47,7 +46,7 @@ define(function(require) { |
47 | render.counts = {focus: 0, blur: 0, validatedError: 0, validatedClean: 0}; | 46 | render.counts = {focus: 0, blur: 0, validatedError: 0, validatedClean: 0}; |
48 | 47 | ||
49 | jasmine.Clock.useMock(); | 48 | jasmine.Clock.useMock(); |
50 | Model = BackboneSeen.mixin(Backbone.Model.extend()); | 49 | Model = Backbone.Model.extend(); |
51 | Collection = Backbone.Collection.extend({model: Model}); | 50 | Collection = Backbone.Collection.extend({model: Model}); |
52 | 51 | ||
53 | scope = new Model({ | 52 | scope = new Model({ | ... | ... |
-
Please register or sign in to post a comment