|
|
@ -43,8 +43,10 @@ _
|
|
|
|
"click > ul > li:last-child > span > a.sidebar-list-action": "_addServerItem"
|
|
|
|
"click > ul > li:last-child > span > a.sidebar-list-action": "_addServerItem"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
, router: null
|
|
|
|
|
|
|
|
|
|
|
|
, initialize: function (servers) {
|
|
|
|
, initialize: function (servers) {
|
|
|
|
_.bindAll(this, "renderServerItem", "_addServerItem");
|
|
|
|
_.bindAll(this, "renderServerItem", "_addServerItem", "_routerActionPlaylist", "_routerActionClient");
|
|
|
|
var that = this
|
|
|
|
var that = this
|
|
|
|
, serverModel = null
|
|
|
|
, serverModel = null
|
|
|
|
;
|
|
|
|
;
|
|
|
@ -53,6 +55,13 @@ _
|
|
|
|
|
|
|
|
|
|
|
|
async.forEach(this.servers, that.renderServerItem, function __fnSideBarViewCbInitialRender() {
|
|
|
|
async.forEach(this.servers, that.renderServerItem, function __fnSideBarViewCbInitialRender() {
|
|
|
|
that.trigger("rendered");
|
|
|
|
that.trigger("rendered");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
that.router = new Backbone.Router.extend({
|
|
|
|
|
|
|
|
"playlist": that._routerActionPlaylist
|
|
|
|
|
|
|
|
, "servers/:server": that._routerActionClient
|
|
|
|
|
|
|
|
, ":server/items/:item": that._routerActionClient
|
|
|
|
|
|
|
|
//"*actions": "defaultRoute" // matches http://example.com/#anything-here
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
this.servers.on("add", function (server) {
|
|
|
|
this.servers.on("add", function (server) {
|
|
|
@ -69,6 +78,24 @@ _
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
, select: function (serverModel) {
|
|
|
|
|
|
|
|
var that = this
|
|
|
|
|
|
|
|
, cid = (serverModel.cid && "#" + serverModel.cid) || serverModel
|
|
|
|
|
|
|
|
, $server = that.$el.find(cid)
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
that.$el.find("li.selected").removeClass("selected");
|
|
|
|
|
|
|
|
$server.addClass("selected");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
, _routerActionPlaylist: function (event) {
|
|
|
|
|
|
|
|
console.log(event);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
, _routerActionClient: function (event) {
|
|
|
|
|
|
|
|
console.log(event);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
, _addServerItem: function(event) {
|
|
|
|
, _addServerItem: function(event) {
|
|
|
|
var that = this
|
|
|
|
var that = this
|
|
|
|
, modalEl = $(tmplModalNewServer)
|
|
|
|
, modalEl = $(tmplModalNewServer)
|
|
|
@ -145,7 +172,8 @@ _
|
|
|
|
, renderServerItem: function (item) {
|
|
|
|
, renderServerItem: function (item) {
|
|
|
|
var that = this
|
|
|
|
var that = this
|
|
|
|
, itemHtml = _.template(tmplServerListItem, {
|
|
|
|
, itemHtml = _.template(tmplServerListItem, {
|
|
|
|
server_name: item.getName()
|
|
|
|
cid: item.cid
|
|
|
|
|
|
|
|
, server_name: item.getName()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
, $item = $(itemHtml)
|
|
|
|
, $item = $(itemHtml)
|
|
|
|
;
|
|
|
|
;
|
|
|
|