* introduce new presenters and extend the functionality of the BasePresenter * add a handlebars template for the profile sidebar, render it everytime we need to update * introduce a 'aspect_membership:update' global event
39 lines
952 B
JavaScript
39 lines
952 B
JavaScript
app.models.Person = Backbone.Model.extend({
|
|
urlRoot: '/people',
|
|
|
|
url: function() {
|
|
return this.urlRoot + '/' + this.get('guid');
|
|
},
|
|
|
|
initialize: function() {
|
|
if( this.get('profile') )
|
|
this.profile = new app.models.Profile(this.get('profile'));
|
|
},
|
|
|
|
isSharing: function() {
|
|
var rel = this.get('relationship');
|
|
return (rel == 'mutual' || rel == 'sharing');
|
|
},
|
|
|
|
isReceiving: function() {
|
|
var rel = this.get('relationship');
|
|
return (rel == 'mutual' || rel == 'receiving');
|
|
},
|
|
|
|
isMutual: function() {
|
|
return (this.get('relationship') == 'mutual');
|
|
},
|
|
|
|
isBlocked: function() {
|
|
return (this.get('relationship') == 'blocked');
|
|
},
|
|
|
|
block: function() {
|
|
var self = this;
|
|
var block = new app.models.Block({block: {person_id: this.id}});
|
|
|
|
// return the jqXHR with Promise interface
|
|
return block.save()
|
|
.done(function() { app.events.trigger('person:block:'+self.id); });
|
|
}
|
|
});
|