mirror of
https://github.com/documize/community.git
synced 2025-08-05 05:25:27 +02:00
Reafctor client side (EJS) constants
This commit is contained in:
parent
8fb001422a
commit
bde0091a4a
23 changed files with 118 additions and 367 deletions
|
@ -1,46 +0,0 @@
|
|||
// 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
|
||||
|
||||
export default {
|
||||
FolderType: {
|
||||
Public: 1,
|
||||
Private: 2,
|
||||
Protected: 3
|
||||
},
|
||||
|
||||
AuthProvider: {
|
||||
Documize: 'documize',
|
||||
Keycloak: 'keycloak'
|
||||
},
|
||||
|
||||
DocumentActionType: {
|
||||
Read: 1,
|
||||
Feedback: 2,
|
||||
Contribute: 3,
|
||||
Approve: 4,
|
||||
Approved: 5,
|
||||
Rejected: 6,
|
||||
},
|
||||
|
||||
UserActivityType: {
|
||||
Created: 1,
|
||||
Read: 2,
|
||||
Edited: 3,
|
||||
Deleted: 4,
|
||||
Archived: 5,
|
||||
Approved: 6,
|
||||
Reverted: 7,
|
||||
PublishedTemplate: 8,
|
||||
PublishedBlock: 9,
|
||||
Feedback: 10,
|
||||
Rejected: 11,
|
||||
}
|
||||
};
|
|
@ -1,232 +0,0 @@
|
|||
// 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
|
||||
|
||||
import { htmlSafe } from '@ember/string';
|
||||
import EmberObject, { computed } from '@ember/object';
|
||||
import Ember from 'ember';
|
||||
import stringUtil from '../utils/string';
|
||||
import constants from '../utils/constants';
|
||||
|
||||
let BaseModel = EmberObject.extend({
|
||||
id: "",
|
||||
created: null,
|
||||
revised: null,
|
||||
|
||||
setSafe(attr, value) {
|
||||
this.set(attr, htmlSafe(Ember.Handlebars.Utils.escapeExpression(value)));
|
||||
}
|
||||
});
|
||||
|
||||
// ProtectedFolderParticipant used to display folder participants that can
|
||||
// then be marked as folder owner.
|
||||
let ProtectedFolderParticipant = EmberObject.extend({
|
||||
userId: "",
|
||||
email: "",
|
||||
firstname: "",
|
||||
lastname: "",
|
||||
name: "",
|
||||
folderId: "",
|
||||
folderType: 0,
|
||||
|
||||
fullname: computed('firstname', 'lastname', function () {
|
||||
return `${this.get('firstname')} ${this.get('lastname')}`;
|
||||
})
|
||||
});
|
||||
|
||||
let UserModel = BaseModel.extend({
|
||||
firstname: "",
|
||||
lastname: "",
|
||||
email: "",
|
||||
initials: "",
|
||||
active: false,
|
||||
editor: false,
|
||||
admin: false,
|
||||
|
||||
fullname: computed('firstname', 'lastname', function () {
|
||||
return `${this.get('firstname')} ${this.get('lastname')}`;
|
||||
}),
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
this.accounts = [];
|
||||
},
|
||||
|
||||
generateInitials() {
|
||||
let first = this.get('firstname').trim();
|
||||
let last = this.get('lastname').trim();
|
||||
this.set('initials', first.substr(0, 1) + last.substr(0, 1));
|
||||
},
|
||||
|
||||
copy() {
|
||||
let copy = UserModel.create();
|
||||
copy.id = this.id;
|
||||
copy.created = this.created;
|
||||
copy.revised = this.revised;
|
||||
copy.firstname = this.firstname;
|
||||
copy.lastname = this.lastname;
|
||||
copy.email = this.email;
|
||||
copy.initials = this.initials;
|
||||
copy.active = this.active;
|
||||
copy.editor = this.editor;
|
||||
copy.admin = this.admin;
|
||||
copy.accounts = this.accounts;
|
||||
|
||||
return copy;
|
||||
}
|
||||
});
|
||||
|
||||
let OrganizationModel = BaseModel.extend({
|
||||
title: "",
|
||||
message: "",
|
||||
email: "",
|
||||
allowAnonymousAccess: false,
|
||||
});
|
||||
|
||||
let DocumentModel = BaseModel.extend({
|
||||
name: "",
|
||||
excerpt: "",
|
||||
job: "",
|
||||
location: "",
|
||||
orgId: "",
|
||||
folderId: "",
|
||||
userId: "",
|
||||
tags: "",
|
||||
template: "",
|
||||
protection: 0,
|
||||
approval: 0,
|
||||
|
||||
slug: computed('name', function () {
|
||||
return stringUtil.makeSlug(this.get('name'));
|
||||
}),
|
||||
|
||||
// client-side property
|
||||
selected: false
|
||||
});
|
||||
|
||||
let TemplateModel = BaseModel.extend({
|
||||
author: "",
|
||||
dated: null,
|
||||
description: "",
|
||||
title: "",
|
||||
type: 0,
|
||||
|
||||
slug: computed('title', function () {
|
||||
return stringUtil.makeSlug(this.get('title'));
|
||||
}),
|
||||
});
|
||||
|
||||
let FolderModel = BaseModel.extend({
|
||||
name: "",
|
||||
orgId: "",
|
||||
userId: "",
|
||||
folderType: constants.FolderType.Private,
|
||||
|
||||
slug: computed('name', function () {
|
||||
return stringUtil.makeSlug(this.get('name'));
|
||||
}),
|
||||
|
||||
markAsRestricted: function () {
|
||||
this.set('folderType', constants.FolderType.Protected);
|
||||
},
|
||||
|
||||
markAsPrivate: function () {
|
||||
this.set('folderType', constants.FolderType.Private);
|
||||
},
|
||||
|
||||
markAsPublic: function () {
|
||||
this.set('folderType', constants.FolderType.Public);
|
||||
},
|
||||
|
||||
// client-side prop that holds who can see this folder
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
this.sharedWith = [];
|
||||
}
|
||||
});
|
||||
|
||||
let AttachmentModel = BaseModel.extend({
|
||||
documentId: "",
|
||||
extension: "",
|
||||
fileId: "",
|
||||
filename: "",
|
||||
job: "",
|
||||
orgId: ""
|
||||
});
|
||||
|
||||
let PageModel = BaseModel.extend({
|
||||
documentId: "",
|
||||
orgId: "",
|
||||
contentType: "",
|
||||
level: 1,
|
||||
sequence: 1004,
|
||||
revisions: 0,
|
||||
title: "",
|
||||
body: "",
|
||||
rawBody: "",
|
||||
status: 0,
|
||||
relativeId: '',
|
||||
|
||||
tagName: computed('level', function () {
|
||||
return "h" + this.get('level');
|
||||
}),
|
||||
|
||||
tocIndent: computed('level', function () {
|
||||
return (this.get('level') - 1) * 20;
|
||||
}),
|
||||
|
||||
tocIndentCss: computed('tocIndent', function () {
|
||||
let tocIndent = this.get('tocIndent');
|
||||
return `margin-left-${tocIndent}`;
|
||||
}),
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
this.meta = {};
|
||||
}
|
||||
});
|
||||
|
||||
let PageMetaModel = BaseModel.extend({
|
||||
pageId: "",
|
||||
documentId: "",
|
||||
orgId: "",
|
||||
rawBody: "",
|
||||
externalSource: false,
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
this.config = {};
|
||||
}
|
||||
});
|
||||
|
||||
let SectionModel = BaseModel.extend({
|
||||
contentType: "",
|
||||
title: "",
|
||||
description: "",
|
||||
iconFont: "",
|
||||
iconFile: "",
|
||||
|
||||
hasImage: computed('iconFont', 'iconFile', function () {
|
||||
return this.get('iconFile').length > 0;
|
||||
}),
|
||||
});
|
||||
|
||||
export default {
|
||||
AttachmentModel,
|
||||
DocumentModel,
|
||||
FolderModel,
|
||||
OrganizationModel,
|
||||
PageModel,
|
||||
PageMetaModel,
|
||||
ProtectedFolderParticipant,
|
||||
SectionModel,
|
||||
TemplateModel,
|
||||
UserModel
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue