Refactor fraction names in army management
parent
845593b2ec
commit
af3c4f8b46
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "opt-cc",
|
||||
"version": "1.9.4",
|
||||
"version": "1.9.5",
|
||||
"author": "Florian Hartwich <hardi@noarch.de>",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
|
|
@ -8,6 +8,16 @@ const CampaignSchema = new Schema({
|
|||
type: String,
|
||||
required: true,
|
||||
},
|
||||
fractionMappingBlufor: {
|
||||
type: String,
|
||||
enum: ['BLUFOR', 'OPFOR', 'ARF', 'SWORD'],
|
||||
default: 'BLUFOR',
|
||||
},
|
||||
fractionMappingOpfor: {
|
||||
type: String,
|
||||
enum: ['BLUFOR', 'OPFOR', 'ARF', 'SWORD'],
|
||||
default: 'OPFOR',
|
||||
},
|
||||
}, {
|
||||
collection: 'campaign',
|
||||
timestamps: {createdAt: 'timestamp'},
|
||||
|
|
|
@ -10,7 +10,7 @@ const DecorationSchema = new Schema({
|
|||
},
|
||||
fraction: {
|
||||
type: String,
|
||||
enum: ['BLUFOR', 'OPFOR', 'GLOBAL'],
|
||||
enum: ['BLUFOR', 'OPFOR', 'ARF', 'SWORD', 'GLOBAL'],
|
||||
required: true,
|
||||
},
|
||||
description: {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</div>
|
||||
|
||||
<h3 class="text-center" style="font-weight: 600"
|
||||
[style.color]="user.squadId?.fraction === 'BLUFOR' ? fraction.COLOR_BLUFOR : fraction.COLOR_OPFOR">
|
||||
[style.color]="user.squadId?.fraction === 'BLUFOR' ? fraction.COLOR_ARF : fraction.COLOR_SWORD">
|
||||
{{'public.army.member.headline' | translate:{name: user.username} }}
|
||||
</h3>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
</div>
|
||||
<div class=" middle-row">
|
||||
<div class="name-cell">
|
||||
<div [style.color]="squadFraction === 'BLUFOR' ? fraction.COLOR_BLUFOR : fraction.COLOR_OPFOR"
|
||||
<div [style.color]="squadFraction === 'BLUFOR' ? fraction.COLOR_ARF : fraction.COLOR_SWORD"
|
||||
*ngFor="let member of squad.members">
|
||||
<span class="member-link"
|
||||
(click)="select(member._id)">
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
<h1>{{'public.army.headline' | translate}}</h1>
|
||||
|
||||
<div class="pull-left army-column" *ngIf="!isSmallLayout || singleViewSelected === fraction.BLUFOR">
|
||||
<h3 class="army-head" [style.color]="fraction.COLOR_BLUFOR">
|
||||
{{fraction.BLUFOR}}
|
||||
<h3 class="army-head" [style.color]="fraction.COLOR_ARF">
|
||||
{{fraction.ARF}}
|
||||
<button mat-icon-button class="switch-btn-blufor"
|
||||
(click)="singleViewSwitch(fraction.OPFOR)">
|
||||
<mat-icon svgIcon="chevron-right"></mat-icon>
|
||||
|
@ -18,12 +18,12 @@
|
|||
</div>
|
||||
|
||||
<div class="pull-right army-column" *ngIf="!isSmallLayout || singleViewSelected === fraction.OPFOR">
|
||||
<h3 class="army-head" [style.color]="fraction.COLOR_OPFOR">
|
||||
<h3 class="army-head" [style.color]="fraction.COLOR_SWORD">
|
||||
<button mat-icon-button class="switch-btn-opfor"
|
||||
(click)="singleViewSwitch(fraction.BLUFOR)">
|
||||
<mat-icon svgIcon="chevron-right"></mat-icon>
|
||||
</button>
|
||||
{{fraction.OPFOR}}
|
||||
{{fraction.SWORD}}
|
||||
</h3>
|
||||
<cc-army-squad *ngFor="let squad of army[1].squads"
|
||||
[squad]="squad"
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
<a>{{decoration.name}}</a>
|
||||
</span>
|
||||
<br>
|
||||
<small *ngIf="decoration.fraction == 'ARF'">{{fraction.ARF}}</small>
|
||||
<small *ngIf="decoration.fraction == 'SWORD'">{{fraction.SWORD}}</small>
|
||||
<small *ngIf="decoration.fraction == 'OPFOR'">{{fraction.OPFOR}}</small>
|
||||
<small *ngIf="decoration.fraction == 'BLUFOR'">{{fraction.BLUFOR}}</small>
|
||||
<small *ngIf="decoration.fraction == 'GLOBAL'">{{'decorations.list.filter.global' | translate}}</small>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<div class="select-list">
|
||||
<cc-list-filter
|
||||
[filterButtons]="[{label: fraction.BLUFOR, value: 'BLUFOR'},
|
||||
[filterButtons]="[{label: fraction.ARF, value: 'ARF'},
|
||||
{label: fraction.SWORD, value: 'SWORD'},
|
||||
{label: fraction.BLUFOR, value: 'BLUFOR'},
|
||||
{label: fraction.OPFOR, value: 'OPFOR'},
|
||||
{label: 'decorations.list.filter.global', value: 'GLOBAL'}]"
|
||||
[addButton]="{svgIcon: 'add', tooltip: 'decorations.list.button.add'}"
|
||||
|
|
|
@ -17,8 +17,10 @@
|
|||
<select id="fraction" name="fraction" class="form-control btn dropdown-toggle"
|
||||
required
|
||||
[(ngModel)]="decoration.fraction">
|
||||
<option value="OPFOR">{{fraction.OPFOR}}</option>
|
||||
<option value="BLUFOR">{{fraction.BLUFOR}}</option>
|
||||
<option value="{{fraction.ARF}}">{{fraction.ARF}}</option>
|
||||
<option value="{{fraction.SWORD}}">{{fraction.SWORD}}</option>
|
||||
<option value="{{fraction.OPFOR}}">{{fraction.OPFOR}}</option>
|
||||
<option value="{{fraction.BLUFOR}}">{{fraction.BLUFOR}}</option>
|
||||
<option value="GLOBAL">{{'decorations.submit.field.fraction.global' | translate}}</option>
|
||||
</select>
|
||||
<show-error displayName="{{'decorations.submit.field.fraction' | translate}}" controlPath="fraction"></show-error>
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
<select id="fraction" name="fraction" class="form-control btn dropdown-toggle"
|
||||
required
|
||||
[(ngModel)]="rank.fraction">
|
||||
<option value="OPFOR">{{fraction.OPFOR}}</option>
|
||||
<option value="BLUFOR">{{fraction.BLUFOR}}</option>
|
||||
<option value="OPFOR">{{fraction.SWORD}}</option>
|
||||
<option value="BLUFOR">{{fraction.ARF}}</option>
|
||||
</select>
|
||||
<show-error displayName="{{'ranks.submit.field.fraction' | translate}}" controlPath="fraction"></show-error>
|
||||
</div>
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<a>{{rank.name}}</a>
|
||||
</span>
|
||||
<br>
|
||||
<small *ngIf="rank.fraction == 'OPFOR'">{{fraction.OPFOR}}</small>
|
||||
<small *ngIf="rank.fraction == 'BLUFOR'">{{fraction.BLUFOR}}</small>
|
||||
<small *ngIf="rank.fraction == 'OPFOR'">{{fraction.SWORD}}</small>
|
||||
<small *ngIf="rank.fraction == 'BLUFOR'">{{fraction.ARF}}</small>
|
||||
<small> {{'ranks.list.item.label.level' | translate:{level: rank.level} }}</small>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div class="select-list">
|
||||
<cc-list-filter
|
||||
[filterButtons]="[{label: fraction.BLUFOR, value: 'BLUFOR'},
|
||||
{label: fraction.OPFOR, value: 'OPFOR'}]"
|
||||
[filterButtons]="[{label: fraction.ARF, value: 'BLUFOR'},
|
||||
{label: fraction.SWORD, value: 'OPFOR'}]"
|
||||
[addButton]="{svgIcon: 'add', tooltip: 'ranks.list.button.add'}"
|
||||
(executeSearch)="filterRanks($event)"
|
||||
(openAddFrom)="openNewRankForm()">
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
<select id="fraction" name="fraction" class="form-control btn dropdown-toggle"
|
||||
required
|
||||
[(ngModel)]="squad.fraction">
|
||||
<option value="OPFOR">{{fraction.OPFOR}}</option>
|
||||
<option value="BLUFOR">{{fraction.BLUFOR}}</option>
|
||||
<option value="OPFOR">{{fraction.SWORD}}</option>
|
||||
<option value="BLUFOR">{{fraction.ARF}}</option>
|
||||
</select>
|
||||
<show-error displayName="{{'squad.submit.field.fraction' | translate}}" controlPath="fraction"></show-error>
|
||||
</div>
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<a>{{squad.name}}</a>
|
||||
</span>
|
||||
<br>
|
||||
<small *ngIf="squad.fraction == 'OPFOR'">{{fraction.OPFOR}}</small>
|
||||
<small *ngIf="squad.fraction == 'BLUFOR'">{{fraction.BLUFOR}}</small>
|
||||
<small *ngIf="squad.fraction == 'OPFOR'">{{fraction.ARF}}</small>
|
||||
<small *ngIf="squad.fraction == 'BLUFOR'">{{fraction.SWORD}}</small>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-4">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div class="select-list">
|
||||
<cc-list-filter
|
||||
[filterButtons]="[{label: fraction.BLUFOR, value: 'BLUFOR'},
|
||||
{label: fraction.OPFOR, value: 'OPFOR'}]"
|
||||
[filterButtons]="[{label: fraction.ARF, value: 'BLUFOR'},
|
||||
{label: fraction.SWORD, value: 'OPFOR'}]"
|
||||
[addButton]="{svgIcon: 'add', tooltip: 'squad.list.tooltip.new'}"
|
||||
(executeSearch)="filterSquads($event)"
|
||||
(openAddFrom)="openNewSquadForm()">
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
style="min-width: 200px;">
|
||||
<option [value]="0">{{'users.award.field.decoration.placeholder' | translate}}</option>
|
||||
<option *ngFor="let deco of decorations" [value]="deco._id">
|
||||
{{deco.fraction == 'BLUFOR'? fraction.BLUFOR : deco.fraction == 'OPFOR'? fraction.OPFOR : 'Global'}}:
|
||||
{{deco.fraction == 'BLUFOR' ? fraction.BLUFOR : deco.fraction == 'OPFOR' ? fraction.OPFOR : deco.fraction ==
|
||||
'ARF' ? fraction.ARF : deco.fraction == 'SWORD' ? fraction.SWORD : 'Global'}}:
|
||||
{{deco.name}}
|
||||
</option>
|
||||
</select>
|
||||
|
@ -94,7 +95,7 @@
|
|||
<td class="text-center">
|
||||
{{award.confirmed === 0 ?
|
||||
awardStatus['users.award.table.status.in.progress'] : (award.confirmed === 1 ?
|
||||
awardStatus['users.award.table.status.approved']: awardStatus['users.award.table.status.rejected'])}}
|
||||
awardStatus['users.award.table.status.approved'] : awardStatus['users.award.table.status.rejected'])}}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<label>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
(change)="toggleRanks()">
|
||||
<option [value]="0">{{'user.submit.field.squad.not.assigned' | translate}}</option>
|
||||
<option *ngFor="let squad of squads" [ngValue]="squad">
|
||||
{{squad.fraction == 'BLUFOR'? fraction.BLUFOR : fraction.OPFOR}}: {{squad.name}}
|
||||
{{squad.fraction == 'BLUFOR'? fraction.ARF : fraction.SWORD}}: {{squad.name}}
|
||||
</option>
|
||||
</select>
|
||||
<show-error displayName="{{'user.submit.field.squad' | translate}}" controlPath="squad"></show-error>
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<a>{{user.username}}</a>
|
||||
</span>
|
||||
<br>
|
||||
<small *ngIf="user.squadId && user.squadId.fraction == 'OPFOR'">{{fraction.OPFOR}} - {{user.squadId.name}}</small>
|
||||
<small *ngIf="user.squadId && user.squadId.fraction == 'BLUFOR'">{{fraction.BLUFOR}} - {{user.squadId.name}}
|
||||
<small *ngIf="user.squadId && user.squadId.fraction == 'OPFOR'">{{fraction.SWORD}} - {{user.squadId.name}}</small>
|
||||
<small *ngIf="user.squadId && user.squadId.fraction == 'BLUFOR'">{{fraction.ARF}} - {{user.squadId.name}}
|
||||
</small>
|
||||
<small *ngIf="!user.squadId">{{'users.list.item.label.no.squad' | translate}}</small>
|
||||
</div>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div class="select-list">
|
||||
<cc-list-filter
|
||||
[filterButtons]="[{label: fraction.BLUFOR, value: 'BLUFOR'},
|
||||
{label: fraction.OPFOR, value: 'OPFOR'},
|
||||
[filterButtons]="[{label: fraction.ARF, value: 'BLUFOR'},
|
||||
{label: fraction.SWORD, value: 'OPFOR'},
|
||||
{label: 'users.list.filter.no.squad', value: 'UNASSIGNED'}]"
|
||||
[addButton]="{svgIcon: 'add-user', tooltip: 'users.list.tooltip.new'}"
|
||||
(executeSearch)="filterUsers(undefined, $event)"
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
<h1>{{'public.decorations.headline' | translate}}</h1>
|
||||
|
||||
<div class="fraction-side-bar">
|
||||
<div [ngClass]="{active: active === 'ARF'}" (click)="switchFraction('ARF')">{{fraction.ARF}}</div>
|
||||
<div [ngClass]="{active: active === 'SWORD'}" (click)="switchFraction('SWORD')">{{fraction.SWORD}}</div>
|
||||
<div [ngClass]="{active: active === 'BLUFOR'}" (click)="switchFraction('BLUFOR')">{{fraction.BLUFOR}}</div>
|
||||
<div [ngClass]="{active: active === 'OPFOR'}" (click)="switchFraction('OPFOR')">{{fraction.OPFOR}}</div>
|
||||
<div [ngClass]="{active: active === 'GLOBAL'}" (click)="switchFraction('GLOBAL')">GLOBAL</div>
|
||||
|
|
|
@ -45,10 +45,11 @@ export class DecorationOverviewComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
const fract = queryParams.fraction;
|
||||
if (fract && (fract === 'BLUFOR' || fract === 'OPFOR' || fract === 'GLOBAL')) {
|
||||
if (fract && (fract === 'ARF' || fract === 'SWORD' ||
|
||||
fract === 'BLUFOR' || fract === 'OPFOR' || fract === 'GLOBAL')) {
|
||||
this.switchFraction(queryParams.fraction);
|
||||
} else {
|
||||
this.switchFraction('BLUFOR');
|
||||
this.switchFraction('ARF');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
[class]="decoration.isMedal ? 'img-medal' : 'img-ribbon'">
|
||||
</div>
|
||||
<mat-card-content>
|
||||
<div [style.background]="decoration.fraction === 'BLUFOR' ?
|
||||
fraction.COLOR_BLUFOR : decoration.fraction === 'OPFOR' ? fraction.COLOR_OPFOR : '#666666'">
|
||||
<div [style.background]="getColor(decoration.fraction)">
|
||||
{{decoration.name}}
|
||||
</div>
|
||||
<div class="decoration-description">
|
||||
|
|
|
@ -17,6 +17,21 @@ export class DecorationPanelComponent {
|
|||
|
||||
readonly fraction = Fraction;
|
||||
|
||||
private getColor(fractionKey) {
|
||||
switch (fractionKey) {
|
||||
case 'ARF':
|
||||
return this.fraction.COLOR_ARF;
|
||||
case 'SWORD':
|
||||
return this.fraction.COLOR_SWORD;
|
||||
case 'BLUFOR':
|
||||
return this.fraction.COLOR_BLUFOR;
|
||||
case 'OPFOR':
|
||||
return this.fraction.COLOR_OPFOR;
|
||||
default:
|
||||
return this.fraction.COLOR_NEUTRAL;
|
||||
}
|
||||
}
|
||||
|
||||
selectDecoration() {
|
||||
this.select.emit(this.decoration);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<h1>{{'public.ranks.headline' | translate}}</h1>
|
||||
|
||||
<div class="column-container pull-left">
|
||||
<h3 [style.color]="fraction.COLOR_BLUFOR">{{fraction.BLUFOR}}</h3>
|
||||
<h3 [style.color]="fraction.COLOR_ARF">{{fraction.ARF}}</h3>
|
||||
|
||||
<table mat-table [dataSource]="ranksBlufor" class="mat-elevation-z8">
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
|||
</div>
|
||||
|
||||
<div class="column-container pull-right">
|
||||
<h3 [style.color]="fraction.COLOR_OPFOR">{{fraction.OPFOR}}</h3>
|
||||
<h3 [style.color]="fraction.COLOR_SWORD">{{fraction.SWORD}}</h3>
|
||||
|
||||
<table mat-table [dataSource]="ranksOpfor" class="pull-right mat-elevation-z8">
|
||||
|
||||
|
|
|
@ -13,8 +13,6 @@ export class RankPanelComponent {
|
|||
|
||||
@Output() select = new EventEmitter();
|
||||
|
||||
readonly fraction = Fraction;
|
||||
|
||||
selectRank() {
|
||||
this.select.emit(this.rank);
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
<span mat-line>
|
||||
{{user.username}}
|
||||
</span>
|
||||
<span mat-line [style.color]="user.squadId.fraction === 'BLUFOR' ? fraction.COLOR_BLUFOR :fraction.COLOR_OPFOR">
|
||||
{{user.squadId.fraction === 'BLUFOR' ? fraction.BLUFOR : fraction.OPFOR}} - {{user.squadId.name}}
|
||||
<span mat-line [style.color]="user.squadId.fraction === 'BLUFOR' ? fraction.COLOR_ARF :fraction.COLOR_SWORD">
|
||||
{{user.squadId.fraction === 'BLUFOR' ? fraction.ARF : fraction.SWORD}} - {{user.squadId.name}}
|
||||
</span>
|
||||
</a>
|
||||
</mat-nav-list>
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
export enum Fraction {
|
||||
ARF = 'ARF',
|
||||
COLOR_ARF = '#668866',
|
||||
SWORD = 'SWORD',
|
||||
COLOR_SWORD = '#9499a1',
|
||||
BLUFOR = 'NATO',
|
||||
OPFOR = 'CSAT',
|
||||
COLOR_BLUFOR = '#3c5fa1',
|
||||
|
@ -8,5 +12,6 @@ export enum Fraction {
|
|||
COLOR_OPFOR = '#a90100',
|
||||
COLOR_OPFOR_DARK = '#890F0F',
|
||||
COLOR_OPFOR_LIGHT = '#fb5555',
|
||||
COLOR_OPFOR_GREY = '#955c5f'
|
||||
COLOR_OPFOR_GREY = '#955c5f',
|
||||
COLOR_NEUTRAL = "#666666",
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue