load all templates from configured files

pull/1192/merge
Justin Richer 2017-02-20 13:20:21 -05:00
parent 5af98e1106
commit 503d6f5725
10 changed files with 31 additions and 18 deletions

View File

@ -20,7 +20,7 @@
// set up a global variable for UI components to hang extensions off of
var ui = {
templates: [],
templates: ["resources/template/admin.html"],
routes: []
};
@ -39,5 +39,6 @@
</c:forEach>
<script type="text/javascript" src="resources/js/admin.js"></script>
</c:if>
<div id="templates" class="hide"></div>
</body>
</html>

View File

@ -474,22 +474,18 @@ var app = null;
// main
$(function () {
var _load = function (templates) {
$('body').append(templates);
var loader = function(source) {
return $.get(source, function (templates) {
console.log('Loading file: ' + source);
$('#templates').append(templates);
});
};
// load templates and append them to the body
$.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),
$.get('resources/template/blacklist.html', _load)
$.when.apply(null,
ui.templates.map(loader)
).done(function() {
console.log('done');
$.ajaxSetup({cache:false});
app = new AppRouter();

View File

@ -208,3 +208,5 @@ ui.routes.push({path: "admin/blacklist", name: "blackList", callback:
}
});
ui.templates.push('resources/template/blacklist.html');

View File

@ -1322,3 +1322,5 @@ ui.routes.push({path: "admin/client/:id", name: "editClient", callback:
}
});
ui.templates.push('resources/template/client.html');

View File

@ -705,4 +705,6 @@ ui.routes.push({path: "dev/dynreg/edit", name: "editDynReg", callback:
setPageTitle($.t('dynreg.edit-existing'));
// note that this doesn't actually load the client, that's supposed to happen elsewhere...
}
});
});
ui.templates.push('resources/template/dynreg.html');

View File

@ -278,3 +278,5 @@ ui.routes.push({path: "user/approved", name: "approvedSites", callback:
);
}
});
ui.templates.push('resources/template/grant.html');

View File

@ -503,3 +503,5 @@ ui.routes.push({path: "dev/resource/edit", name: "editResReg", callback:
// note that this doesn't actually load the client, that's supposed to happen elsewhere...
}
});
ui.templates.push('resources/template/rsreg.html');

View File

@ -432,4 +432,6 @@ ui.routes.push({path: "admin/scope/:id", name: "editScope", callback:
});
}
});
});
ui.templates.push('resources/template/scope.html');

View File

@ -499,4 +499,6 @@ ui.routes.push({path: "user/tokens", name: "tokens", callback:
);
}
});
});
ui.templates.push('resources/template/token.html');

View File

@ -497,4 +497,6 @@ ui.routes.push({path: "admin/whitelist/:id", name: "editWhitelist", callback:
}
});
});
ui.templates.push('resources/template/whitelist.html');