mirror of
https://github.com/documize/community.git
synced 2025-08-02 20:15:26 +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
|
@ -12,7 +12,6 @@
|
|||
import { computed } from '@ember/object';
|
||||
import Model from 'ember-data/model';
|
||||
import attr from 'ember-data/attr';
|
||||
import constants from '../utils/constants';
|
||||
|
||||
export default Model.extend({
|
||||
orgId: attr('string'),
|
||||
|
@ -28,6 +27,7 @@ export default Model.extend({
|
|||
|
||||
activityLabel: computed('activityType', function() {
|
||||
let label = '';
|
||||
let constants = this.get('constants');
|
||||
|
||||
switch (this.get('activityType')) {
|
||||
case constants.UserActivityType.Created:
|
||||
|
@ -60,6 +60,9 @@ export default Model.extend({
|
|||
case constants.UserActivityType.Rejected:
|
||||
label = 'Rejected';
|
||||
break;
|
||||
case constants.UserActivityType.Published:
|
||||
label = 'Published';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -69,6 +72,7 @@ export default Model.extend({
|
|||
|
||||
activityColor: computed('activityType', function() {
|
||||
let color = '';
|
||||
let constants = this.get('constants');
|
||||
|
||||
switch (this.get('activityType')) {
|
||||
case constants.UserActivityType.Created:
|
||||
|
@ -101,6 +105,9 @@ export default Model.extend({
|
|||
case constants.UserActivityType.Rejected:
|
||||
color = 'color-red';
|
||||
break;
|
||||
case constants.UserActivityType.Published:
|
||||
color = 'color-green';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
import { computed } from '@ember/object';
|
||||
import attr from 'ember-data/attr';
|
||||
import constants from '../utils/constants';
|
||||
import stringUtil from '../utils/string';
|
||||
import Model from 'ember-data/model';
|
||||
|
||||
|
@ -20,6 +19,7 @@ export default Model.extend({
|
|||
orgId: attr('string'),
|
||||
userId: attr('string'),
|
||||
folderType: attr('number', { defaultValue: 2 }),
|
||||
lifecycle: attr('number', { defaultValue: 1 }),
|
||||
likes: attr('string'),
|
||||
|
||||
allowLikes: computed('likes', function () {
|
||||
|
@ -31,14 +31,17 @@ export default Model.extend({
|
|||
}),
|
||||
|
||||
markAsRestricted() {
|
||||
let constants = this.get('constants');
|
||||
this.set('folderType', constants.FolderType.Protected);
|
||||
},
|
||||
|
||||
markAsPrivate() {
|
||||
let constants = this.get('constants');
|
||||
this.set('folderType', constants.FolderType.Private);
|
||||
},
|
||||
|
||||
markAsPublic() {
|
||||
let constants = this.get('constants');
|
||||
this.set('folderType', constants.FolderType.Public);
|
||||
},
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ export default Model.extend({
|
|||
versioned: attr('string'),
|
||||
drafted: attr('string'),
|
||||
archived: attr('string'),
|
||||
published: attr('string'),
|
||||
|
||||
hasContributed: computed('contributed', function () {
|
||||
return this.get('contributed').length > 0;
|
||||
|
@ -49,5 +50,8 @@ export default Model.extend({
|
|||
}),
|
||||
hasArchived: computed('archived', function () {
|
||||
return this.get('archived').length > 0;
|
||||
}),
|
||||
hasPublished: computed('published', function () {
|
||||
return this.get('published').length > 0;
|
||||
})
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue