1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-19 13:19:43 +02:00
documize/gui/app/models/folder.js

58 lines
1.7 KiB
JavaScript
Raw Normal View History

// 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';
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';
export default Model.extend({
name: attr('string'),
orgId: attr('string'),
userId: attr('string'),
spaceType: attr('number', { defaultValue: 2 }),
2018-04-20 14:38:10 +01:00
lifecycle: attr('number', { defaultValue: 1 }),
likes: attr('string'),
icon: attr('string', { defaultValue: '' }),
desc: attr('string', { defaultValue: '' }),
labelId: attr('string', { defaultValue: '' }),
countCategory: attr('number', { defaultValue: 0 }),
countContent: attr('number', { defaultValue: 0 }),
allowLikes: computed('likes', function () {
return !_.isEmpty(this.get('likes')) && !_.isUndefined(this.get('likes'));
}),
slug: computed('name', function () {
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');
this.set('spaceType', constants.SpaceType.Protected);
},
2016-08-12 14:02:57 +02:00
markAsPrivate() {
2018-04-20 14:38:10 +01:00
let constants = this.get('constants');
this.set('spaceType', constants.SpaceType.Private);
},
2016-08-12 14:02:57 +02:00
markAsPublic() {
2018-04-20 14:38:10 +01:00
let constants = this.get('constants');
this.set('spaceType', constants.SpaceType.Public);
},
// client-side prop that holds who can see this folder
sharedWith: attr(),
created: attr(),
revised: attr()
});