Files
dss/static/js/app/views/mix/mixListLayout.js
2013-10-02 21:22:26 +01:00

69 lines
2.4 KiB
JavaScript

// Generated by CoffeeScript 1.4.0
(function() {
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
define(['marionette', 'vent', 'models/user/userItem', 'models/mix/mixCollection', 'views/widgets/mixTabHeaderView', 'views/user/userItemView', 'views/mix/mixListView', 'text!/tpl/MixListLayoutView'], function(Marionette, vent, UserItem, MixCollection, MixTabHeaderView, UserItemView, MixListView, Template) {
var MixListLayout;
MixListLayout = (function(_super) {
__extends(MixListLayout, _super);
function MixListLayout() {
return MixListLayout.__super__.constructor.apply(this, arguments);
}
MixListLayout.prototype.template = _.template(Template);
MixListLayout.prototype.regions = {
headerRegion: "#mix-list-heading",
bodyRegion: "#mix-list-body"
};
MixListLayout.prototype.initialize = function() {
this.listenTo(vent, "mix:showlist", this.showMixList);
this.listenTo(vent, "user:showdetail", this.showUserView);
return this.showMixList(this.options);
};
MixListLayout.prototype.onShow = function() {
return this.headerRegion.show(new MixTabHeaderView());
};
MixListLayout.prototype.showMixList = function(options) {
var _this = this;
this.collection = new MixCollection();
return this.collection.fetch({
data: this.options,
success: function(collection) {
return _this.bodyRegion.show(new MixListView({
collection: collection
}));
}
});
};
MixListLayout.prototype.showUserView = function(options) {
var user,
_this = this;
this.bodyRegion.show(new MixListView(options));
user = new UserItem({
id: options.user
});
return user.fetch({
success: function() {
return _this.headerRegion.show(new UserItemView({
model: user
}));
}
});
};
return MixListLayout;
})(Marionette.Layout);
return MixListLayout;
});
}).call(this);