added basic user profile view implementation

pull/485/merge
Justin Richer 11 years ago
parent 55ea880396
commit d7be122a21

@ -10,9 +10,9 @@
<li class="divider"></li> <li class="divider"></li>
</security:authorize> </security:authorize>
<li class="nav-header">Personal</li> <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/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="divider"></li>
<li class="nav-header">Developer</li> <li class="nav-header">Developer</li>
<li><a href="manage/#dev/dynreg">Self-service client registration</a><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" 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 // Router
var AppRouter = Backbone.Router.extend({ var AppRouter = Backbone.Router.extend({
@ -329,7 +370,7 @@ var AppRouter = Backbone.Router.extend({
"user/approved":"approvedSites", "user/approved":"approvedSites",
"user/tokens":"notImplemented", "user/tokens":"notImplemented",
"user/profile":"notImplemented", "user/profile":"profile",
"dev/dynreg":"dynReg", "dev/dynreg":"dynReg",
"dev/dynreg/new":"newDynReg", "dev/dynreg/new":"newDynReg",
@ -737,6 +778,20 @@ var AppRouter = Backbone.Router.extend({
setPageTitle("Edit a New Client"); setPageTitle("Edit a New Client");
// 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...
},
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> </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…
Cancel
Save