mirror of
https://github.com/documize/community.git
synced 2025-07-28 01:29:43 +02:00
refactored appMeta URL property
This commit is contained in:
parent
1c92691bdb
commit
786ba6e8d6
6 changed files with 324 additions and 350 deletions
|
@ -14,128 +14,129 @@ import NotifierMixin from '../../mixins/notifier';
|
||||||
import TooltipMixin from '../../mixins/tooltip';
|
import TooltipMixin from '../../mixins/tooltip';
|
||||||
|
|
||||||
export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
||||||
userService: Ember.inject.service('user'),
|
appMeta: Ember.inject.service(),
|
||||||
localStorage: Ember.inject.service(),
|
userService: Ember.inject.service('user'),
|
||||||
drop: null,
|
localStorage: Ember.inject.service(),
|
||||||
users: [],
|
drop: null,
|
||||||
saveTemplate: {
|
users: [],
|
||||||
name: "",
|
saveTemplate: {
|
||||||
description: ""
|
name: "",
|
||||||
},
|
description: ""
|
||||||
|
},
|
||||||
|
|
||||||
didReceiveAttrs() {
|
didReceiveAttrs() {
|
||||||
this.set('saveTemplate.name', this.get('document.name'));
|
this.set('saveTemplate.name', this.get('document.name'));
|
||||||
this.set('saveTemplate.description', this.get('document.excerpt'));
|
this.set('saveTemplate.description', this.get('document.excerpt'));
|
||||||
},
|
},
|
||||||
|
|
||||||
didRender() {
|
didRender() {
|
||||||
if (this.get('isEditor')) {
|
if (this.get('isEditor')) {
|
||||||
this.addTooltip(document.getElementById("attachment-button"));
|
this.addTooltip(document.getElementById("attachment-button"));
|
||||||
this.addTooltip(document.getElementById("save-template-button"));
|
this.addTooltip(document.getElementById("save-template-button"));
|
||||||
this.addTooltip(document.getElementById("set-meta-button"));
|
this.addTooltip(document.getElementById("set-meta-button"));
|
||||||
this.addTooltip(document.getElementById("delete-document-button"));
|
this.addTooltip(document.getElementById("delete-document-button"));
|
||||||
this.addTooltip(document.getElementById("add-section-button"));
|
this.addTooltip(document.getElementById("add-section-button"));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.addTooltip(document.getElementById("print-document-button"));
|
this.addTooltip(document.getElementById("print-document-button"));
|
||||||
},
|
},
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
if (this.get('isEditor')) {
|
if (this.get('isEditor')) {
|
||||||
let self = this;
|
let self = this;
|
||||||
let documentId = this.get('document.id');
|
let documentId = this.get('document.id');
|
||||||
let url = this.get('appMeta.url');
|
let url = this.get('appMeta.endpoint');
|
||||||
let uploadUrl = `${url}/documents/${documentId}/attachments`;
|
let uploadUrl = `${url}/documents/${documentId}/attachments`;
|
||||||
|
|
||||||
let dzone = new Dropzone("#attachment-button > i", {
|
let dzone = new Dropzone("#attachment-button > i", {
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': 'Bearer ' + self.get('localStorage').getSessionItem('session.session.authenticated.token')
|
'Authorization': 'Bearer ' + self.get('localStorage').getSessionItem('token')
|
||||||
},
|
},
|
||||||
url: uploadUrl,
|
url: uploadUrl,
|
||||||
method: "post",
|
method: "post",
|
||||||
paramName: 'attachment',
|
paramName: 'attachment',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
maxFilesize: 10,
|
maxFilesize: 10,
|
||||||
parallelUploads: 3,
|
parallelUploads: 3,
|
||||||
uploadMultiple: false,
|
uploadMultiple: false,
|
||||||
addRemoveLinks: false,
|
addRemoveLinks: false,
|
||||||
autoProcessQueue: true,
|
autoProcessQueue: true,
|
||||||
|
|
||||||
init: function() {
|
init: function () {
|
||||||
this.on("success", function(file /*, response*/ ) {
|
this.on("success", function (file /*, response*/ ) {
|
||||||
self.showNotification(`Attached ${file.name}`);
|
self.showNotification(`Attached ${file.name}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.on("queuecomplete", function() {
|
this.on("queuecomplete", function () {
|
||||||
self.attrs.onAttachmentUpload();
|
self.attrs.onAttachmentUpload();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.on("addedfile", function( /*file*/ ) {
|
this.on("addedfile", function ( /*file*/ ) {
|
||||||
self.audit.record('attached-file');
|
self.audit.record('attached-file');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
dzone.on("complete", function(file) {
|
dzone.on("complete", function (file) {
|
||||||
dzone.removeFile(file);
|
dzone.removeFile(file);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.set('drop', dzone);
|
this.set('drop', dzone);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
willDestroyElement() {
|
willDestroyElement() {
|
||||||
if (is.not.null(this.get('drop'))) {
|
if (is.not.null(this.get('drop'))) {
|
||||||
this.get('drop').destroy();
|
this.get('drop').destroy();
|
||||||
this.set('drop', null);
|
this.set('drop', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.destroyTooltips();
|
this.destroyTooltips();
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
deleteDocument() {
|
deleteDocument() {
|
||||||
this.attrs.onDocumentDelete();
|
this.attrs.onDocumentDelete();
|
||||||
},
|
},
|
||||||
|
|
||||||
printDocument() {
|
printDocument() {
|
||||||
window.print();
|
window.print();
|
||||||
},
|
},
|
||||||
|
|
||||||
saveTemplate() {
|
saveTemplate() {
|
||||||
var name = this.get('saveTemplate.name');
|
var name = this.get('saveTemplate.name');
|
||||||
var excerpt = this.get('saveTemplate.description');
|
var excerpt = this.get('saveTemplate.description');
|
||||||
|
|
||||||
if (is.empty(name)) {
|
if (is.empty(name)) {
|
||||||
$("#new-template-name").addClass("error").focus();
|
$("#new-template-name").addClass("error").focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is.empty(excerpt)) {
|
if (is.empty(excerpt)) {
|
||||||
$("#new-template-desc").addClass("error").focus();
|
$("#new-template-desc").addClass("error").focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.showNotification('Template saved');
|
this.showNotification('Template saved');
|
||||||
this.attrs.onSaveTemplate(name, excerpt);
|
this.attrs.onSaveTemplate(name, excerpt);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
saveMeta() {
|
saveMeta() {
|
||||||
let doc = this.get('document');
|
let doc = this.get('document');
|
||||||
|
|
||||||
if (is.empty(doc.get('excerpt'))) {
|
if (is.empty(doc.get('excerpt'))) {
|
||||||
$("meta-excerpt").addClass("error").focus();
|
$("meta-excerpt").addClass("error").focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
doc.set('excerpt', doc.get('excerpt').substring(0, 250));
|
doc.set('excerpt', doc.get('excerpt').substring(0, 250));
|
||||||
doc.set('userId', this.get('owner.id'));
|
doc.set('userId', this.get('owner.id'));
|
||||||
this.showNotification("Saved");
|
this.showNotification("Saved");
|
||||||
|
|
||||||
this.attrs.onDocumentChange(doc);
|
this.attrs.onDocumentChange(doc);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
});
|
});
|
|
@ -13,110 +13,109 @@ import Ember from 'ember';
|
||||||
import NotifierMixin from '../../mixins/notifier';
|
import NotifierMixin from '../../mixins/notifier';
|
||||||
|
|
||||||
export default Ember.Component.extend(NotifierMixin, {
|
export default Ember.Component.extend(NotifierMixin, {
|
||||||
localStorage: Ember.inject.service(),
|
localStorage: Ember.inject.service(),
|
||||||
tagName: 'span',
|
tagName: 'span',
|
||||||
selectedTemplate: {
|
selectedTemplate: {
|
||||||
id: "0"
|
id: "0"
|
||||||
},
|
},
|
||||||
canEditTemplate: "",
|
canEditTemplate: "",
|
||||||
drop: null,
|
drop: null,
|
||||||
appMeta: Ember.inject.service(),
|
appMeta: Ember.inject.service(),
|
||||||
|
|
||||||
didReceiveAttrs() {
|
didReceiveAttrs() {
|
||||||
this.send('setTemplate', this.get('savedTemplates')[0]);
|
this.send('setTemplate', this.get('savedTemplates')[0]);
|
||||||
},
|
},
|
||||||
|
|
||||||
willDestroyElement() {
|
willDestroyElement() {
|
||||||
if (is.not.null(this.get('drop'))) {
|
if (is.not.null(this.get('drop'))) {
|
||||||
this.get('drop').destroy();
|
this.get('drop').destroy();
|
||||||
this.set('drop', null);
|
this.set('drop', null);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
setTemplate(chosen) {
|
setTemplate(chosen) {
|
||||||
if (is.undefined(chosen)) {
|
if (is.undefined(chosen)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.set('selectedTemplate', chosen);
|
this.set('selectedTemplate', chosen);
|
||||||
this.set('canEditTemplate', chosen.id !== "0" ? "Edit" : "");
|
this.set('canEditTemplate', chosen.id !== "0" ? "Edit" : "");
|
||||||
|
|
||||||
let templates = this.get('savedTemplates');
|
let templates = this.get('savedTemplates');
|
||||||
|
|
||||||
templates.forEach(template => {
|
templates.forEach(template => {
|
||||||
Ember.set(template, 'selected', template.id === chosen.id);
|
Ember.set(template, 'selected', template.id === chosen.id);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
editTemplate() {
|
editTemplate() {
|
||||||
let template = this.get('selectedTemplate');
|
let template = this.get('selectedTemplate');
|
||||||
|
|
||||||
this.audit.record('edited-saved-template');
|
this.audit.record('edited-saved-template');
|
||||||
this.attrs.onEditTemplate(template);
|
this.attrs.onEditTemplate(template);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
startDocument() {
|
startDocument() {
|
||||||
let template = this.get('selectedTemplate');
|
let template = this.get('selectedTemplate');
|
||||||
|
|
||||||
this.audit.record('used-saved-template');
|
this.audit.record('used-saved-template');
|
||||||
this.attrs.onDocumentTemplate(template.id, template.title, "private");
|
this.attrs.onDocumentTemplate(template.id, template.title, "private");
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
onOpenCallback() {
|
onOpenCallback() {
|
||||||
if (is.not.null(this.get('drop'))) {
|
if (is.not.null(this.get('drop'))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let self = this;
|
let self = this;
|
||||||
let folderId = this.get('folder.id');
|
let folderId = this.get('folder.id');
|
||||||
let url = this.get('appMeta.url');
|
let url = this.get('appMeta.endpoint');
|
||||||
let importUrl = `${url}/import/folder/${folderId}`;
|
let importUrl = `${url}/import/folder/${folderId}`;
|
||||||
|
|
||||||
Dropzone.options.uploadDocuments = false;
|
Dropzone.options.uploadDocuments = false;
|
||||||
|
|
||||||
let dzone = new Dropzone("#upload-documents", {
|
let dzone = new Dropzone("#upload-documents", {
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': 'Bearer ' + self.get('localStorage').getSessionItem('session.session.authenticated.token')
|
'Authorization': 'Bearer ' + self.get('localStorage').getSessionItem('token')
|
||||||
},
|
},
|
||||||
url: importUrl,
|
url: importUrl,
|
||||||
method: "post",
|
method: "post",
|
||||||
paramName: 'attachment',
|
paramName: 'attachment',
|
||||||
acceptedFiles: ".doc,.docx,.txt,.md,.markdown",
|
acceptedFiles: ".doc,.docx,.txt,.md,.markdown",
|
||||||
clickable: true,
|
clickable: true,
|
||||||
maxFilesize: 10,
|
maxFilesize: 10,
|
||||||
parallelUploads: 3,
|
parallelUploads: 3,
|
||||||
uploadMultiple: false,
|
uploadMultiple: false,
|
||||||
addRemoveLinks: false,
|
addRemoveLinks: false,
|
||||||
autoProcessQueue: true,
|
autoProcessQueue: true,
|
||||||
|
|
||||||
init: function() {
|
init: function () {
|
||||||
this.on("success", function(document) {
|
this.on("success", function (document) {
|
||||||
self.attrs.onDocumentImported(document.name, document);
|
self.attrs.onDocumentImported(document.name, document);
|
||||||
});
|
|
||||||
|
|
||||||
this.on("error", function(x) {
|
|
||||||
console.log("Conversion failed for ", x.name, " obj ", x); // TODO proper error handling
|
|
||||||
});
|
|
||||||
|
|
||||||
this.on("queuecomplete", function() {
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.on("addedfile", function(file) {
|
this.on("error", function (x) {
|
||||||
self.attrs.onDocumentImporting(file.name);
|
console.log("Conversion failed for ", x.name, " obj ", x); // TODO proper error handling
|
||||||
self.audit.record('converted-document');
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
dzone.on("complete", function(file) {
|
this.on("queuecomplete", function () {});
|
||||||
dzone.removeFile(file);
|
|
||||||
});
|
this.on("addedfile", function (file) {
|
||||||
|
self.attrs.onDocumentImporting(file.name);
|
||||||
|
self.audit.record('converted-document');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
dzone.on("complete", function (file) {
|
||||||
|
dzone.removeFile(file);
|
||||||
|
});
|
||||||
|
|
||||||
this.set('drop', dzone);
|
this.set('drop', dzone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
|
@ -21,7 +21,7 @@ const {
|
||||||
export default Ember.Service.extend({
|
export default Ember.Service.extend({
|
||||||
ajax: service(),
|
ajax: service(),
|
||||||
|
|
||||||
url: `${config.apiHost}/${config.apiNamespace}`,
|
endpoint: `${config.apiHost}/${config.apiNamespace}`,
|
||||||
orgId: '',
|
orgId: '',
|
||||||
title: '',
|
title: '',
|
||||||
version: '',
|
version: '',
|
||||||
|
@ -44,13 +44,13 @@ export default Ember.Service.extend({
|
||||||
title: htmlSafe("Documize Setup"),
|
title: htmlSafe("Documize Setup"),
|
||||||
allowAnonymousAccess: false
|
allowAnonymousAccess: false
|
||||||
});
|
});
|
||||||
|
|
||||||
return resolve();
|
return resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.get('ajax').request('public/meta')
|
return this.get('ajax').request('public/meta').then((response) => {
|
||||||
.then((response) => {
|
this.setProperties(response);
|
||||||
this.setProperties(response);
|
return response;
|
||||||
return response;
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
|
@ -15,7 +15,7 @@
|
||||||
{{#each attachments key="id" as |a index|}}
|
{{#each attachments key="id" as |a index|}}
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<img class="icon" src="assets/img/attachments/{{document/file-icon a.extension}}" />
|
<img class="icon" src="assets/img/attachments/{{document/file-icon a.extension}}" />
|
||||||
<a href="{{ appMeta.apiUrl }}api/public/attachments/{{ appMeta.orgId }}/{{ a.job }}/{{ a.fileId }}">
|
<a href="{{ appMeta.endpoint }}/public/attachments/{{ appMeta.orgId }}/{{ a.job }}/{{ a.fileId }}">
|
||||||
<span class="file">{{ a.filename }}</span>
|
<span class="file">{{ a.filename }}</span>
|
||||||
</a>
|
</a>
|
||||||
{{#if isEditor}}
|
{{#if isEditor}}
|
||||||
|
|
|
@ -11,237 +11,211 @@
|
||||||
|
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
import stringUtil from '../utils/string';
|
import stringUtil from '../utils/string';
|
||||||
import config from '../config/environment';
|
|
||||||
import constants from '../utils/constants';
|
import constants from '../utils/constants';
|
||||||
|
|
||||||
let BaseModel = Ember.Object.extend({
|
let BaseModel = Ember.Object.extend({
|
||||||
id: "",
|
id: "",
|
||||||
created: null,
|
created: null,
|
||||||
revised: null,
|
revised: null,
|
||||||
|
|
||||||
setSafe(attr, value) {
|
setSafe(attr, value) {
|
||||||
this.set(attr, Ember.String.htmlSafe(Ember.Handlebars.Utils.escapeExpression(value)));
|
this.set(attr, Ember.String.htmlSafe(Ember.Handlebars.Utils.escapeExpression(value)));
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
let AppMeta = BaseModel.extend({
|
|
||||||
host: "",
|
|
||||||
namespace: "",
|
|
||||||
url: "",
|
|
||||||
orgId: "",
|
|
||||||
title: "",
|
|
||||||
message: "",
|
|
||||||
allowAnonymousAccess: false,
|
|
||||||
|
|
||||||
init() {
|
|
||||||
this.set('host', config.apiHost);
|
|
||||||
this.set('namespace', config.apiNamespace);
|
|
||||||
this.set('url', [config.apiHost, config.apiNamespace, ""].join('/'));
|
|
||||||
},
|
|
||||||
|
|
||||||
getBaseUrl(endpoint) {
|
|
||||||
return [this.get('host'), endpoint].join('/');
|
|
||||||
},
|
|
||||||
|
|
||||||
getUrl(endpoint) {
|
|
||||||
return [this.get('host'), this.get('namespace'), endpoint].join('/');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let FolderPermissionModel = Ember.Object.extend({
|
let FolderPermissionModel = Ember.Object.extend({
|
||||||
orgId: "",
|
orgId: "",
|
||||||
folderId: "",
|
folderId: "",
|
||||||
userId: "",
|
userId: "",
|
||||||
fullname: "",
|
fullname: "",
|
||||||
canView: false,
|
canView: false,
|
||||||
canEdit: false
|
canEdit: false
|
||||||
});
|
});
|
||||||
|
|
||||||
// ProtectedFolderParticipant used to display folder participants that can
|
// ProtectedFolderParticipant used to display folder participants that can
|
||||||
// then be marked as folder owner.
|
// then be marked as folder owner.
|
||||||
let ProtectedFolderParticipant = Ember.Object.extend({
|
let ProtectedFolderParticipant = Ember.Object.extend({
|
||||||
userId: "",
|
userId: "",
|
||||||
email: "",
|
email: "",
|
||||||
firstname: "",
|
firstname: "",
|
||||||
lastname: "",
|
lastname: "",
|
||||||
name: "",
|
name: "",
|
||||||
folderId: "",
|
folderId: "",
|
||||||
folderType: 0,
|
folderType: 0,
|
||||||
|
|
||||||
fullname: Ember.computed('firstname', 'lastname', function() {
|
fullname: Ember.computed('firstname', 'lastname', function () {
|
||||||
return `${this.get('firstname')} ${this.get('lastname')}`;
|
return `${this.get('firstname')} ${this.get('lastname')}`;
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
let UserModel = BaseModel.extend({
|
let UserModel = BaseModel.extend({
|
||||||
firstname: "",
|
firstname: "",
|
||||||
lastname: "",
|
lastname: "",
|
||||||
email: "",
|
email: "",
|
||||||
initials: "",
|
initials: "",
|
||||||
active: false,
|
active: false,
|
||||||
editor: false,
|
editor: false,
|
||||||
admin: false,
|
admin: false,
|
||||||
accounts: [],
|
accounts: [],
|
||||||
|
|
||||||
fullname: Ember.computed('firstname', 'lastname', function() {
|
fullname: Ember.computed('firstname', 'lastname', function () {
|
||||||
return `${this.get('firstname')} ${this.get('lastname')}`;
|
return `${this.get('firstname')} ${this.get('lastname')}`;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
generateInitials() {
|
generateInitials() {
|
||||||
let first = this.get('firstname').trim();
|
let first = this.get('firstname').trim();
|
||||||
let last = this.get('lastname').trim();
|
let last = this.get('lastname').trim();
|
||||||
this.set('initials', first.substr(0, 1) + last.substr(0, 1));
|
this.set('initials', first.substr(0, 1) + last.substr(0, 1));
|
||||||
},
|
},
|
||||||
|
|
||||||
copy() {
|
copy() {
|
||||||
let copy = UserModel.create();
|
let copy = UserModel.create();
|
||||||
copy.id = this.id;
|
copy.id = this.id;
|
||||||
copy.created = this.created;
|
copy.created = this.created;
|
||||||
copy.revised = this.revised;
|
copy.revised = this.revised;
|
||||||
copy.firstname = this.firstname;
|
copy.firstname = this.firstname;
|
||||||
copy.lastname = this.lastname;
|
copy.lastname = this.lastname;
|
||||||
copy.email = this.email;
|
copy.email = this.email;
|
||||||
copy.initials = this.initials;
|
copy.initials = this.initials;
|
||||||
copy.active = this.active;
|
copy.active = this.active;
|
||||||
copy.editor = this.editor;
|
copy.editor = this.editor;
|
||||||
copy.admin = this.admin;
|
copy.admin = this.admin;
|
||||||
copy.accounts = this.accounts;
|
copy.accounts = this.accounts;
|
||||||
|
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let OrganizationModel = BaseModel.extend({
|
let OrganizationModel = BaseModel.extend({
|
||||||
title: "",
|
title: "",
|
||||||
message: "",
|
message: "",
|
||||||
email: "",
|
email: "",
|
||||||
allowAnonymousAccess: false,
|
allowAnonymousAccess: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
let DocumentModel = BaseModel.extend({
|
let DocumentModel = BaseModel.extend({
|
||||||
name: "",
|
name: "",
|
||||||
excerpt: "",
|
excerpt: "",
|
||||||
job: "",
|
job: "",
|
||||||
location: "",
|
location: "",
|
||||||
orgId: "",
|
orgId: "",
|
||||||
folderId: "",
|
folderId: "",
|
||||||
userId: "",
|
userId: "",
|
||||||
tags: "",
|
tags: "",
|
||||||
template: "",
|
template: "",
|
||||||
|
|
||||||
slug: Ember.computed('name', function() {
|
slug: Ember.computed('name', function () {
|
||||||
return stringUtil.makeSlug(this.get('name'));
|
return stringUtil.makeSlug(this.get('name'));
|
||||||
}),
|
}),
|
||||||
|
|
||||||
// client-side property
|
// client-side property
|
||||||
selected: false
|
selected: false
|
||||||
});
|
});
|
||||||
|
|
||||||
let TemplateModel = BaseModel.extend({
|
let TemplateModel = BaseModel.extend({
|
||||||
author: "",
|
author: "",
|
||||||
dated: null,
|
dated: null,
|
||||||
description: "",
|
description: "",
|
||||||
title: "",
|
title: "",
|
||||||
type: 0,
|
type: 0,
|
||||||
|
|
||||||
slug: Ember.computed('title', function() {
|
slug: Ember.computed('title', function () {
|
||||||
return stringUtil.makeSlug(this.get('title'));
|
return stringUtil.makeSlug(this.get('title'));
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
let FolderModel = BaseModel.extend({
|
let FolderModel = BaseModel.extend({
|
||||||
name: "",
|
name: "",
|
||||||
orgId: "",
|
orgId: "",
|
||||||
userId: "",
|
userId: "",
|
||||||
folderType: constants.FolderType.Private,
|
folderType: constants.FolderType.Private,
|
||||||
|
|
||||||
slug: Ember.computed('name', function() {
|
slug: Ember.computed('name', function () {
|
||||||
return stringUtil.makeSlug(this.get('name'));
|
return stringUtil.makeSlug(this.get('name'));
|
||||||
}),
|
}),
|
||||||
|
|
||||||
markAsRestricted: function() {
|
markAsRestricted: function () {
|
||||||
this.set('folderType', constants.FolderType.Protected);
|
this.set('folderType', constants.FolderType.Protected);
|
||||||
},
|
},
|
||||||
|
|
||||||
markAsPrivate: function() {
|
markAsPrivate: function () {
|
||||||
this.set('folderType', constants.FolderType.Private);
|
this.set('folderType', constants.FolderType.Private);
|
||||||
},
|
},
|
||||||
|
|
||||||
markAsPublic: function() {
|
markAsPublic: function () {
|
||||||
this.set('folderType', constants.FolderType.Public);
|
this.set('folderType', constants.FolderType.Public);
|
||||||
},
|
},
|
||||||
|
|
||||||
// client-side prop that holds who can see this folder
|
// client-side prop that holds who can see this folder
|
||||||
sharedWith: [],
|
sharedWith: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
let AttachmentModel = BaseModel.extend({
|
let AttachmentModel = BaseModel.extend({
|
||||||
documentId: "",
|
documentId: "",
|
||||||
extension: "",
|
extension: "",
|
||||||
fileId: "",
|
fileId: "",
|
||||||
filename: "",
|
filename: "",
|
||||||
job: "",
|
job: "",
|
||||||
orgId: ""
|
orgId: ""
|
||||||
});
|
});
|
||||||
|
|
||||||
let PageModel = BaseModel.extend({
|
let PageModel = BaseModel.extend({
|
||||||
documentId: "",
|
documentId: "",
|
||||||
orgId: "",
|
orgId: "",
|
||||||
contentType: "",
|
contentType: "",
|
||||||
level: 1,
|
level: 1,
|
||||||
sequence: 0,
|
sequence: 0,
|
||||||
revisions: 0,
|
revisions: 0,
|
||||||
title: "",
|
title: "",
|
||||||
body: "",
|
body: "",
|
||||||
rawBody: "",
|
rawBody: "",
|
||||||
meta: {},
|
meta: {},
|
||||||
|
|
||||||
tagName: Ember.computed('level', function() {
|
tagName: Ember.computed('level', function () {
|
||||||
return "h" + this.get('level');
|
return "h" + this.get('level');
|
||||||
}),
|
}),
|
||||||
|
|
||||||
tocIndent: Ember.computed('level', function() {
|
tocIndent: Ember.computed('level', function () {
|
||||||
return (this.get('level') - 1) * 20;
|
return (this.get('level') - 1) * 20;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
tocIndentCss: Ember.computed('tocIndent', function() {
|
tocIndentCss: Ember.computed('tocIndent', function () {
|
||||||
let tocIndent = this.get('tocIndent');
|
let tocIndent = this.get('tocIndent');
|
||||||
return `margin-left-${tocIndent}`;
|
return `margin-left-${tocIndent}`;
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
let PageMetaModel = BaseModel.extend({
|
let PageMetaModel = BaseModel.extend({
|
||||||
pageId: "",
|
pageId: "",
|
||||||
documentId: "",
|
documentId: "",
|
||||||
orgId: "",
|
orgId: "",
|
||||||
rawBody: "",
|
rawBody: "",
|
||||||
config: {},
|
config: {},
|
||||||
externalSource: false,
|
externalSource: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
let SectionModel = BaseModel.extend({
|
let SectionModel = BaseModel.extend({
|
||||||
contentType: "",
|
contentType: "",
|
||||||
title: "",
|
title: "",
|
||||||
description: "",
|
description: "",
|
||||||
iconFont: "",
|
iconFont: "",
|
||||||
iconFile: "",
|
iconFile: "",
|
||||||
|
|
||||||
hasImage: Ember.computed('iconFont', 'iconFile', function() {
|
hasImage: Ember.computed('iconFont', 'iconFile', function () {
|
||||||
return this.get('iconFile').length > 0;
|
return this.get('iconFile').length > 0;
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
AppMeta,
|
TemplateModel,
|
||||||
TemplateModel,
|
AttachmentModel,
|
||||||
AttachmentModel,
|
DocumentModel,
|
||||||
DocumentModel,
|
FolderModel,
|
||||||
FolderModel,
|
FolderPermissionModel,
|
||||||
FolderPermissionModel,
|
OrganizationModel,
|
||||||
OrganizationModel,
|
PageModel,
|
||||||
PageModel,
|
PageMetaModel,
|
||||||
PageMetaModel,
|
ProtectedFolderParticipant,
|
||||||
ProtectedFolderParticipant,
|
UserModel,
|
||||||
UserModel,
|
SectionModel
|
||||||
SectionModel
|
};
|
||||||
};
|
|
|
@ -97,4 +97,4 @@ module.exports = function (environment) {
|
||||||
ENV.contentSecurityPolicy = null;
|
ENV.contentSecurityPolicy = null;
|
||||||
|
|
||||||
return ENV;
|
return ENV;
|
||||||
};
|
};
|
Loading…
Add table
Add a link
Reference in a new issue