Skip to content

Instantly share code, notes, and snippets.

@johngag
Created November 15, 2011 03:11
Show Gist options
  • Save johngag/1366022 to your computer and use it in GitHub Desktop.
Save johngag/1366022 to your computer and use it in GitHub Desktop.
$(function(){
APP = {};
APP.Views = {};
APP.Models = {};
_.extend(APP, Backbone.Events);
APP.Views.App = Backbone.View.extend({
el: $('#body'),
initialize: function(){
_.bindAll(this);
APP.bind('login:success', this.loginSuccess);
APP.bind('auth:success', this.showApplication);
APP.bind('auth:fail', this.showLogin);
},
loginSuccess: function(){
this.showApplication()
},
showLogin: function(){
this.$('#login-view').show();
this.$('#main-view').hide();
this.$('#loading-view').remove();
},
showApplication: function(){
this.$('#login-view').hide();
this.$('#main-view').show();
this.$('#loading-view').remove();
}
});
window.AppView = new APP.Views.App;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment