diff --git a/gui/app/components/document/document-meta.js b/gui/app/components/document/document-meta.js index 7f1980db..7ac9e252 100644 --- a/gui/app/components/document/document-meta.js +++ b/gui/app/components/document/document-meta.js @@ -22,6 +22,7 @@ export default Component.extend(Modals, Tooltips, { documentService: service('document'), sessionService: service('session'), categoryService: service('category'), + router: service(), contributorMsg: '', approverMsg: '', @@ -29,6 +30,9 @@ export default Component.extend(Modals, Tooltips, { isApprover: computed('permissions', function() { return this.get('permissions.documentApprove'); }), + isSpaceAdmin: computed('permissions', function() { + return this.get('permissions.spaceOwner') || this.get('permissions.spaceManage'); + }), changeControlMsg: computed('document.protection', function() { let p = this.get('document.protection'); let constants = this.get('constants'); @@ -97,32 +101,45 @@ export default Component.extend(Modals, Tooltips, { popovers() { let constants = this.get('constants'); - $('#document-lifecycle-popover').popover('dispose'); - $('#document-protection-popover').popover('dispose'); + if (this.get('permissions.documentLifecycle')) { + $('#document-lifecycle-popover').addClass('cursor-pointer'); + } else { + $('#document-lifecycle-popover').popover('dispose'); + $('#document-lifecycle-popover').removeClass('cursor-pointer'); - $('#document-lifecycle-popover').popover({ - html: true, - title: 'Lifecycle', - content: "

Draft — restricted visiblity and not searchable

Live — document visible to all

Archived — not visible or searchable

", - placement: 'top' - }); - - let ccMsg = `

${this.changeControlMsg}

`; - - if (this.get('document.protection') === constants.ProtectionType.Review) { - ccMsg += '' + $('#document-lifecycle-popover').popover({ + html: true, + title: 'Lifecycle', + content: "

Draft — restricted visiblity and not searchable

Live — document visible to all

Archived — not visible or searchable

", + placement: 'top', + trigger: 'hover click' + }); } - $('#document-protection-popover').popover({ - html: true, - title: 'Change Control', - content: ccMsg, - placement: 'top' - }); + if (this.get('permissions.documentApprove')) { + $('#document-protection-popover').addClass('cursor-pointer'); + } else { + $('#document-protection-popover').popover('dispose'); + $('#document-protection-popover').removeClass('cursor-pointer'); + + let ccMsg = `

${this.changeControlMsg}

`; + + if (this.get('document.protection') === constants.ProtectionType.Review) { + ccMsg += '' + } + + $('#document-protection-popover').popover({ + html: true, + title: 'Change Control', + content: ccMsg, + placement: 'top', + trigger: 'hover click' + }); + } }, workflowStatus() { @@ -187,6 +204,20 @@ export default Component.extend(Modals, Tooltips, { this.get('router').transitionTo('document', space.get('id'), space.get('slug'), version.documentId, this.get('document.slug')); + }, + + onEditLifecycle() { + //no op + }, + + onEditProtection() { + //no op + }, + + onEditCategory() { + if (!this.get('permissions.spaceManage')) return; + + this.get('router').transitionTo('document.settings', {queryParams: {tab: 'meta'}}); } } }); diff --git a/gui/app/pods/document/settings/controller.js b/gui/app/pods/document/settings/controller.js index 4a5a4fe8..304b4c44 100644 --- a/gui/app/pods/document/settings/controller.js +++ b/gui/app/pods/document/settings/controller.js @@ -18,6 +18,7 @@ export default Controller.extend(Notifier, { folderService: service('folder'), documentService: service('document'), localStorage: service('localStorage'), + queryParams: ['tab'], tab: 'general', actions: { diff --git a/gui/app/pods/folder/settings/controller.js b/gui/app/pods/folder/settings/controller.js index e6f4db08..9adca9d4 100644 --- a/gui/app/pods/folder/settings/controller.js +++ b/gui/app/pods/folder/settings/controller.js @@ -17,6 +17,7 @@ export default Controller.extend(NotifierMixin, { router: service(), folderService: service('folder'), localStorage: service('localStorage'), + queryParams: ['tab'], tab: 'general', actions: { diff --git a/gui/app/styles/view/document/doc-meta.scss b/gui/app/styles/view/document/doc-meta.scss index 2d239393..d8053338 100644 --- a/gui/app/styles/view/document/doc-meta.scss +++ b/gui/app/styles/view/document/doc-meta.scss @@ -24,7 +24,6 @@ background-color: $color-off-white; font-weight: 800; font-size: 1rem; - cursor: pointer; &:hover { color: $color-green; @@ -50,7 +49,6 @@ color: $color-gray; background-color: $color-off-white; border: 2px solid $color-gray; - cursor: pointer; &:hover { color: $color-dark; diff --git a/gui/app/templates/components/document/document-meta.hbs b/gui/app/templates/components/document/document-meta.hbs index e5abd590..3448cec6 100644 --- a/gui/app/templates/components/document/document-meta.hbs +++ b/gui/app/templates/components/document/document-meta.hbs @@ -1,28 +1,28 @@ {{#if (eq document.lifecycle constants.Lifecycle.Live)}} -
{{document.lifecycleLabel}}
+
{{document.lifecycleLabel}}
{{/if}} {{#if (eq document.lifecycle constants.Lifecycle.Draft)}} -
{{document.lifecycleLabel}}
+
{{document.lifecycleLabel}}
{{/if}}
{{#if (eq document.protection constants.ProtectionType.None)}} -
OPEN
+
OPEN
{{/if}} {{#if (eq document.protection constants.ProtectionType.Review)}} -
PROTECTED
+
PROTECTED
{{/if}} {{#if (eq document.protection constants.ProtectionType.Lock)}} -
LOCKED
+
LOCKED
{{/if}}
{{#each selectedCategories as |cat|}} -
+
{{cat.category}}
{{/each}} @@ -30,13 +30,13 @@
{{#each tagz as |t index|}} -
+
{{concat '#' t}}
{{/each}}
- {{document/view-attachment document=document permissions=permissions}} + {{document/view-attachment document=document permissions=permissions {{action 'onEditCategory'}}}}
diff --git a/gui/app/templates/components/folder/space-view.hbs b/gui/app/templates/components/folder/space-view.hbs index 65c3d9cf..52e44bc0 100644 --- a/gui/app/templates/components/folder/space-view.hbs +++ b/gui/app/templates/components/folder/space-view.hbs @@ -29,7 +29,7 @@ {{#if spaceSettings}}
- {{#link-to 'folder.settings' space.id space.slug class="btn btn-secondary font-weight-bold"}}{{categoryLinkName}}{{/link-to}} + {{#link-to 'folder.settings' space.id space.slug (query-params tab="categories") class="btn btn-secondary font-weight-bold"}}{{categoryLinkName}}{{/link-to}}
{{/if}}
\ No newline at end of file