From ba2d79f0b1f7950e2a6325cbce7b708cf3ed0f2c Mon Sep 17 00:00:00 2001 From: Henriette Dinger Date: Fri, 31 May 2019 14:35:32 +0200 Subject: [PATCH] =?UTF-8?q?Add=20=E2=80=9Eshow=20version=E2=80=9C=20link?= =?UTF-8?q?=20to=20version=20header=20&&=20tighten=20permissions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../version/version-action.service.ts | 21 +++++++++++++++---- .../common/path-helper/path-helper.service.ts | 4 ++++ modules/boards/config/locales/js-en.yml | 1 + 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/modules/boards/board/board-actions/version/version-action.service.ts b/frontend/src/app/modules/boards/board/board-actions/version/version-action.service.ts index 737cbc835b..58f36d8fff 100644 --- a/frontend/src/app/modules/boards/board/board-actions/version/version-action.service.ts +++ b/frontend/src/app/modules/boards/board/board-actions/version/version-action.service.ts @@ -170,7 +170,7 @@ export class BoardVersionActionService implements BoardActionService { return [ { // Lock version - hidden: !version.isOpen(), + hidden: !version.isOpen() || (version.isLocked() && !version.$links.update), linkText: this.I18n.t('js.boards.version.lock_version'), onClick: () => { this.patchVersionStatus(version, 'locked'); @@ -179,7 +179,7 @@ export class BoardVersionActionService implements BoardActionService { }, { // Unlock version - hidden: !version.isLocked(), + hidden: !version.isLocked() || (version.isOpen() && !version.$links.update), linkText: this.I18n.t('js.boards.version.unlock_version'), onClick: () => { this.patchVersionStatus(version, 'open'); @@ -188,7 +188,7 @@ export class BoardVersionActionService implements BoardActionService { }, { // Close version - hidden: version.isClosed(), + hidden: version.isClosed() || (!version.isClosed() && !version.$links.update), linkText: this.I18n.t('js.boards.version.close_version'), onClick: () => { this.patchVersionStatus(version, 'closed'); @@ -197,13 +197,26 @@ export class BoardVersionActionService implements BoardActionService { }, { // Open version - hidden: !version.isClosed(), + hidden: !version.isClosed() || (version.isClosed() && !version.$links.update), linkText: this.I18n.t('js.boards.version.open_version'), onClick: () => { this.patchVersionStatus(version, 'open'); return true; } }, + { + // Show link + linkText: this.I18n.t('js.boards.version.show_version'), + href: this.pathHelper.versionShowPath(id), + onClick: (evt:JQuery.Event) => { + if (!LinkHandling.isClickedWithModifier(evt)) { + window.open(this.pathHelper.versionShowPath(id), '_blank'); + return true; + } + + return false; + } + }, { // Edit link hidden: !version.$links.update, diff --git a/frontend/src/app/modules/common/path-helper/path-helper.service.ts b/frontend/src/app/modules/common/path-helper/path-helper.service.ts index 3c82922d08..cb9b671cd5 100644 --- a/frontend/src/app/modules/common/path-helper/path-helper.service.ts +++ b/frontend/src/app/modules/common/path-helper/path-helper.service.ts @@ -168,6 +168,10 @@ export class PathHelperService { return this.staticBase + '/versions/' + id + '/edit'; } + public versionShowPath(id:string|number) { + return this.staticBase + '/versions/' + id; + } + public workPackagesPath() { return this.staticBase + '/work_packages'; } diff --git a/modules/boards/config/locales/js-en.yml b/modules/boards/config/locales/js-en.yml index fc9b1133c7..63826fa264 100644 --- a/modules/boards/config/locales/js-en.yml +++ b/modules/boards/config/locales/js-en.yml @@ -22,6 +22,7 @@ en: lock_version: 'Lock version' unlock_version: 'Unlock version' edit_version: 'Edit version' + show_version: 'Show version' new_board: 'New board' add_list: 'Add list'