diff --git a/resources/js/app.js b/resources/js/app.js index 4f16a6b..3ebc947 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -8,9 +8,10 @@ // Filename: app.js define([ "underscore" - , "jquery" - , "backbone" , "async" + , "backbone" + , "jquery" + , "bootstrap" , "config" @@ -35,9 +36,10 @@ define([ ], function( _ -, $ -, Backbone , async +, Backbone +, $ +, Bootstrap , Config @@ -176,7 +178,7 @@ _ pushState: true , root: Config.docRoot }); - +console.log(Bootstrap); // For now let's reset the state when we start up //that.navigate("", false); @@ -283,20 +285,21 @@ _ if (that.loadingStates === 0) { clearTimeout(that.loadingTimeout); - that.loadingModal.modal("hide"); + if (that.loadingModal.modal) { + that.loadingModal.modal("hide"); + } } } }); server.client.on("unauthorized", function __fnAppEventClientUnauthorized(client, xhr) { - var tmplHtml = _.template(tmplModalLogin)({ dmap_itemname: client.url() }) - , $tmpl = $(tmplHtml) + var tmplHtml = _.template(tmplModalLogin)({ dmap_itemname: client.url() }) , serverModel = that.servers.get(client.attributes.hostname) ; - $tmpl.modal(); + that._modalLogin = $(tmplHtml); - $tmpl.find("form").on("submit", function __fnAppEventModalLogin(event) { + that._modalLogin.find("form").on("submit", function __fnAppEventModalLogin(event) { var username = $(event.target).find("input[type='text']").val() , password = $(event.target).find("input[type='password']").val() , saveCredentials = $(event.target).find("input[type='checkbox']").is(':checked') @@ -313,14 +316,14 @@ _ serverModel.save(newModel, {silence: true}); } - $tmpl.modal("hide"); + that._modalLogin.modal("hide"); setTimeout(client.init, 250); event.preventDefault(); }); - $tmpl.delegate("input[type='checkbox']", "click", function __fnEventModalRemember(event) { + that._modalLogin.delegate("input[type='checkbox']", "click", function __fnEventModalRemember(event) { if (event.target.checked === true) { if (!confirm("Using this feature will save the login and password locally in clear text, are you sure?")) { event.target.checked = false; @@ -328,6 +331,10 @@ _ } } }); + + setTimeout(function __fnEventAppUnauthorizedDisplayModal() { + that._modalLogin.modal(); + }, 50); }); server.client.init(); @@ -335,15 +342,11 @@ _ , __showModalAbout: function () { var that = this - , $modal = $(tmplModalAbout) - , previousPush = window.location.pathname ; - if (previousPush.indexOf("/about") >= 0) { - previousPush = ""; - } + that._modalAbout = $(tmplModalAbout); - $modal.on("hidden", function __fnEventAppModalAboutClosed(event) { + that._modalAbout.on("hidden", function __fnEventAppModalAboutClosed(event) { if (window.history.length === that.historyStart) { that.navigate("", false); } else { @@ -351,9 +354,7 @@ _ } }); - setTimeout(function () { - $modal.modal(); - }, 50); + that._modalAbout.modal(); } }); diff --git a/resources/js/config.js b/resources/js/config.js index f68b83e..ceb7e48 100644 --- a/resources/js/config.js +++ b/resources/js/config.js @@ -36,13 +36,13 @@ define([ , verbose: 6 , docRoot: "/" - +/* , daap: { hostname: "daap.localhost" , protocol: "http" , port: 80 } - } +*/ } }; /** diff --git a/resources/js/main.js b/resources/js/main.js index 8ecba7c..d81a17b 100644 --- a/resources/js/main.js +++ b/resources/js/main.js @@ -46,6 +46,10 @@ require.config({ , "underscore-string": { deps: ["underscore"] } + + , "bootstrap": { + deps: ["jquery"] + } } , paths: {