Sha256: f21a3a13b9b867a1bfd8e553012ca46b93290606895f81b2e6619b6979da2968
Contents?: true
Size: 1.18 KB
Versions: 5
Compression:
Stored size: 1.18 KB
Contents
// console.log('Loading User...') Spontaneous.User = (function($, S) { var ajax = S.Ajax; var User = new JS.Class({ initialize: function(user_data) { this.attrs = user_data; }, name: function() { return this.attrs.name; }, email: function() { return this.attrs.email; }, login: function() { return this.attrs.login; }, is_developer: function() { return this.attrs.developer; }, is_admin: function() { return this.attrs.admin; }, can_publish: function() { return this.attrs.can_publish; } }); var instance = new JS.Singleton({ include: Spontaneous.Properties, loaded: function(user_data) { this.user = new User(user_data); this.set('user', this.user); }, logout: function() { ajax.del('/logout', {}, function() { // S.Ajax.unauthorized(); }); }, name: function() { return this.user.name(); }, email: function() { return this.user.email(); }, login: function() { return this.user.login(); }, is_developer: function() { return this.user.is_developer(); }, is_admin: function() { return this.user.is_admin(); }, can_publish: function() { return this.user.can_publish(); } }); return instance; }(jQuery, Spontaneous));
Version data entries
5 entries across 5 versions & 1 rubygems