[angular-18-override-references]: Allow change visibility in all entities in reference profiles.

This commit is contained in:
Konstantinos Triantafyllou 2024-11-05 16:05:13 +02:00
parent 00da623e84
commit a04688afd3
4 changed files with 33 additions and 45 deletions

View File

@ -31,27 +31,24 @@
<div class="uk-card uk-card-default uk-padding-small number-card uk-position-relative">
<div *ngIf="!dragging"
class="uk-position-top-right uk-margin-small-right uk-margin-small-top">
<icon *ngIf="!isEditable && showVisibility" [flex]="true"
[name]="stakeholderUtils.visibilityIcon.get(indicator.visibility)"
ratio="0.6"></icon>
<a *ngIf="isEditable && (isCurator || showVisibility)"
<a *ngIf="isEditable || showVisibility"
class="uk-link-reset uk-flex uk-flex-middle" [class.uk-disabled]="editing">
<icon *ngIf="showVisibility" [flex]="true"
[name]="stakeholderUtils.visibilityIcon.get(indicator.visibility)"
ratio="0.6"></icon>
<icon [flex]="true" name="more_vert"></icon>
</a>
<div #element *ngIf="isEditable && (isCurator || showVisibility)"
<div #element *ngIf="isEditable || showVisibility"
class="uk-dropdown"
uk-dropdown="mode: click; pos: bottom-left; offset: 5; delay-hide: 0">
<ul class="uk-nav uk-dropdown-nav">
<ng-container *ngIf="isCurator">
<ng-container *ngIf="isEditable">
<li>
<a (click)="editNumberIndicatorOpen(number, indicator._id); hide(element)">Edit</a>
</li>
</ng-container>
<ng-container *ngIf="showVisibility">
<li *ngIf="isCurator" class="uk-nav-divider"></li>
<li *ngIf="isEditable" class="uk-nav-divider"></li>
<li *ngFor="let v of stakeholderUtils.visibilities">
<a (click)="changeIndicatorStatus(number._id, indicator, v.value);hide(element)">
<div class="uk-flex uk-flex-middle">
@ -65,7 +62,7 @@
</a>
</li>
</ng-container>
<ng-container *ngIf="!indicator.defaultId && !editing && isCurator">
<ng-container *ngIf="!indicator.defaultId && !editing && isEditable">
<li class="uk-nav-divider">
<li>
<a (click)="deleteIndicatorOpen(number, indicator._id, 'number', 'delete');hide(element)">Delete</a>
@ -83,7 +80,7 @@
</div>
</div>
</div>
<div *ngIf="isCurator && isEditable" class="uk-margin-top">
<div *ngIf="isEditable" class="uk-margin-top">
<div class="uk-grid uk-grid-small" uk-grid>
<div [ngClass]="getNumberClassBySize('small')">
<a class="uk-card uk-card-default number-card uk-padding-small uk-flex uk-flex-middle uk-link-reset"
@ -146,27 +143,24 @@
<!-- Dropdown -->
<div *ngIf="!dragging"
class="uk-position-top-right uk-margin-small-right uk-margin-small-top">
<icon *ngIf="!isEditable && showVisibility" [flex]="true"
[name]="stakeholderUtils.visibilityIcon.get(indicator.visibility)"
ratio="0.6"></icon>
<a *ngIf="isEditable && (isCurator || showVisibility)"
<a *ngIf="isEditable || showVisibility"
class="uk-link-reset uk-flex uk-flex-middle" [class.uk-disabled]="editing">
<icon *ngIf="showVisibility" [flex]="true"
[name]="stakeholderUtils.visibilityIcon.get(indicator.visibility)"
ratio="0.6"></icon>
<icon [flex]="true" name="more_vert"></icon>
</a>
<div #element *ngIf="isEditable && (isCurator || showVisibility)"
<div #element *ngIf="isEditable || showVisibility"
class="uk-dropdown"
uk-dropdown="mode: click; pos: bottom-left; offset: 5; delay-hide: 0">
<ul class="uk-nav uk-dropdown-nav">
<ng-container *ngIf="isCurator">
<ng-container *ngIf="isEditable">
<li>
<a (click)="editChartIndicatorOpen(chart, indicator._id); hide(element)">Edit</a>
</li>
</ng-container>
<ng-container *ngIf="showVisibility">
<li *ngIf="isCurator" class="uk-nav-divider"></li>
<li *ngIf="isEditable" class="uk-nav-divider"></li>
<li *ngFor="let v of stakeholderUtils.visibilities">
<a (click)="changeIndicatorStatus(chart._id, indicator, v.value);">
<div class="uk-flex uk-flex-middle">
@ -180,7 +174,7 @@
</a>
</li>
</ng-container>
<ng-container *ngIf="!indicator.defaultId && !editing && isCurator">
<ng-container *ngIf="!indicator.defaultId && !editing && isEditable">
<li class="uk-nav-divider">
<li>
<a (click)="deleteIndicatorOpen(chart, indicator._id, 'chart', 'delete');hide(element)">Delete</a>
@ -228,7 +222,7 @@
</div>
</div>
</div>
<div *ngIf="isCurator && isEditable" class="uk-margin-top">
<div *ngIf="isEditable" class="uk-margin-top">
<div class="uk-grid uk-grid-small uk-grid-match" uk-grid>
<div [ngClass]="getChartClassBySize('small')">
<div class=" uk-card uk-card-default uk-card-body clickable"
@ -250,7 +244,7 @@
</div>
</div>
</div>
<div *ngIf="isEditable && isCurator">
<div *ngIf="isEditable">
<div class="section">
<div class="uk-flex uk-flex-center" (click)="createSection(-1)">
<button class="uk-button uk-button-primary uk-flex uk-flex-middle">

View File

@ -1524,7 +1524,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
}
get isEditable(): boolean {
return this.stakeholder.copy || this.stakeholder.defaultId == null || this.stakeholder.defaultId == '-1';
return this.isCurator && (this.stakeholder.copy || this.stakeholder.defaultId == null || this.stakeholder.defaultId == '-1');
}
isLegendEnabled(indicator, i) {

View File

@ -28,17 +28,15 @@
</span>
<span class="uk-margin-xsmall-left hide-on-close" [class.uk-invisible-hover]="topicIndex !== i"
(click)="$event.stopPropagation();$event.preventDefault()">
<icon *ngIf="!isEditable && showVisibility" [flex]="true" [name]="stakeholderUtils.visibilityIcon.get(topic.visibility)"
ratio="0.6"></icon>
<a *ngIf="isEditable && (isCurator || showVisibility)" class="uk-link-reset uk-flex uk-flex-middle">
<a *ngIf="isEditable || showVisibility" class="uk-link-reset uk-flex uk-flex-middle">
<icon *ngIf="showVisibility" [flex]="true" [name]="stakeholderUtils.visibilityIcon.get(topic.visibility)"
ratio="0.6"></icon>
<icon [flex]="true" name="more_vert"></icon>
</a>
<div #element *ngIf="isEditable && (isCurator || showVisibility)"
<div #element *ngIf="(isEditable) || showVisibility"
uk-dropdown="mode: click; pos: bottom-left; offset: 5; delay-hide: 0; flip: false; container: body">
<ul class="uk-nav uk-dropdown-nav">
<ng-container *ngIf="isCurator">
<ng-container *ngIf="isEditable">
<li>
<a (click)="editTopicOpen(i); hide(element)">
<div class="uk-flex uk-flex-middle">
@ -66,7 +64,7 @@
</li>
</ng-container>
<ng-container *ngIf="showVisibility">
<li *ngIf="isCurator" class="uk-nav-divider"></li>
<li *ngIf="isEditable" class="uk-nav-divider"></li>
<ng-template ngFor [ngForOf]="stakeholderUtils.visibilities" let-v>
<li [class.uk-active]="topic.visibility === v.value">
<a (click)="openVisibilityModal(i, v.value, 'topic'); hide(element)">
@ -80,7 +78,7 @@
</li>
</ng-template>
</ng-container>
<ng-container *ngIf="!topic.defaultId && isCurator">
<ng-container *ngIf="!topic.defaultId && isEditable">
<li class="uk-nav-divider">
<li>
<a (click)="deleteTopicOpen(i, 'delete'); hide(element)">
@ -109,17 +107,15 @@
<span class="uk-width-expand uk-text-truncate">{{category.name}}</span>
<span class="uk-margin-xsmall-left hide-on-close" [class.uk-invisible-hover]="categoryIndex !== j"
(click)="$event.stopPropagation();$event.preventDefault()">
<icon *ngIf="!isEditable && showVisibility" [flex]="true" [name]="stakeholderUtils.visibilityIcon.get(category.visibility)"
ratio="0.6"></icon>
<a *ngIf="isEditable && (isCurator || showVisibility)" class="uk-link-reset uk-flex uk-flex-middle">
<a *ngIf="isEditable || showVisibility" class="uk-link-reset uk-flex uk-flex-middle">
<icon *ngIf="showVisibility" [flex]="true" [name]="stakeholderUtils.visibilityIcon.get(category.visibility)"
ratio="0.6"></icon>
<icon [flex]="true" name="more_vert"></icon>
</a>
<div #element *ngIf="isEditable && (isCurator || showVisibility)"
<div #element *ngIf="isEditable || showVisibility"
uk-dropdown="mode: click; pos: bottom-left; offset: 5; delay-hide: 0; flip: false; container: body">
<ul class="uk-nav uk-dropdown-nav">
<ng-container *ngIf="isCurator">
<ng-container *ngIf="isEditable">
<li>
<a (click)="editCategoryOpen(j); hide(element)">
<div class="uk-flex uk-flex-middle">
@ -149,7 +145,7 @@
</ng-container>
<ng-container *ngIf="showVisibility">
<li *ngIf="isCurator" class="uk-nav-divider"></li>
<li *ngIf="isEditable" class="uk-nav-divider"></li>
<ng-template ngFor [ngForOf]="stakeholderUtils.visibilities" let-v>
<li [class.uk-active]="category.visibility === v.value">
<a (click)="openVisibilityModal(j, v.value, 'category'); hide(element)">
@ -163,7 +159,7 @@
</li>
</ng-template>
</ng-container>
<ng-container *ngIf="!category.defaultId && isCurator">
<ng-container *ngIf="!category.defaultId && isEditable">
<li class="uk-nav-divider">
<li>
<a (click)="deleteCategoryOpen(j, 'delete'); hide(element)">
@ -180,7 +176,7 @@
</div>
</a>
</li>
<li *ngIf="isCurator && isEditable">
<li *ngIf="isEditable">
<a (click)="editCategoryOpen(); $event.preventDefault()" class="uk-flex uk-flex-middle">
<icon name="add" [flex]="true"></icon>
<span class="hide-on-close">Create new category</span>
@ -188,7 +184,7 @@
</li>
</ul>
</li>
<li *ngIf="isCurator && isEditable" class="hide-on-close">
<li *ngIf="isEditable" class="hide-on-close">
<a (click)="editTopicOpen(-1); $event.preventDefault()">
<div class="uk-flex uk-flex-middle">
<div class="uk-width-auto">
@ -235,17 +231,15 @@
<span class="uk-flex uk-flex-column uk-flex-center uk-margin-small-left"
[class.uk-invisible-hover]="subCategoryIndex !== i"
(click)="$event.stopPropagation();$event.preventDefault()">
<icon *ngIf="!isEditable && showVisibility" [flex]="true" [name]="stakeholderUtils.visibilityIcon.get(subCategory.visibility)"
ratio="0.6"></icon>
<a *ngIf="isEditable && (isCurator || showVisibility)" class="uk-link-reset uk-flex uk-flex-middle">
<a *ngIf="isEditable || showVisibility" class="uk-link-reset uk-flex uk-flex-middle">
<icon *ngIf="showVisibility" [flex]="true" [name]="stakeholderUtils.visibilityIcon.get(subCategory.visibility)"
ratio="0.6"></icon>
<icon [flex]="true" name="more_vert"></icon>
</a>
<div #element *ngIf="isEditable && (isCurator || showVisibility)"
<div #element *ngIf="isEditable || showVisibility"
uk-dropdown="mode: click; pos: bottom-left; offset: 5; delay-hide: 0; container: body">
<ul class="uk-nav uk-dropdown-nav">
<ng-container *ngIf="isCurator">
<ng-container *ngIf="isEditable">
<li>
<a (click)="editSubCategoryOpen(i); hide(element)">
<div class="uk-flex uk-flex-middle">
@ -291,7 +285,7 @@
</li>
</ng-container>
<ng-container *ngIf="showVisibility">
<li *ngIf="isCurator" class="uk-nav-divider"></li>
<li *ngIf="isEditable" class="uk-nav-divider"></li>
<ng-template ngFor [ngForOf]="stakeholderUtils.visibilities" let-v>
<li [class.uk-active]="subCategory.visibility === v.value">
<a (click)="openVisibilityModal(i, v.value, 'subcategory'); hide(element)">
@ -305,7 +299,7 @@
</li>
</ng-template>
</ng-container>
<ng-container *ngIf="!subCategory.defaultId && isCurator">
<ng-container *ngIf="!subCategory.defaultId && isEditable">
<li class="uk-nav-divider">
<li>
<a (click)="deleteSubcategoryOpen(i, 'delete'); hide(element)">
@ -321,7 +315,7 @@
</span>
</li>
</ng-container>
<li *ngIf="isCurator && isEditable">
<li *ngIf="isEditable">
<a (click)="editSubCategoryOpen(); $event.preventDefault()" class="uk-flex uk-flex-middle">
<icon name="add" [flex]="true"></icon>
<span class="uk-text-uppercase">Create new subcategory</span>

View File

@ -785,6 +785,6 @@ export class TopicComponent extends StakeholderBaseComponent implements OnInit,
}
get isEditable(): boolean {
return this.stakeholder.copy || this.stakeholder.defaultId == null || this.stakeholder.defaultId == '-1';
return this.isCurator && (this.stakeholder.copy || this.stakeholder.defaultId == null || this.stakeholder.defaultId == '-1');
}
}