diff --git a/histomicsui/web_client/dialogs/saveAnnotation.js b/histomicsui/web_client/dialogs/saveAnnotation.js index 82e555c7..c8ca5d91 100644 --- a/histomicsui/web_client/dialogs/saveAnnotation.js +++ b/histomicsui/web_client/dialogs/saveAnnotation.js @@ -73,7 +73,8 @@ var SaveAnnotation = View.extend({ type: 'annotation', hideRecurseOption: true, parentView: this, - model: this.annotation + model: this.annotation, + noAccessFlag: true }).on('g:accessListSaved', () => { this.annotation.fetch(); }); diff --git a/histomicsui/web_client/panels/AnnotationSelector.js b/histomicsui/web_client/panels/AnnotationSelector.js index 7ab426e8..c77a91d6 100644 --- a/histomicsui/web_client/panels/AnnotationSelector.js +++ b/histomicsui/web_client/panels/AnnotationSelector.js @@ -1,6 +1,7 @@ import _ from 'underscore'; import $ from 'jquery'; +import { restRequest } from '@girder/core/rest'; import { AccessType } from '@girder/core/constants'; import eventStream from '@girder/core/utilities/EventStream'; import { getCurrentUser } from '@girder/core/auth'; @@ -68,8 +69,11 @@ var AnnotationSelector = Panel.extend({ render() { this._debounceRenderRequest = null; - if (this.parentItem && this.parentItem.id) { - this.parentItem.getAccessLevel((imageAccessLevel) => { + if (this.parentItem && this.parentItem.get('folderId')) { + restRequest({ + type: 'GET', + url: 'annotation/folder/' + this.parentItem.get('folderId') + '/create' + }).done((createResp) => { const annotationGroups = this._getAnnotationGroups(); if (!this.viewer) { this.$el.empty(); @@ -81,7 +85,7 @@ var AnnotationSelector = Panel.extend({ activeAnnotation: this._activeAnnotation ? this._activeAnnotation.id : '', showLabels: this._showLabels, user: getCurrentUser() || {}, - accessLevel: imageAccessLevel, + creationAccess: createResp, writeAccessLevel: AccessType.WRITE, writeAccess: this._writeAccess, opacity: this._opacity, diff --git a/histomicsui/web_client/templates/panels/annotationSelector.pug b/histomicsui/web_client/templates/panels/annotationSelector.pug index 23e516d2..cca4da92 100644 --- a/histomicsui/web_client/templates/panels/annotationSelector.pug +++ b/histomicsui/web_client/templates/panels/annotationSelector.pug @@ -75,7 +75,7 @@ block content label(title='Highlight annotations when hovering with the mouse.') input#h-toggle-interactive(type='checkbox', checked=interactiveMode) | Interactive - if accessLevel >= writeAccessLevel + if creationAccess button.btn.btn-sm.btn-primary.h-create-annotation(title='Create a new annotation. Keyboard shortcut: space bar') | #[span.icon-plus-squared] New .clearfix