added hierarchical user info display, closes #787

pull/803/merge
Justin Richer 2015-05-13 16:48:01 -04:00
parent 7f44132abc
commit e52fff58f5
3 changed files with 23 additions and 6 deletions

View File

@ -14,8 +14,7 @@ CREATE TEMPORARY TABLE IF NOT EXISTS users_TEMP (
enabled boolean not null);
CREATE TEMPORARY TABLE IF NOT EXISTS user_info_TEMP (
id BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) PRIMARY KEY,
sub VARCHAR(256),
sub VARCHAR(256) not null primary key,
preferred_username VARCHAR(256),
name VARCHAR(256),
given_name VARCHAR(256),

View File

@ -468,12 +468,29 @@ var UserProfileView = Backbone.View.extend({
render:function() {
$(this.el).html($('#tmpl-user-profile').html());
var t = this.template;
_.each(this.model, function (value, key) {
if (key && value) {
$('dl', this.el).append(
this.template({key: key, value: value})
);
if (typeof(value) === 'object') {
var el = this.el;
var k = key;
_.each(value, function (value, key) {
$('dl', el).append(
t({key: key, value: value, category: k})
);
});
} else if (typeof(value) === 'array') {
// TODO: handle array types
} else {
$('dl', this.el).append(
t({key: key, value: value})
);
}
}
}, this);

View File

@ -105,7 +105,8 @@
<script type="text/html" id="tmpl-user-profile-element">
<dt><%- key %></dt>
<dt><% if (typeof(category) !== 'undefined') { %>
<small class="muted"><%- category %>.</small><% } %><%- key %></dt>
<dd><%- value %></dd>
</script>