diaspora/public/javascripts/app/models/status_message.js
2012-03-27 14:52:50 -07:00

24 lines
598 B
JavaScript

app.models.StatusMessage = app.models.Post.extend({
url : function(){
return this.isNew() ? '/status_messages' : '/posts/' + this.get("id");
},
mungeAndSave : function(){
var mungedAttrs = {
status_message : _.clone(this.attributes),
aspect_ids : mungeAspects(this.get("aspect_ids")),
services : mungeServices(this.get("services"))
}
this.save(mungedAttrs)
function mungeAspects (value){
return [value]
}
function mungeServices (values) {
if(!values) { return; }
return values.length > 1 ? values : [values]
}
}
});