Files
dss/static/js/app/lib/controller.js
2013-05-25 13:35:33 +01:00

85 lines
2.4 KiB
JavaScript

// Generated by CoffeeScript 1.6.2
(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(['app', 'marionette', 'models/mix/item', 'views/mix/list', 'views/mix/detail', 'views/mix/edit'], function(App, Marionette, MixItem, MixListView, MixDetailView, MixEditView) {
var DssController, _ref;
DssController = (function(_super) {
__extends(DssController, _super);
function DssController() {
_ref = DssController.__super__.constructor.apply(this, arguments);
return _ref;
}
DssController.prototype.home = function() {
console.log("Controller: home");
this.showMixList();
return true;
};
DssController.prototype.showMixList = function(type, options) {
var app;
console.log("Controller: showMixList");
type = type || "latest";
app = require('app');
app.contentRegion.show(new MixListView($.extend({
type: type
}, options)), 'drop');
return true;
};
DssController.prototype.showMix = function(slug) {
var app, mix;
console.log("Controller: showMix");
app = require('app');
mix = new MixItem({
id: slug
});
mix.fetch({
success: function() {
app.contentRegion.show(new MixDetailView({
model: mix
}));
return true;
}
});
return true;
};
DssController.prototype.editMix = function(slug) {
var app, mix;
console.log("Controller: mixEdit");
app = require('app');
mix = new MixItem({
id: slug
});
mix.fetch({
success: function() {
return app.contentRegion.show(new MixEditView({
model: mix
}));
}
});
return true;
};
DssController.prototype.user = function(slug) {
return this.showMixList('latest', {
user: slug
});
};
return DssController;
})(Marionette.Controller);
return DssController;
});
}).call(this);