Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
rivets-error-binder
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
3c1a9693
authored
2016-09-01 11:16:53 -0500
by
Adam Heath
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
No longer require backbone-seen, instead the seen-ness of the path is
managed as part of holder.
1 parent
ca62b8b1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
7 deletions
bower.json
src/scripts/config.js
src/scripts/rivets-error-binder.js
src/scripts/rivets-error-binder.spec.js
bower.json
View file @
3c1a969
...
...
@@ -14,7 +14,6 @@
"src/lib"
],
"dependencies"
:
{
"backbone-seen"
:
"git@gitlab.brainfood.com:brainfood/backbone-seen.git"
,
"backbone"
:
""
,
"backbone-validation"
:
""
,
"jquery"
:
""
,
...
...
src/scripts/config.js
View file @
3c1a969
...
...
@@ -28,8 +28,7 @@ require = (function() {
rivets
:
'../lib/rivets/dist/rivets'
,
bootstrap
:
'../lib/bootstrap/dist/js/bootstrap'
,
jquery
:
'../lib/jquery/dist/jquery'
,
'rivets-backbone-adapter'
:
'../lib/rivets-backbone-adapter/rivets-backbone'
,
'backbone-seen'
:
'../lib/backbone-seen/src/scripts/backbone-seen'
'rivets-backbone-adapter'
:
'../lib/rivets-backbone-adapter/rivets-backbone'
}
};
...
...
src/scripts/rivets-error-binder.js
View file @
3c1a969
...
...
@@ -38,12 +38,13 @@ define(function(require) {
var
holder
=
this
.
validationHolder
=
{
//marker: el.parentNode.insertBefore(document.createComment(" rivets: " + this.type + " "), el),
observer
:
observer
,
seen
:
{},
focus
:
function
()
{
render
(
el
,
'focus'
,
false
);
},
blur
:
function
()
{
if
(
observer
.
target
)
{
observer
.
target
.
seen
(
observer
.
key
.
path
,
true
)
;
holder
.
seen
[
observer
.
key
.
path
]
=
true
;
}
render
(
el
,
'blur'
,
false
);
if
(
observer
.
target
)
{
...
...
@@ -52,7 +53,7 @@ define(function(require) {
},
validated
:
function
(
isValid
,
model
,
errors
)
{
var
errorList
=
errors
[
observer
.
key
.
path
];
if
(
errorList
&&
observer
.
target
&&
observer
.
target
.
seen
(
holder
.
observer
.
key
.
path
)
)
{
if
(
errorList
&&
observer
.
target
&&
holder
.
seen
[
holder
.
observer
.
key
.
path
]
)
{
render
(
el
,
'validated'
,
errorList
);
}
else
{
render
(
el
,
'validated'
,
false
);
...
...
src/scripts/rivets-error-binder.spec.js
View file @
3c1a969
...
...
@@ -8,7 +8,6 @@ define(function(require) {
var
Backbone
=
require
(
'backbone'
);
var
rivets
=
require
(
'rivets'
);
require
(
'backbone-validation'
);
var
BackboneSeen
=
require
(
'backbone-seen'
);
require
(
'rivets-backbone-adapter'
);
_
.
extend
(
Backbone
.
Model
.
prototype
,
Backbone
.
Validation
.
mixin
);
//rivets.config.rootInterface = ':';
...
...
@@ -47,7 +46,7 @@ define(function(require) {
render
.
counts
=
{
focus
:
0
,
blur
:
0
,
validatedError
:
0
,
validatedClean
:
0
};
jasmine
.
Clock
.
useMock
();
Model
=
Backbone
Seen
.
mixin
(
Backbone
.
Model
.
extend
()
);
Model
=
Backbone
.
Model
.
extend
(
);
Collection
=
Backbone
.
Collection
.
extend
({
model
:
Model
});
scope
=
new
Model
({
...
...
Please
register
or
sign in
to post a comment