mirror of
https://github.com/fergalmoran/dss.git
synced 2026-01-06 08:54:12 +00:00
69 lines
2.4 KiB
JavaScript
Executable File
69 lines
2.4 KiB
JavaScript
Executable File
// 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(['underscore', 'backbone', 'marionette', 'vent', 'views/activity/activityListView', 'views/widgets/nowPlayingView', 'text!/tpl/SidebarView'], function(_, Backbone, Marionette, vent, ActivityListView, NowPlayingView, Template) {
|
|
var SidebarView;
|
|
SidebarView = (function(_super) {
|
|
|
|
__extends(SidebarView, _super);
|
|
|
|
function SidebarView() {
|
|
return SidebarView.__super__.constructor.apply(this, arguments);
|
|
}
|
|
|
|
SidebarView.prototype.template = _.template(Template);
|
|
|
|
SidebarView.prototype.regions = {
|
|
topRegion: '#sidebar-now-playing',
|
|
streamRegion: '#sidebar-stream-content'
|
|
};
|
|
|
|
SidebarView.prototype.initialize = function() {
|
|
this.listenTo(vent, 'mix:init', this.mixInit);
|
|
this.listenTo(vent, 'mix:play', this.mixPlay);
|
|
this.listenTo(vent, 'mix:pause', this.mixPause);
|
|
this.listenTo(vent, 'live:started', this.liveStarted);
|
|
};
|
|
|
|
SidebarView.prototype.onRender = function() {};
|
|
|
|
SidebarView.prototype.onShow = function() {
|
|
this.streamRegion.show(new ActivityListView());
|
|
$(this.topRegion.el).hide();
|
|
};
|
|
|
|
SidebarView.prototype.mixInit = function(model) {
|
|
$(this.topRegion.el).show();
|
|
return this.topRegion.show(new NowPlayingView({
|
|
model: model
|
|
}));
|
|
};
|
|
|
|
SidebarView.prototype.liveStarted = function() {
|
|
var _this = this;
|
|
console.log("SidebarView: livePlay");
|
|
$.getJSON("ajax/live_now_playing/", function(data) {
|
|
$(_this.topRegion.el).show();
|
|
return _this.topRegion.show(new NowPlayingView({
|
|
model: new Backbone.Model({
|
|
mix_image: "/static/img/radio.jpg",
|
|
item_url: "",
|
|
title: data.description,
|
|
user_profile_url: "",
|
|
user_name: data.title
|
|
})
|
|
}));
|
|
});
|
|
return true;
|
|
};
|
|
|
|
return SidebarView;
|
|
|
|
})(Marionette.Layout);
|
|
return SidebarView;
|
|
});
|
|
|
|
}).call(this);
|