Split ListView by adding a CreateView

This commit is contained in:
Nicolas Le Goff
2013-05-23 21:16:53 +02:00
committed by Romain Neutron
parent f886874f8d
commit 5c8cb9973e
7 changed files with 227 additions and 162 deletions

View File

@@ -0,0 +1,24 @@
define([
"jquery",
"underscore",
"backbone"
], function($, _, Backbone) {
return {
MultiViews : {
// bind a subview to a DOM element
_assignView: function(selector, view) {
var selectors;
if (_.isObject(selector)) {
selectors = selector;
} else {
selectors = {};
selectors[selector] = view;
}
if (!selectors) return;
_.each(selectors, function(view, selector) {
view.setElement(this.$(selector)).render();
}, this);
}
}
};
});