mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Add custom callbacks handler
Fix typo
This commit is contained in:
@@ -9,7 +9,6 @@
|
|||||||
"modernizr": "~2.6.2",
|
"modernizr": "~2.6.2",
|
||||||
"normalize-css" : "~2.1.0",
|
"normalize-css" : "~2.1.0",
|
||||||
"json3" : "3.2.4",
|
"json3" : "3.2.4",
|
||||||
"bootstrap-switch": "https://github.com/nostalgiaz/bootstrap-switch.git",
|
|
||||||
"humane-js": "~3.0.6",
|
"humane-js": "~3.0.6",
|
||||||
"qunit": "https://github.com/jquery/qunit.git#1.11.0",
|
"qunit": "https://github.com/jquery/qunit.git#1.11.0",
|
||||||
"mustache": "~0.7.2",
|
"mustache": "~0.7.2",
|
||||||
|
@@ -28,4 +28,4 @@ require.config({
|
|||||||
deps: ["jquery", "bootstrap"]
|
deps: ["jquery", "bootstrap"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -85,4 +85,4 @@ require([
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -85,4 +85,4 @@ require([
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -14,9 +14,11 @@ define([
|
|||||||
], function($, _, Backbone) {
|
], function($, _, Backbone) {
|
||||||
|
|
||||||
|
|
||||||
var FormValidator = function(rules) {
|
var FormValidator = function(rules, handlers) {
|
||||||
// rules setted by user
|
// rules setted by user
|
||||||
this.rules = rules || [];
|
this.rules = rules || [];
|
||||||
|
// custom callbacks
|
||||||
|
this.handlers = handlers || [];
|
||||||
// final fields to validate
|
// final fields to validate
|
||||||
this.fields = [];
|
this.fields = [];
|
||||||
|
|
||||||
@@ -162,7 +164,11 @@ define([
|
|||||||
return field.value === defaultName;
|
return field.value === defaultName;
|
||||||
},
|
},
|
||||||
"matches": function(field, matchName) {
|
"matches": function(field, matchName) {
|
||||||
var el = this.inputs[matchName];
|
if (typeof this.inputs[matchName] === "undefined") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var el = this.inputs[matchName].shift();
|
||||||
|
|
||||||
if (el) {
|
if (el) {
|
||||||
return field.value === el.value;
|
return field.value === el.value;
|
||||||
|
@@ -491,5 +491,3 @@ define([
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user