mirror of
https://github.com/documize/community.git
synced 2025-07-21 06:09:42 +02:00
improved canEdit for document heading
This commit is contained in:
parent
c0d19f2531
commit
b7811eccde
1 changed files with 14 additions and 0 deletions
|
@ -10,6 +10,7 @@
|
|||
// https://documize.com
|
||||
|
||||
import { empty } from '@ember/object/computed';
|
||||
import { computed } from '@ember/object';
|
||||
import { schedule } from '@ember/runloop';
|
||||
import { inject as service } from '@ember/service';
|
||||
import Component from '@ember/component';
|
||||
|
@ -22,6 +23,19 @@ export default Component.extend({
|
|||
hasNameError: empty('docName'),
|
||||
hasExcerptError: empty('docExcerpt'),
|
||||
|
||||
canEdit: computed('permssions', 'document', function() {
|
||||
let constants = this.get('constants');
|
||||
let permissions = this.get('permissions');
|
||||
|
||||
if (permissions.get('documentEdit') && this.get('document.protection') === constants.ProtectionType.None) {
|
||||
return true;
|
||||
} else if (permissions.get('documentApprove') && this.get('document.protection') === constants.ProtectionType.Review) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}),
|
||||
|
||||
keyUp(e) {
|
||||
if (e.keyCode === 27) { // escape key
|
||||
this.send('onCancel');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue