framework/ember/app/models/post.js
Toby Zerner a62e04f956 Upgrade to JSON-API RC3 + latest version of tobscure/json-api
Note: npm source for ember-json-api changed to a fork, but I still had
to apply a custom change to get polymorphic relationships to work (see
https://github.com/kurko/ember-json-api/pull/71#issuecomment-85257281)
2015-03-24 15:04:24 +10:30

25 lines
610 B
JavaScript

import Ember from 'ember';
import DS from 'ember-data';
export default DS.Model.extend({
discussion: DS.belongsTo('discussion', {inverse: 'loadedPosts'}),
number: DS.attr('number'),
time: DS.attr('date'),
user: DS.belongsTo('user'),
contentType: DS.attr('string'),
content: DS.attr(),
contentHtml: DS.attr('string'),
editTime: DS.attr('date'),
editUser: DS.belongsTo('user'),
isEdited: Ember.computed.notEmpty('editTime'),
hideTime: DS.attr('date'),
hideUser: DS.belongsTo('user'),
isHidden: DS.attr('boolean'),
canEdit: DS.attr('boolean'),
canDelete: DS.attr('boolean')
});