summaryrefslogtreecommitdiffstats
path: root/module/web/app/scripts/default.js
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-06-08 17:37:43 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-06-08 17:37:44 +0200
commit2cf160d497e501bf254bd8be054c0f5880ab90ca (patch)
tree03a720b6142cc03fe7ef258fa8d17da92b30a462 /module/web/app/scripts/default.js
parentMerge pull request #151 from vuolter/invertedconf (diff)
downloadpyload-2cf160d497e501bf254bd8be054c0f5880ab90ca.tar.xz
restructured webui to single-page-app, removed jinja
Diffstat (limited to 'module/web/app/scripts/default.js')
-rw-r--r--module/web/app/scripts/default.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/module/web/app/scripts/default.js b/module/web/app/scripts/default.js
new file mode 100644
index 000000000..a337cee21
--- /dev/null
+++ b/module/web/app/scripts/default.js
@@ -0,0 +1,30 @@
+define('default', ['backbone', 'jquery', 'app', 'router', 'models/userSession'],
+ function(Backbone, $, App, Router, UserSession) {
+ 'use strict';
+
+ // Global ajax options
+ var options = {
+ statusCode: {
+ 401: function() {
+ console.log('Not logged in.');
+ App.navigate('login');
+ }
+ },
+ xhrFields: {withCredentials: true}
+ };
+
+ $.ajaxSetup(options);
+
+ Backbone.ajax = function() {
+ Backbone.$.ajaxSetup.call(Backbone.$, options);
+ return Backbone.$.ajax.apply(Backbone.$, arguments);
+ };
+
+ $(function() {
+ App.session = new UserSession();
+ App.router = new Router();
+ App.start();
+ });
+
+ return App;
+ }); \ No newline at end of file