cae155ef by Adam Heath

Add a feature to use a Backbone.View as the rendering implementation.

1 parent e3afa8bb
{
"name": "rivets-error-binder",
"version": "0.1.3",
"version": "0.2.0",
"authors": [
"Adam Heath <doogie@brainfood.com>"
],
......
{
"name": "rivets-error-binder",
"version": "0.1.3",
"version": "0.2.0",
"main": [
"src/scripts/rivets-error-binder.js"
],
......
......@@ -9,7 +9,23 @@ define(function(require) {
binder[methodName].apply(binding, args);
};
var render = function() {
var render = function(el, cmd, errorList) {
var viewClassPath = module.config().viewClassPath;
if (viewClassPath) {
var $el = $(el);
var view = $el.data('error-view');
if (view === undefined && cmd === 'bind') {
$el.data('error-view', null);
require([viewClassPath], function(ViewClass) {
$el.data('error-view', new ViewClass({el: el}));
});
return;
}
if (view) {
view.errorCallback(cmd, errorList);
}
return;
}
var renderImpl = module.config().render;
if (renderImpl) {
return renderImpl.apply(this, arguments);
......