Skip to content

Instantly share code, notes, and snippets.

@denisraslov
Last active October 4, 2017 20:01
Show Gist options
  • Save denisraslov/68c1d14a90da345793ac22ba5fc7352a to your computer and use it in GitHub Desktop.
Save denisraslov/68c1d14a90da345793ac22ba5fc7352a to your computer and use it in GitHub Desktop.
import AdminContent from 'views/adminContent';
import UserContent from 'views/userContent';
const Page = Backbone.View.extend({
render() {
const contentNode = this.$('.content')[0];
// Use a method of the global app instance
// (the model of the current user is hold there)
if (APP.isAdminUser()) {
this.contentView = new AdminContent(contentNode);
} else {
this.contentView = new UserContent(contentNode);
}
this.contentView.render();
return this;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment