1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-19 05:09:42 +02:00
documize/gui/app/models/document-activity.js

118 lines
3 KiB
JavaScript
Raw Normal View History

2017-04-04 17:55:17 +01: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
import { computed } from '@ember/object';
2017-04-04 17:55:17 +01:00
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
export default Model.extend({
orgId: attr('string'),
spaceId: attr('string'),
2017-04-04 17:55:17 +01:00
documentId: attr('string'),
2018-01-19 11:36:38 +00:00
pageId: attr('string'),
pageTitle: attr('string'),
2017-04-04 17:55:17 +01:00
userId: attr('string'),
firstname: attr('string'),
lastname: attr('string'),
activityType: attr('number'),
created: attr(),
activityLabel: computed('activityType', function() {
2017-04-04 17:55:17 +01:00
let label = '';
2018-04-20 14:38:10 +01:00
let constants = this.get('constants');
2017-04-04 17:55:17 +01:00
switch (this.get('activityType')) {
case constants.UserActivityType.Created:
label = 'Added';
break;
case constants.UserActivityType.Read:
label = 'Viewed';
break;
case constants.UserActivityType.Edited:
label = 'Edited';
break;
case constants.UserActivityType.Deleted:
label = 'Deleted';
break;
case constants.UserActivityType.Archived:
label = 'Archived';
break;
case constants.UserActivityType.Approved:
label = 'Approved';
break;
case constants.UserActivityType.Reverted:
label = 'Reverted';
break;
case constants.UserActivityType.PublishedTemplate:
label = 'Published Template';
break;
case constants.UserActivityType.PublishedBlock:
label = 'Published Block';
break;
case constants.UserActivityType.Rejected:
label = 'Rejected';
break;
2018-04-20 14:38:10 +01:00
case constants.UserActivityType.Published:
label = 'Published';
break;
2017-04-04 17:55:17 +01:00
default:
break;
}
return label;
}),
activityColor: computed('activityType', function() {
2017-04-04 17:55:17 +01:00
let color = '';
2018-04-20 14:38:10 +01:00
let constants = this.get('constants');
2017-04-04 17:55:17 +01:00
switch (this.get('activityType')) {
case constants.UserActivityType.Created:
color = 'color-blue';
break;
case constants.UserActivityType.Read:
color = 'color-black';
break;
case constants.UserActivityType.Edited:
color = 'color-green';
break;
case constants.UserActivityType.Deleted:
color = 'color-red';
break;
case constants.UserActivityType.Archived:
color = 'color-gray';
break;
case constants.UserActivityType.Approved:
color = 'color-green';
break;
case constants.UserActivityType.Reverted:
color = 'color-red';
break;
case constants.UserActivityType.PublishedTemplate:
color = 'color-blue';
break;
case constants.UserActivityType.PublishedBlock:
color = 'color-blue';
break;
case constants.UserActivityType.Rejected:
color = 'color-red';
break;
2018-04-20 14:38:10 +01:00
case constants.UserActivityType.Published:
color = 'color-green';
break;
2017-04-04 17:55:17 +01:00
default:
break;
}
return color;
})
});