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
|
|
|
|
|
2017-11-16 13:28:05 +00:00
|
|
|
import { computed } from '@ember/object';
|
2016-08-11 10:47:53 +02:00
|
|
|
import attr from 'ember-data/attr';
|
|
|
|
import stringUtil from '../utils/string';
|
2018-03-15 17:11:53 +00:00
|
|
|
import Model from 'ember-data/model';
|
2016-08-09 13:16:29 +02:00
|
|
|
|
|
|
|
export default Model.extend({
|
2016-08-11 10:47:53 +02:00
|
|
|
name: attr('string'),
|
|
|
|
orgId: attr('string'),
|
|
|
|
userId: attr('string'),
|
2018-10-12 17:54:15 +01:00
|
|
|
spaceType: attr('number', { defaultValue: 2 }),
|
2018-04-20 14:38:10 +01:00
|
|
|
lifecycle: attr('number', { defaultValue: 1 }),
|
2018-04-13 11:01:36 +01:00
|
|
|
likes: attr('string'),
|
2019-01-04 16:33:30 +00:00
|
|
|
icon: attr('string', { defaultValue: '' }),
|
|
|
|
desc: attr('string', { defaultValue: '' }),
|
|
|
|
labelId: attr('string', { defaultValue: '' }),
|
|
|
|
countCategory: attr('number', { defaultValue: 0 }),
|
|
|
|
countContent: attr('number', { defaultValue: 0 }),
|
2018-04-13 11:01:36 +01:00
|
|
|
|
|
|
|
allowLikes: computed('likes', function () {
|
|
|
|
return is.not.empty(this.get('likes')) && is.not.undefined(this.get('likes'));
|
|
|
|
}),
|
2016-08-09 13:16:29 +02:00
|
|
|
|
2017-11-16 13:28:05 +00:00
|
|
|
slug: computed('name', function () {
|
2016-08-11 10:47:53 +02:00
|
|
|
return stringUtil.makeSlug(this.get('name'));
|
|
|
|
}),
|
|
|
|
|
2016-08-12 14:02:57 +02:00
|
|
|
markAsRestricted() {
|
2018-04-20 14:38:10 +01:00
|
|
|
let constants = this.get('constants');
|
2018-10-12 17:54:15 +01:00
|
|
|
this.set('spaceType', constants.SpaceType.Protected);
|
2016-08-11 10:47:53 +02:00
|
|
|
},
|
|
|
|
|
2016-08-12 14:02:57 +02:00
|
|
|
markAsPrivate() {
|
2018-04-20 14:38:10 +01:00
|
|
|
let constants = this.get('constants');
|
2018-10-12 17:54:15 +01:00
|
|
|
this.set('spaceType', constants.SpaceType.Private);
|
2016-08-11 10:47:53 +02:00
|
|
|
},
|
|
|
|
|
2016-08-12 14:02:57 +02:00
|
|
|
markAsPublic() {
|
2018-04-20 14:38:10 +01:00
|
|
|
let constants = this.get('constants');
|
2018-10-12 17:54:15 +01:00
|
|
|
this.set('spaceType', constants.SpaceType.Public);
|
2016-08-11 10:47:53 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
// client-side prop that holds who can see this folder
|
|
|
|
sharedWith: attr(),
|
|
|
|
created: attr(),
|
|
|
|
revised: attr()
|
2016-08-09 13:16:29 +02:00
|
|
|
});
|