added basic user profile view implementation
parent
55ea880396
commit
d7be122a21
|
@ -10,9 +10,9 @@
|
|||
<li class="divider"></li>
|
||||
</security:authorize>
|
||||
<li class="nav-header">Personal</li>
|
||||
<li><a href="manage/#user/approved">Manage Sites</a></li>
|
||||
<li><a href="manage/#user/approved">Manage Approved Sites</a></li>
|
||||
<li><a href="manage/#user/tokens">Manage Active Tokens</a></li>
|
||||
<li><a href="manage/#user/profile">Manage Profiles</a></li>
|
||||
<li><a href="manage/#user/profile">View Profile Information</a></li>
|
||||
<li class="divider"></li>
|
||||
<li class="nav-header">Developer</li>
|
||||
<li><a href="manage/#dev/dynreg">Self-service client registration</a><li>
|
|
@ -309,6 +309,47 @@ var StatsModel = Backbone.Model.extend({
|
|||
url: "api/stats/byclientid"
|
||||
});
|
||||
|
||||
// User Profile
|
||||
|
||||
var UserProfileView = Backbone.View.extend({
|
||||
tagName: 'span',
|
||||
|
||||
initialize:function() {
|
||||
},
|
||||
|
||||
render:function() {
|
||||
|
||||
$(this.el).html($('#tmpl-user-profile').html());
|
||||
|
||||
_.each(this.model, function (value, key) {
|
||||
$("fieldset",this.el).append(
|
||||
new UserProfileElementView({
|
||||
model:{key: key, value: value}
|
||||
}).render().el);
|
||||
}, this);
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
var UserProfileElementView = Backbone.View.extend({
|
||||
tagName: 'div',
|
||||
|
||||
initialize:function() {
|
||||
if (!this.template) {
|
||||
this.template = _.template($('#tmpl-user-profile-element').html());
|
||||
}
|
||||
},
|
||||
|
||||
render:function() {
|
||||
|
||||
$(this.el).html(this.template(this.model));
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Router
|
||||
var AppRouter = Backbone.Router.extend({
|
||||
|
||||
|
@ -329,7 +370,7 @@ var AppRouter = Backbone.Router.extend({
|
|||
|
||||
"user/approved":"approvedSites",
|
||||
"user/tokens":"notImplemented",
|
||||
"user/profile":"notImplemented",
|
||||
"user/profile":"profile",
|
||||
|
||||
"dev/dynreg":"dynReg",
|
||||
"dev/dynreg/new":"newDynReg",
|
||||
|
@ -737,6 +778,20 @@ var AppRouter = Backbone.Router.extend({
|
|||
|
||||
setPageTitle("Edit a New Client");
|
||||
// note that this doesn't actually load the client, that's supposed to happen elsewhere...
|
||||
},
|
||||
|
||||
profile:function() {
|
||||
this.breadCrumbView.collection.reset();
|
||||
this.breadCrumbView.collection.add([
|
||||
{text:"Home", href:""},
|
||||
{text:"Profile", href:"manage/#user/profile"}
|
||||
]);
|
||||
|
||||
this.userProfileView = new UserProfileView({model: getUserInfo()});
|
||||
$('#content').html(this.userProfileView.render().el);
|
||||
|
||||
setPageTitle("Edit a New Client");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -69,3 +69,24 @@
|
|||
|
||||
</script>
|
||||
|
||||
<!-- user profile -->
|
||||
<script type="text/html" id="tmpl-user-profile">
|
||||
|
||||
<form class="form-horizontal">
|
||||
<fieldset>
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="tmpl-user-profile-element">
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label"><%= key %></label>
|
||||
<div class="controls">
|
||||
<div><%= value %></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</script>
|
Loading…
Reference in New Issue