staging #468

Merged
edraft merged 19 commits from staging into master 2024-01-26 16:33:31 +01:00
4 changed files with 34 additions and 27 deletions
Showing only changes of commit 07fc512633 - Show all commits

View File

@ -3,7 +3,8 @@
</h1>
<div class="content-wrapper">
<div class="content">
<p-table #dt [value]="achievements" [responsive]="true" responsiveLayout="stack" [breakpoint]="'720px'" dataKey="id" editMode="row" [rowHover]="true" [rows]="10"
<p-table #dt [value]="achievements" [responsive]="true" responsiveLayout="stack" [breakpoint]="'720px'" dataKey="id"
editMode="row" [rowHover]="true" [rows]="10"
[rowsPerPageOptions]="[10,25,50]" [paginator]="true" [loading]="loading" [totalRecords]="totalRecords"
[lazy]="true" (onLazyLoad)="nextPage($event)">
@ -17,17 +18,20 @@
{{'view.server.achievements.achievements' | translate}}
</div>
<app-multi-select-columns [table]="name" [columns]="columns" [(hiddenColumns)]="hiddenColumns"></app-multi-select-columns>
<app-multi-select-columns [table]="name" [columns]="columns"
[(hiddenColumns)]="hiddenColumns"></app-multi-select-columns>
</div>
<div class="table-caption-btn-wrapper btn-wrapper">
<button pButton label="{{'common.add' | translate}}" class="icon-btn btn"
icon="pi pi-plus" (click)="addAchievement(dt)" [disabled]="isEditingNew || !user?.isModerator && !user?.isAdmin">
icon="pi pi-plus" (click)="addAchievement(dt)"
[disabled]="isEditingNew || !user?.isModerator && !user?.isAdmin">
</button>
<button pButton label="{{'common.reset_filters' | translate}}" icon="pi pi-undo"
class="icon-btn btn" (click)="resetFilters()">
</button>
<app-data-import-and-export name="achievements" [(data)]="achievements"
<app-data-import-and-export *ngIf="user?.isModerator || user?.isAdmin" name="achievements"
[(data)]="achievements"
[callback]="callback" [validator]="validator"></app-data-import-and-export>
</div>
</div>
@ -179,7 +183,8 @@
<span class="p-column-title">{{'common.operator' | translate}}:</span>
<p-cellEditor>
<ng-template pTemplate="input">
<p-dropdown [options]="operators" [(ngModel)]="achievement.operator" placeholder="{{'common.operator' | translate}}"></p-dropdown>
<p-dropdown [options]="operators" [(ngModel)]="achievement.operator"
placeholder="{{'common.operator' | translate}}"></p-dropdown>
</ng-template>
<ng-template pTemplate="output">
{{achievement.operator}}
@ -200,7 +205,8 @@
<p-cellEditor *ngIf="getAchievementAttributeByName(achievement.attribute)?.type === 'Level'">
<ng-template pTemplate="input">
<p-dropdown [options]="levels" [(ngModel)]="achievement.value" placeholder="{{'view.server.members.headers.level' | translate}}"></p-dropdown>
<p-dropdown [options]="levels" [(ngModel)]="achievement.value"
placeholder="{{'view.server.members.headers.level' | translate}}"></p-dropdown>
</ng-template>
<ng-template pTemplate="output">
{{achievement.value}}
@ -209,7 +215,8 @@
<p-cellEditor *ngIf="getAchievementAttributeByName(achievement.attribute)?.type === 'GameServer'">
<ng-template pTemplate="input">
<p-dropdown [options]="gameServers" [(ngModel)]="achievement.value" placeholder="{{'view.server.profile.joined_game_server.name' | translate}}"></p-dropdown>
<p-dropdown [options]="gameServers" [(ngModel)]="achievement.value"
placeholder="{{'view.server.profile.joined_game_server.name' | translate}}"></p-dropdown>
</ng-template>
<ng-template pTemplate="output">
{{achievement.value}}
@ -241,16 +248,21 @@
</td>
<td>
<div class="btn-wrapper">
<app-history-btn *ngIf="!isEditingNew" [id]="achievement.id" [query]="query" translationKey="view.server.achievements.header"></app-history-btn>
<app-history-btn *ngIf="!isEditingNew" [id]="achievement.id" [query]="query"
translationKey="view.server.achievements.header"></app-history-btn>
<button *ngIf="!editing" pButton pInitEditableRow class="btn icon-btn" icon="pi pi-pencil"
(click)="onRowEditInit(dt, achievement, ri)" [disabled]="!user || !user.isModerator && !user.isAdmin"></button>
(click)="onRowEditInit(dt, achievement, ri)"
[disabled]="!user || !user.isModerator && !user.isAdmin"></button>
<button *ngIf="!editing" pButton class="btn icon-btn danger-icon-btn" icon="pi pi-trash"
(click)="deleteAchievement(achievement)" [disabled]="!user || !user.isModerator && !user.isAdmin"></button>
(click)="deleteAchievement(achievement)"
[disabled]="!user || !user.isModerator && !user.isAdmin"></button>
<button *ngIf="editing" pButton pSaveEditableRow class="btn icon-btn"
icon="pi pi-check-circle" (click)="onRowEditSave(achievement, ri)" [disabled]="!user || !user.isModerator && !user.isAdmin"></button>
icon="pi pi-check-circle" (click)="onRowEditSave(achievement, ri)"
[disabled]="!user || !user.isModerator && !user.isAdmin"></button>
<button *ngIf="editing" pButton pCancelEditableRow class="btn icon-btn danger-icon-btn"
icon="pi pi-times-circle" (click)="onRowEditCancel(ri)" [disabled]="!user || !user.isModerator && !user.isAdmin"></button>
icon="pi pi-times-circle" (click)="onRowEditCancel(ri)"
[disabled]="!user || !user.isModerator && !user.isAdmin"></button>
</div>
</td>
</tr>

View File

@ -25,12 +25,12 @@
<div class="table-caption-btn-wrapper btn-wrapper">
<button pButton label="{{'common.add' | translate}}" class="icon-btn btn"
icon="pi pi-plus" (click)="addLevel(dt)"
[disabled]="isEditingNew || user?.isModerator && !user?.isAdmin">
[disabled]="isEditingNew || !user?.isModerator && !user?.isAdmin">
</button>
<button pButton label="{{'common.reset_filters' | translate}}" icon="pi pi-undo"
class="icon-btn btn" (click)="resetFilters()">
</button>
<app-data-import-and-export name="levels" [(data)]="levels"
<app-data-import-and-export *ngIf="user?.isModerator || user?.isAdmin" name="levels" [(data)]="levels"
[callback]="callback" [validator]="validator"></app-data-import-and-export>
</div>
</div>
@ -219,17 +219,17 @@
translationKey="view.server.levels.header"></app-history-btn>
<button *ngIf="!editing" pButton pInitEditableRow class="btn icon-btn" icon="pi pi-pencil"
(click)="onRowEditInit(dt, level, ri)"
[disabled]="!user || user.isModerator && !user.isAdmin"></button>
[disabled]="!user || !user.isModerator && !user.isAdmin"></button>
<button *ngIf="!editing" pButton class="btn icon-btn danger-icon-btn" icon="pi pi-trash"
(click)="deleteLevel(level)"
[disabled]="!user || user.isModerator && !user.isAdmin"></button>
[disabled]="!user || !user.isModerator && !user.isAdmin"></button>
<button *ngIf="editing" pButton pSaveEditableRow class="btn icon-btn"
icon="pi pi-check-circle" (click)="onRowEditSave(level, ri)"
[disabled]="!user || user.isModerator && !user.isAdmin"></button>
[disabled]="!user || !user.isModerator && !user.isAdmin"></button>
<button *ngIf="editing" pButton pCancelEditableRow class="btn icon-btn danger-icon-btn"
icon="pi pi-times-circle" (click)="onRowEditCancel(ri)"
[disabled]="!user || user.isModerator && !user.isAdmin"></button>
[disabled]="!user || !user.isModerator && !user.isAdmin"></button>
</div>
</td>
</tr>

View File

@ -28,16 +28,11 @@ const routes: Routes = [
data: { memberRole: MemberRoles.Moderator }
},
{
path: "levels",
loadChildren: () => import("./levels/levels.module").then(m => m.LevelsModule),
canActivate: [AuthGuard],
data: { memberRole: MemberRoles.Moderator }
path: "levels", loadChildren: () => import("./levels/levels.module").then(m => m.LevelsModule)
},
{
path: "achievements",
loadChildren: () => import("./achievements/achievements.module").then(m => m.AchievementsModule),
canActivate: [AuthGuard],
data: { memberRole: MemberRoles.Moderator }
loadChildren: () => import("./achievements/achievements.module").then(m => m.AchievementsModule)
},
{
path: "short-role-names",

View File

@ -203,8 +203,8 @@ export class SidebarService {
this.serverMembers.visible = isTechnicianAndFullAccessActive || user?.isModerator;
this.serverUserWarnings.visible = isTechnicianAndFullAccessActive || user?.isModerator;
this.serverAutoRoles.visible = isTechnicianAndFullAccessActive || this.hasFeature("AutoRoleModule") && user?.isModerator;
this.serverLevels.visible = isTechnicianAndFullAccessActive || this.hasFeature("LevelModule") && user?.isModerator;
this.serverAchievements.visible = isTechnicianAndFullAccessActive || this.hasFeature("AchievementsModule") && user?.isModerator;
this.serverLevels.visible = true;
this.serverAchievements.visible = true;
this.serverScheduledEvents.visible = isTechnicianAndFullAccessActive || this.hasFeature("ScheduledEvents") && user?.isModerator;
this.serverShortRoleNames.visible = isTechnicianAndFullAccessActive || this.hasFeature("ShortRoleName") && user?.isAdmin;