Add „show version“ link to version header && tighten permissions

pull/7347/head
Henriette Dinger 6 years ago
parent 47412a3a37
commit ba2d79f0b1
  1. 21
      frontend/src/app/modules/boards/board/board-actions/version/version-action.service.ts
  2. 4
      frontend/src/app/modules/common/path-helper/path-helper.service.ts
  3. 1
      modules/boards/config/locales/js-en.yml

@ -170,7 +170,7 @@ export class BoardVersionActionService implements BoardActionService {
return [ return [
{ {
// Lock version // Lock version
hidden: !version.isOpen(), hidden: !version.isOpen() || (version.isLocked() && !version.$links.update),
linkText: this.I18n.t('js.boards.version.lock_version'), linkText: this.I18n.t('js.boards.version.lock_version'),
onClick: () => { onClick: () => {
this.patchVersionStatus(version, 'locked'); this.patchVersionStatus(version, 'locked');
@ -179,7 +179,7 @@ export class BoardVersionActionService implements BoardActionService {
}, },
{ {
// Unlock version // Unlock version
hidden: !version.isLocked(), hidden: !version.isLocked() || (version.isOpen() && !version.$links.update),
linkText: this.I18n.t('js.boards.version.unlock_version'), linkText: this.I18n.t('js.boards.version.unlock_version'),
onClick: () => { onClick: () => {
this.patchVersionStatus(version, 'open'); this.patchVersionStatus(version, 'open');
@ -188,7 +188,7 @@ export class BoardVersionActionService implements BoardActionService {
}, },
{ {
// Close version // Close version
hidden: version.isClosed(), hidden: version.isClosed() || (!version.isClosed() && !version.$links.update),
linkText: this.I18n.t('js.boards.version.close_version'), linkText: this.I18n.t('js.boards.version.close_version'),
onClick: () => { onClick: () => {
this.patchVersionStatus(version, 'closed'); this.patchVersionStatus(version, 'closed');
@ -197,13 +197,26 @@ export class BoardVersionActionService implements BoardActionService {
}, },
{ {
// Open version // Open version
hidden: !version.isClosed(), hidden: !version.isClosed() || (version.isClosed() && !version.$links.update),
linkText: this.I18n.t('js.boards.version.open_version'), linkText: this.I18n.t('js.boards.version.open_version'),
onClick: () => { onClick: () => {
this.patchVersionStatus(version, 'open'); this.patchVersionStatus(version, 'open');
return true; 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 // Edit link
hidden: !version.$links.update, hidden: !version.$links.update,

@ -168,6 +168,10 @@ export class PathHelperService {
return this.staticBase + '/versions/' + id + '/edit'; return this.staticBase + '/versions/' + id + '/edit';
} }
public versionShowPath(id:string|number) {
return this.staticBase + '/versions/' + id;
}
public workPackagesPath() { public workPackagesPath() {
return this.staticBase + '/work_packages'; return this.staticBase + '/work_packages';
} }

@ -22,6 +22,7 @@ en:
lock_version: 'Lock version' lock_version: 'Lock version'
unlock_version: 'Unlock version' unlock_version: 'Unlock version'
edit_version: 'Edit version' edit_version: 'Edit version'
show_version: 'Show version'
new_board: 'New board' new_board: 'New board'
add_list: 'Add list' add_list: 'Add list'

Loading…
Cancel
Save