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/folder.js

45 lines
1.2 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 constants from '../utils/constants';
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'),
2016-08-17 15:37:46 +02:00
folderType: attr('number', { defaultValue: 2 }),
slug: computed('name', function () {
return stringUtil.makeSlug(this.get('name'));
}),
2016-08-12 14:02:57 +02:00
markAsRestricted() {
this.set('folderType', constants.FolderType.Protected);
},
2016-08-12 14:02:57 +02:00
markAsPrivate() {
this.set('folderType', constants.FolderType.Private);
},
2016-08-12 14:02:57 +02:00
markAsPublic() {
this.set('folderType', constants.FolderType.Public);
},
// client-side prop that holds who can see this folder
sharedWith: attr(),
created: attr(),
revised: attr()
});