mirror of
https://github.com/zhigang1992/m.combee.co.git
synced 2026-01-12 22:39:55 +08:00
19 lines
498 B
JavaScript
19 lines
498 B
JavaScript
define(['backbone'], function(Backbone) {
|
|
var Comment = Backbone.Model.extend({
|
|
initialize: function(options) {
|
|
this.postID = options.postID;
|
|
},
|
|
urlRoot: function() {
|
|
return '/api/v1/posts/' + this.postID + '/comments';
|
|
},
|
|
mobileAvatar: function() {
|
|
var es = this.get('user').avatar.split('/');
|
|
es[es.length-1] = 'small_' + es[es.length-1];
|
|
return es.join('/');
|
|
},
|
|
postDate: function() {
|
|
return moment(this.get('created_at')).fromNow();
|
|
}
|
|
});
|
|
return Comment;
|
|
}) |