|
|
@ -27,9 +27,11 @@ define([
|
|
|
|
, "collections/playlist"
|
|
|
|
, "collections/playlist"
|
|
|
|
|
|
|
|
|
|
|
|
, "views/client"
|
|
|
|
, "views/client"
|
|
|
|
|
|
|
|
, "views/list"
|
|
|
|
|
|
|
|
|
|
|
|
, "text!../templates/app/modal-loading.html"
|
|
|
|
, "text!../templates/app/modal-loading.html"
|
|
|
|
, "text!../templates/app/modal-login.html"
|
|
|
|
, "text!../templates/app/modal-login.html"
|
|
|
|
|
|
|
|
, "text!../templates/app/modal-about.html"
|
|
|
|
],
|
|
|
|
],
|
|
|
|
function(
|
|
|
|
function(
|
|
|
|
_
|
|
|
|
_
|
|
|
@ -51,29 +53,37 @@ _
|
|
|
|
, PlaylistCollection
|
|
|
|
, PlaylistCollection
|
|
|
|
|
|
|
|
|
|
|
|
, ClientView
|
|
|
|
, ClientView
|
|
|
|
|
|
|
|
, ListView
|
|
|
|
|
|
|
|
|
|
|
|
, tmplModalLoading
|
|
|
|
, tmplModalLoading
|
|
|
|
, tmplModalLogin
|
|
|
|
, tmplModalLogin
|
|
|
|
|
|
|
|
, tmplModalAbout
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
"use strict";
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
var App = Backbone.Router.extend({
|
|
|
|
var App = Backbone.Router.extend({
|
|
|
|
routes: {
|
|
|
|
routes: {
|
|
|
|
"playlist": "_routerActionPlaylist"
|
|
|
|
"about": "_routerActionAbout"
|
|
|
|
|
|
|
|
, "playlist": "_routerActionPlaylist"
|
|
|
|
, "servers/:server": "_routerActionClient"
|
|
|
|
, "servers/:server": "_routerActionClient"
|
|
|
|
, "playlist/:item": "_routerActionPlaylistItem"
|
|
|
|
, "playlist/:item": "_routerActionPlaylistItem"
|
|
|
|
, ":server/items/:item": "_routerActionServerItem"
|
|
|
|
, ":server/items/:item": "_routerActionServerItem"
|
|
|
|
//"*actions": "defaultRoute" // matches http://example.com/#anything-here
|
|
|
|
//"*actions": "defaultRoute" // matches http://example.com/#anything-here
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
, historyStart: window.history.length
|
|
|
|
|
|
|
|
|
|
|
|
, initialize: function() {
|
|
|
|
, initialize: function() {
|
|
|
|
_.bindAll(this
|
|
|
|
_.bindAll(this
|
|
|
|
|
|
|
|
, "_routerActionAbout"
|
|
|
|
, "_routerActionPlaylist"
|
|
|
|
, "_routerActionPlaylist"
|
|
|
|
, "_routerActionClient"
|
|
|
|
, "_routerActionClient"
|
|
|
|
, "_routerActionItem"
|
|
|
|
, "_routerActionItem"
|
|
|
|
, "_routerActionServerItem"
|
|
|
|
, "_routerActionServerItem"
|
|
|
|
|
|
|
|
|
|
|
|
, "_serverInit"
|
|
|
|
, "_serverInit"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
, "__showModalAbout"
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
var that = this
|
|
|
|
var that = this
|
|
|
@ -142,7 +152,7 @@ _
|
|
|
|
el: that.Views.App.Layout.panes.center
|
|
|
|
el: that.Views.App.Layout.panes.center
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: Add playlist view here
|
|
|
|
that.Views.Main.setView("playlist", new ListView());
|
|
|
|
|
|
|
|
|
|
|
|
that.Views.Footer.on("toggle:sidebar", function __fnAppEventTogglerSiderBar(event) {
|
|
|
|
that.Views.Footer.on("toggle:sidebar", function __fnAppEventTogglerSiderBar(event) {
|
|
|
|
that.Views.App.toggleSideBar();
|
|
|
|
that.Views.App.toggleSideBar();
|
|
|
@ -156,6 +166,8 @@ _
|
|
|
|
// TODO:...
|
|
|
|
// TODO:...
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
that.Views.Footer.on("show:about", that.__showModalAbout);
|
|
|
|
|
|
|
|
|
|
|
|
that.Views.App.$el.delegate("div.modal", "hidden", function __fnAppEventRemoveModals(event) {
|
|
|
|
that.Views.App.$el.delegate("div.modal", "hidden", function __fnAppEventRemoveModals(event) {
|
|
|
|
$(event.target).remove();
|
|
|
|
$(event.target).remove();
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -174,6 +186,13 @@ _
|
|
|
|
return this;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
, _routerActionAbout: function () {
|
|
|
|
|
|
|
|
var that = this
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
that.__showModalAbout();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
, _routerActionPlaylist: function () {
|
|
|
|
, _routerActionPlaylist: function () {
|
|
|
|
var that = this
|
|
|
|
var that = this
|
|
|
|
;
|
|
|
|
;
|
|
|
@ -287,7 +306,6 @@ _
|
|
|
|
|
|
|
|
|
|
|
|
if (saveCredentials) {
|
|
|
|
if (saveCredentials) {
|
|
|
|
var newModel = (_.clone({}, serverModel.attributes, {username: username, password: password}));
|
|
|
|
var newModel = (_.clone({}, serverModel.attributes, {username: username, password: password}));
|
|
|
|
console.log(newModel);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
serverModel.set("username", username, {silent: true});
|
|
|
|
serverModel.set("username", username, {silent: true});
|
|
|
|
serverModel.set("password", password, {silent: true});
|
|
|
|
serverModel.set("password", password, {silent: true});
|
|
|
@ -314,6 +332,29 @@ _
|
|
|
|
|
|
|
|
|
|
|
|
server.client.init();
|
|
|
|
server.client.init();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
, __showModalAbout: function () {
|
|
|
|
|
|
|
|
var that = this
|
|
|
|
|
|
|
|
, $modal = $(tmplModalAbout)
|
|
|
|
|
|
|
|
, previousPush = window.location.pathname
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (previousPush.indexOf("/about") >= 0) {
|
|
|
|
|
|
|
|
previousPush = "";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$modal.on("hidden", function __fnEventAppModalAboutClosed(event) {
|
|
|
|
|
|
|
|
if (window.history.length === that.historyStart) {
|
|
|
|
|
|
|
|
that.navigate("", false);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
window.history.back();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
|
|
|
$modal.modal();
|
|
|
|
|
|
|
|
}, 50);
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
return App;
|
|
|
|
return App;
|
|
|
|