cae155ef by Adam Heath

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

1 parent e3afa8bb
1 { 1 {
2 "name": "rivets-error-binder", 2 "name": "rivets-error-binder",
3 "version": "0.1.3", 3 "version": "0.2.0",
4 "authors": [ 4 "authors": [
5 "Adam Heath <doogie@brainfood.com>" 5 "Adam Heath <doogie@brainfood.com>"
6 ], 6 ],
......
1 { 1 {
2 "name": "rivets-error-binder", 2 "name": "rivets-error-binder",
3 "version": "0.1.3", 3 "version": "0.2.0",
4 "main": [ 4 "main": [
5 "src/scripts/rivets-error-binder.js" 5 "src/scripts/rivets-error-binder.js"
6 ], 6 ],
......
...@@ -9,7 +9,23 @@ define(function(require) { ...@@ -9,7 +9,23 @@ define(function(require) {
9 binder[methodName].apply(binding, args); 9 binder[methodName].apply(binding, args);
10 }; 10 };
11 11
12 var render = function() { 12 var render = function(el, cmd, errorList) {
13 var viewClassPath = module.config().viewClassPath;
14 if (viewClassPath) {
15 var $el = $(el);
16 var view = $el.data('error-view');
17 if (view === undefined && cmd === 'bind') {
18 $el.data('error-view', null);
19 require([viewClassPath], function(ViewClass) {
20 $el.data('error-view', new ViewClass({el: el}));
21 });
22 return;
23 }
24 if (view) {
25 view.errorCallback(cmd, errorList);
26 }
27 return;
28 }
13 var renderImpl = module.config().render; 29 var renderImpl = module.config().render;
14 if (renderImpl) { 30 if (renderImpl) {
15 return renderImpl.apply(this, arguments); 31 return renderImpl.apply(this, arguments);
......