Skip to content

Commit 503d6f5

Browse files
committed
load all templates from configured files
1 parent 5af98e1 commit 503d6f5

File tree

10 files changed

+31
-18
lines changed

10 files changed

+31
-18
lines changed

openid-connect-server-webapp/src/main/webapp/WEB-INF/tags/footer.tag

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
// set up a global variable for UI components to hang extensions off of
2121
2222
var ui = {
23-
templates: [],
23+
templates: ["resources/template/admin.html"],
2424
routes: []
2525
};
2626
@@ -39,5 +39,6 @@
3939
</c:forEach>
4040
<script type="text/javascript" src="resources/js/admin.js"></script>
4141
</c:if>
42+
<div id="templates" class="hide"></div>
4243
</body>
4344
</html>

openid-connect-server-webapp/src/main/webapp/resources/js/admin.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -474,22 +474,18 @@ var app = null;
474474
// main
475475
$(function () {
476476

477-
var _load = function (templates) {
478-
$('body').append(templates);
477+
var loader = function(source) {
478+
return $.get(source, function (templates) {
479+
console.log('Loading file: ' + source);
480+
$('#templates').append(templates);
481+
});
479482
};
480-
483+
481484
// load templates and append them to the body
482-
$.when(
483-
$.get('resources/template/admin.html', _load),
484-
$.get('resources/template/client.html', _load),
485-
$.get('resources/template/grant.html', _load),
486-
$.get('resources/template/scope.html', _load),
487-
$.get('resources/template/whitelist.html', _load),
488-
$.get('resources/template/dynreg.html', _load),
489-
$.get('resources/template/rsreg.html', _load),
490-
$.get('resources/template/token.html', _load),
491-
$.get('resources/template/blacklist.html', _load)
485+
$.when.apply(null,
486+
ui.templates.map(loader)
492487
).done(function() {
488+
console.log('done');
493489
$.ajaxSetup({cache:false});
494490
app = new AppRouter();
495491

openid-connect-server-webapp/src/main/webapp/resources/js/blacklist.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,3 +208,5 @@ ui.routes.push({path: "admin/blacklist", name: "blackList", callback:
208208
}
209209

210210
});
211+
212+
ui.templates.push('resources/template/blacklist.html');

openid-connect-server-webapp/src/main/webapp/resources/js/client.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,3 +1322,5 @@ ui.routes.push({path: "admin/client/:id", name: "editClient", callback:
13221322

13231323
}
13241324
});
1325+
1326+
ui.templates.push('resources/template/client.html');

openid-connect-server-webapp/src/main/webapp/resources/js/dynreg.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,4 +705,6 @@ ui.routes.push({path: "dev/dynreg/edit", name: "editDynReg", callback:
705705
setPageTitle($.t('dynreg.edit-existing'));
706706
// note that this doesn't actually load the client, that's supposed to happen elsewhere...
707707
}
708-
});
708+
});
709+
710+
ui.templates.push('resources/template/dynreg.html');

openid-connect-server-webapp/src/main/webapp/resources/js/grant.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,3 +278,5 @@ ui.routes.push({path: "user/approved", name: "approvedSites", callback:
278278
);
279279
}
280280
});
281+
282+
ui.templates.push('resources/template/grant.html');

openid-connect-server-webapp/src/main/webapp/resources/js/rsreg.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,3 +503,5 @@ ui.routes.push({path: "dev/resource/edit", name: "editResReg", callback:
503503
// note that this doesn't actually load the client, that's supposed to happen elsewhere...
504504
}
505505
});
506+
507+
ui.templates.push('resources/template/rsreg.html');

openid-connect-server-webapp/src/main/webapp/resources/js/scope.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,4 +432,6 @@ ui.routes.push({path: "admin/scope/:id", name: "editScope", callback:
432432
});
433433

434434
}
435-
});
435+
});
436+
437+
ui.templates.push('resources/template/scope.html');

openid-connect-server-webapp/src/main/webapp/resources/js/token.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,4 +499,6 @@ ui.routes.push({path: "user/tokens", name: "tokens", callback:
499499
);
500500

501501
}
502-
});
502+
});
503+
504+
ui.templates.push('resources/template/token.html');

openid-connect-server-webapp/src/main/webapp/resources/js/whitelist.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,4 +497,6 @@ ui.routes.push({path: "admin/whitelist/:id", name: "editWhitelist", callback:
497497

498498
}
499499

500-
});
500+
});
501+
502+
ui.templates.push('resources/template/whitelist.html');

0 commit comments

Comments
 (0)