From f5ba49178fed7190d4e9c7523f88c631a94e8fc5 Mon Sep 17 00:00:00 2001 From: Justin Richer Date: Mon, 22 Sep 2014 21:56:12 -0400 Subject: [PATCH] turned off ajax cache, switched to callback-based template loading adresses #668 --- .../src/main/webapp/resources/js/admin.js | 39 +++++++++---------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/openid-connect-server-webapp/src/main/webapp/resources/js/admin.js b/openid-connect-server-webapp/src/main/webapp/resources/js/admin.js index 549597c97..16c512a47 100644 --- a/openid-connect-server-webapp/src/main/webapp/resources/js/admin.js +++ b/openid-connect-server-webapp/src/main/webapp/resources/js/admin.js @@ -52,7 +52,6 @@ Backbone.Collection.prototype.fetchIfNeeded = function(options) { } }; - var URIModel = Backbone.Model.extend({ validate: function(attrs){ @@ -1046,30 +1045,30 @@ var app = null; // main $(function () { - jQuery.ajaxSetup({async:false}); - var _load = function (templates) { $('body').append(templates); }; // load templates and append them to the body - $.get('resources/template/admin.html', _load); - $.get('resources/template/client.html', _load); - $.get('resources/template/grant.html', _load); - $.get('resources/template/scope.html', _load); - $.get('resources/template/whitelist.html', _load); - $.get('resources/template/dynreg.html', _load); - $.get('resources/template/rsreg.html', _load); - $.get('resources/template/token.html', _load); - - jQuery.ajaxSetup({async:true}); - app = new AppRouter(); - - // grab all hashed URLs and send them through the app router instead - $(document).on('click', 'a[href^="manage/#"]', function(event) { - event.preventDefault(); - app.navigate(this.hash.slice(1), {trigger: true}); - }); + $.when( + $.get('resources/template/admin.html', _load), + $.get('resources/template/client.html', _load), + $.get('resources/template/grant.html', _load), + $.get('resources/template/scope.html', _load), + $.get('resources/template/whitelist.html', _load), + $.get('resources/template/dynreg.html', _load), + $.get('resources/template/rsreg.html', _load), + $.get('resources/template/token.html', _load) + ).done(function() { + $.ajaxSetup({cache:false}); + app = new AppRouter(); + + // grab all hashed URLs and send them through the app router instead + $(document).on('click', 'a[href^="manage/#"]', function(event) { + event.preventDefault(); + app.navigate(this.hash.slice(1), {trigger: true}); + }); + }); });