2016-08-16 13:36:26 +02:00
|
|
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
|
|
|
//
|
|
|
|
// This software (Documize Community Edition) is licensed under
|
|
|
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
|
|
|
//
|
|
|
|
// You can operate outside the AGPL restrictions by purchasing
|
|
|
|
// Documize Enterprise Edition and obtaining a commercial license
|
|
|
|
// by contacting <sales@documize.com>.
|
|
|
|
//
|
|
|
|
// https://documize.com
|
|
|
|
|
2016-08-09 13:16:29 +02:00
|
|
|
import Model from 'ember-data/model';
|
|
|
|
import attr from 'ember-data/attr';
|
|
|
|
import Ember from 'ember';
|
2016-08-29 18:44:30 +02:00
|
|
|
// import { hasMany } from 'ember-data/relationships';
|
2016-08-09 13:16:29 +02:00
|
|
|
|
|
|
|
export default Model.extend({
|
|
|
|
documentId: attr('string'),
|
|
|
|
orgId: attr('string'),
|
|
|
|
contentType: attr('string'),
|
2016-11-09 15:16:44 -08:00
|
|
|
pageType: attr('string'),
|
2016-08-09 13:16:29 +02:00
|
|
|
level: attr('number', { defaultValue: 1 }),
|
|
|
|
sequence: attr('number', { defaultValue: 0 }),
|
|
|
|
revisions: attr('number', { defaultValue: 0 }),
|
2017-01-21 14:29:36 -08:00
|
|
|
blockId: attr('string'),
|
2016-08-09 13:16:29 +02:00
|
|
|
title: attr('string'),
|
|
|
|
body: attr('string'),
|
|
|
|
rawBody: attr('string'),
|
|
|
|
meta: attr(),
|
|
|
|
|
|
|
|
tagName: Ember.computed('level', function () {
|
2017-03-05 17:27:43 +00:00
|
|
|
return "h2";
|
|
|
|
// return "h" + (this.get('level') + 1);
|
2016-08-09 13:16:29 +02:00
|
|
|
}),
|
|
|
|
|
|
|
|
tocIndent: Ember.computed('level', function () {
|
|
|
|
return (this.get('level') - 1) * 20;
|
|
|
|
}),
|
|
|
|
|
|
|
|
tocIndentCss: Ember.computed('tocIndent', function () {
|
|
|
|
let tocIndent = this.get('tocIndent');
|
|
|
|
return `margin-left-${tocIndent}`;
|
2016-08-24 13:10:54 +02:00
|
|
|
}),
|
2016-11-30 17:56:36 -08:00
|
|
|
|
|
|
|
hasRevisions: Ember.computed('revisions', function () {
|
|
|
|
return this.get('revisions') > 0;
|
|
|
|
}),
|
|
|
|
|
2016-08-24 13:10:54 +02:00
|
|
|
created: attr(),
|
|
|
|
revised: attr()
|
2016-11-10 16:19:51 -08:00
|
|
|
});
|