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

View File

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

@ -706,3 +706,5 @@ ui.routes.push({path: "dev/dynreg/edit", name: "editDynReg", callback:
// note that this doesn't actually load the client, that's supposed to happen elsewhere... // 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... // note that this doesn't actually load the client, that's supposed to happen elsewhere...
} }
}); });
ui.templates.push('resources/template/rsreg.html');

View File

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

View File

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

View File

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