I have a userdetail
backbone view and template. The sample code is
define(
['framework/baseclass'],
function(baseclass) {
var UserDetails = myModule();
UserDetails.Model = Backbone.Model.extend({
//
});
UserDetails.Views.Content = Backbone.View
.extend({
template : "UserDetails",
initialize : function() {
//model
},
events : {
},
render : function(manage) {
},
renderOnceDomIsReady : function() {
createUserDetailPage();
},
createUserDetailPage: function(){
//use the html template and populate with data and additional look and feel
}
},
addNewUser: function()
{
},
});
});
User would be presented that view to enter their details to create accounts.
I have an admin view wherein I want to show admin user the userdetail
view, showing user account details in addition to have some additional elements in the html template that would have events in the overridden 'userdetail' view
The user detail template will not have account feature shown to non admin user, whereas when an admin user is viewing this via the admin view, they would be able to view such features.
One can argue that why not put in a flag in my original code to identify between non admin and admin account and then show the features based on that. However I have restrictions
that prevent me from making such code change. Hence this expedition of keeping existing code as is, look at ways to inherit from exiting code and give the added functionality