Sha256: f40c80df4a6482d98c08e59299f04751b1ca2a0df69517143073ae1898235fea
Contents?: true
Size: 1.18 KB
Versions: 4
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
4 entries across 4 versions & 1 rubygems