turned off ajax cache, switched to callback-based template loading

adresses #668
pull/705/head
Justin Richer 2014-09-22 21:56:12 -04:00
parent 81a043bb51
commit f5ba49178f
1 changed files with 18 additions and 19 deletions

View File

@ -52,7 +52,6 @@ Backbone.Collection.prototype.fetchIfNeeded = function(options) {
} }
}; };
var URIModel = Backbone.Model.extend({ var URIModel = Backbone.Model.extend({
validate: function(attrs){ validate: function(attrs){
@ -1046,30 +1045,30 @@ var app = null;
// main // main
$(function () { $(function () {
jQuery.ajaxSetup({async:false});
var _load = function (templates) { var _load = function (templates) {
$('body').append(templates); $('body').append(templates);
}; };
// load templates and append them to the body // load templates and append them to the body
$.get('resources/template/admin.html', _load); $.when(
$.get('resources/template/client.html', _load); $.get('resources/template/admin.html', _load),
$.get('resources/template/grant.html', _load); $.get('resources/template/client.html', _load),
$.get('resources/template/scope.html', _load); $.get('resources/template/grant.html', _load),
$.get('resources/template/whitelist.html', _load); $.get('resources/template/scope.html', _load),
$.get('resources/template/dynreg.html', _load); $.get('resources/template/whitelist.html', _load),
$.get('resources/template/rsreg.html', _load); $.get('resources/template/dynreg.html', _load),
$.get('resources/template/token.html', _load); $.get('resources/template/rsreg.html', _load),
$.get('resources/template/token.html', _load)
jQuery.ajaxSetup({async:true}); ).done(function() {
app = new AppRouter(); $.ajaxSetup({cache:false});
app = new AppRouter();
// grab all hashed URLs and send them through the app router instead // grab all hashed URLs and send them through the app router instead
$(document).on('click', 'a[href^="manage/#"]', function(event) { $(document).on('click', 'a[href^="manage/#"]', function(event) {
event.preventDefault(); event.preventDefault();
app.navigate(this.hash.slice(1), {trigger: true}); app.navigate(this.hash.slice(1), {trigger: true});
}); });
});
}); });