Compare commits

..

No commits in common. "18118d021ed9f019d0801eb090e15c090662d5ee" and "bf4b219234621ac7e9a027203adeb01816024114" have entirely different histories.

22 changed files with 63 additions and 94 deletions

View File

@ -5,6 +5,7 @@ import {AppUserService} from '../services/app-user-service/app-user.service';
import {SquadService} from '../services/army-management/squad.service';
import {Fraction} from '../utils/fraction.enum';
import {SnackBarService} from '../services/user-interface/snack-bar/snack-bar.service';
import {Message} from '../i18n/de.messages';
@Component({
@ -46,7 +47,7 @@ export class AdminComponent implements OnInit {
this.appUserService.updateUser(updateObject)
.subscribe(resUser => {
this.snackBarService.showSuccess("generic.save.success");
this.snackBarService.showSuccess(Message.SUCCESS_SAVE);
});
}

View File

@ -89,6 +89,21 @@
</ul>
<ul class="nav navbar-nav pull-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
aria-expanded="false">
Language
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>
<a (click)="setLanguage('en')">English</a>
</li>
<li>
<a (click)="setLanguage('de')">Deutsch</a>
</li>
</ul>
</li>
<li *ngIf="loginService.hasPermission(4)" routerLinkActive="active">
<a routerLink='{{config.adminPanelPath}}' class="link">{{'navigation.top.admin' | translate}}</a>
</li>
@ -98,18 +113,6 @@
<li *ngIf="!loginService.isLoggedIn()" routerLinkActive="active">
<a routerLink='{{config.loginPath}}' class="link">{{'navigation.top.login' | translate}}</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
aria-expanded="false" style="padding: 12px 12px 10px 12px;">
<mat-icon svgIcon="{{(language === 'de') ? 'flag-de' : 'flag-gb'}}"></mat-icon>
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li *ngFor="let lang of languages" style="cursor: pointer">
<a (click)="setLanguage(lang)"><mat-icon svgIcon="{{(lang === 'de') ? 'flag-de' : 'flag-gb'}}"></mat-icon></a>
</li>
</ul>
</li>
</ul>
</div>
</div>

View File

@ -6,7 +6,7 @@ import {AwardingService} from './services/army-management/awarding.service';
import {RouteConfig} from './app.config';
import {DOCUMENT} from '@angular/common';
import {DomSanitizer} from '@angular/platform-browser';
import {MatIconRegistry, MatSelectChange} from '@angular/material';
import {MatIconRegistry} from '@angular/material';
import {SpinnerService} from './services/user-interface/spinner/spinner.service';
import {TranslateService} from '@ngx-translate/core';
import {SettingsService} from './services/settings.service';
@ -55,15 +55,8 @@ export class AppComponent implements OnInit {
'vehicleAir': 'stats/scoreboard/vehicleAir',
'vehicleHeavy': 'stats/scoreboard/vehicleHeavy',
'vehicleLight': 'stats/scoreboard/vehicleLight',
// --------LOCALE---------
'flag-de': 'locale/de',
'flag-gb': 'locale/gb',
};
language;
languages = ['de', 'en'];
version = 'v'.concat(require('./../../../package.json').version);
constructor(public loginService: LoginService,
@ -97,10 +90,7 @@ export class AppComponent implements OnInit {
}
ngOnInit() {
this.settingsService.getLanguage().subscribe((language) => {
this.language = language;
this.translate.setDefaultLang(language)
});
this.settingsService.getLanguage().subscribe((language) => this.translate.setDefaultLang(language));
if (this.loginService.hasPermission(2)) {
const fraction = this.loginService.getCurrentUser().squad.fraction;
this.promotionService.checkUnconfirmedPromotions(fraction);
@ -114,7 +104,8 @@ export class AppComponent implements OnInit {
initMaterialSvgIcons() {
Object.keys(this.svgIcons).forEach(key => {
const fileUri = '../assets/icon/'.concat(this.svgIcons[key]).concat('.svg');
const fileUri = '../assets/icon/'.concat(this.svgIcons[key])
.concat('.svg');
this.iconRegistry.addSvgIcon(key, this.sanitizer.bypassSecurityTrustResourceUrl(fileUri));
});
}
@ -139,7 +130,6 @@ export class AppComponent implements OnInit {
setLanguage(language: string) {
if (language) {
this.language = language;
this.settingsService.setLanguage(language);
}
}

View File

@ -24,7 +24,7 @@ import {CookieService} from 'ngx-cookie-service';
import {SnackBarService} from './services/user-interface/snack-bar/snack-bar.service';
import {HttpClientModule} from '@angular/common/http';
import {SpinnerService} from './services/user-interface/spinner/spinner.service';
import {MatSelectModule, MatSnackBarModule} from '@angular/material';
import {MatSnackBarModule} from '@angular/material';
import {HttpClient} from './services/http-client';
import {SettingsService} from './services/settings.service';
@ -38,7 +38,6 @@ import {SettingsService} from './services/settings.service';
HttpClientModule,
ClipboardModule,
MatSnackBarModule,
MatSelectModule,
],
providers: [

View File

@ -0,0 +1,5 @@
export enum Message {
SIGN_UP_SUCCESS = 'Account erfolgreich erstellt',
SUCCESS_SAVE = 'Erfolgreich gespeichert',
DUPLICATED_NAME_ERR = 'Benutzername existiert bereits',
}

View File

@ -2,6 +2,7 @@ import {Component, OnInit} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {LoginService} from '../services/app-user-service/login-service';
import {RouteConfig} from '../app.config';
import {Message} from '../i18n/de.messages';
import {SnackBarService} from '../services/user-interface/snack-bar/snack-bar.service';
@ -37,11 +38,11 @@ export class SignupComponent implements OnInit {
.subscribe(
data => {
this.loading = false;
this.snackBarService.showSuccess('generic.signup.success');
this.snackBarService.showSuccess(Message.SIGN_UP_SUCCESS);
},
error => {
this.loading = false;
this.snackBarService.showError('generic.signup.error', 6000);
this.snackBarService.showError(error, 10000);
});
}
}

View File

@ -6,6 +6,7 @@ import {DecorationService} from '../../../services/army-management/decoration.se
import {Subscription} from 'rxjs/Subscription';
import {Fraction} from '../../../utils/fraction.enum';
import {SnackBarService} from '../../../services/user-interface/snack-bar/snack-bar.service';
import {Message} from '../../../i18n/de.messages';
import {TranslateService} from '@ngx-translate/core';
@Component({
@ -88,7 +89,7 @@ export class EditDecorationComponent implements OnInit, OnDestroy {
this.imagePreviewSrc = 'resource/decoration/' + this.decoration._id + '.png?' + Date.now();
}, 300);
fileInput.value = '';
this.snackBarService.showSuccess('generic.save.success');
this.snackBarService.showSuccess(Message.SUCCESS_SAVE);
});
}
}

View File

@ -5,6 +5,7 @@ import {Rank} from '../../../models/model-interfaces';
import {RankService} from '../../../services/army-management/rank.service';
import {Subscription} from 'rxjs/Subscription';
import {Fraction} from '../../../utils/fraction.enum';
import {Message} from '../../../i18n/de.messages';
import {SnackBarService} from '../../../services/user-interface/snack-bar/snack-bar.service';
import {TranslateService} from '@ngx-translate/core';
@ -92,7 +93,7 @@ export class EditRankComponent implements OnInit, OnDestroy {
this.imagePreviewSrc = 'resource/rank/' + this.rank._id + '.png?' + Date.now();
}, 300);
fileInput.value = '';
this.snackBarService.showSuccess('generic.save.success');
this.snackBarService.showSuccess(Message.SUCCESS_SAVE);
});
}
}

View File

@ -6,6 +6,7 @@ import {SquadService} from '../../../services/army-management/squad.service';
import {Subscription} from 'rxjs/Subscription';
import {Fraction} from '../../../utils/fraction.enum';
import {SnackBarService} from '../../../services/user-interface/snack-bar/snack-bar.service';
import {Message} from '../../../i18n/de.messages';
import {TranslateService} from '@ngx-translate/core';
@ -92,7 +93,7 @@ export class EditSquadComponent implements OnInit, OnDestroy {
this.imagePreviewSrc = 'resource/squad/' + this.squad._id + '.png?' + Date.now();
}, 300);
fileInput.value = '';
this.snackBarService.showSuccess('generic.save.success');
this.snackBarService.showSuccess(Message.SUCCESS_SAVE);
});
}
}

View File

@ -6,6 +6,7 @@ import {AwardingService} from '../../../services/army-management/awarding.servic
import {DecorationService} from '../../../services/army-management/decoration.service';
import {Fraction} from '../../../utils/fraction.enum';
import {SnackBarService} from '../../../services/user-interface/snack-bar/snack-bar.service';
import {Message} from '../../../i18n/de.messages';
import {TranslateService} from '@ngx-translate/core';
@ -94,7 +95,7 @@ export class AwardUserComponent implements OnInit {
this.decoPreviewDisplay = 'none';
decorationField.value = undefined;
reasonField.value = previewImage.src = descriptionField.innerHTML = '';
this.snackBarService.showSuccess('generic.save.success');
this.snackBarService.showSuccess(Message.SUCCESS_SAVE);
});
});
}
@ -112,7 +113,7 @@ export class AwardUserComponent implements OnInit {
});
});
});
this.snackBarService.showSuccess('generic.save.success');
this.snackBarService.showSuccess(Message.SUCCESS_SAVE);
}
}

View File

@ -8,6 +8,7 @@ import {Subscription} from 'rxjs/Subscription';
import {NgForm} from '@angular/forms';
import {Fraction} from '../../../utils/fraction.enum';
import {SnackBarService} from '../../../services/user-interface/snack-bar/snack-bar.service';
import {Message} from '../../../i18n/de.messages';
@Component({
@ -99,18 +100,18 @@ export class EditUserComponent implements OnInit {
user.squad = '0';
}
this.user = user;
this.snackBarService.showSuccess('generic.save.success');
this.snackBarService.showSuccess(Message.SUCCESS_SAVE);
});
} else {
this.userService.submitUser(updateObject)
.subscribe(user => {
this.router.navigate(['..'], {relativeTo: this.route});
this.snackBarService.showSuccess('generic.save.success');
this.snackBarService.showSuccess(Message.SUCCESS_SAVE);
return true;
},
error => {
// duplicated user error message
const errorMessage = error._body.includes('duplicate') ? 'generic.signup.error.duplicate' : error._body;
const errorMessage = error._body.includes('duplicate') ? Message.DUPLICATED_NAME_ERR : error._body;
this.snackBarService.showError(errorMessage, 10000);
})
}

View File

@ -7,6 +7,7 @@ import {DecorationService} from '../../services/army-management/decoration.servi
import {UserService} from '../../services/army-management/user.service';
import {LoginService} from '../../services/app-user-service/login-service';
import {SnackBarService} from '../../services/user-interface/snack-bar/snack-bar.service';
import {Message} from '../../i18n/de.messages';
@Component({
@ -93,7 +94,7 @@ export class RequestAwardComponent implements OnInit {
this.decoration = {_id: '0'};
this.reason = previewImage.src = descriptionField.innerHTML = '';
this.decoPreviewDisplay = 'none';
this.snackBarService.showSuccess('generic.save.success');
this.snackBarService.showSuccess(Message.SUCCESS_SAVE);
});
});
}

View File

@ -3,6 +3,7 @@ import {Award} from '../../models/model-interfaces';
import {AwardingService} from '../../services/army-management/awarding.service';
import {LoginService} from '../../services/app-user-service/login-service';
import {SnackBarService} from '../../services/user-interface/snack-bar/snack-bar.service';
import {Message} from '../../i18n/de.messages';
@Component({
@ -46,7 +47,7 @@ export class ConfirmAwardComponent implements OnInit {
if (awards.length < 1) {
this.awardingService.hasUnprocessedAwards = false;
}
this.snackBarService.showSuccess('generic.save.success');
this.snackBarService.showSuccess(Message.SUCCESS_SAVE);
});
});
}

View File

@ -4,6 +4,7 @@ import {RankService} from '../../services/army-management/rank.service';
import {PromotionService} from '../../services/army-management/promotion.service';
import {LoginService} from '../../services/app-user-service/login-service';
import {SnackBarService} from '../../services/user-interface/snack-bar/snack-bar.service';
import {Message} from '../../i18n/de.messages';
@Component({
@ -50,7 +51,7 @@ export class ConfirmPromotionComponent implements OnInit {
if (promotions.length < 1) {
this.promotionService.hasUnprocessedPromotion = false;
}
this.snackBarService.showSuccess('generic.save.success');
this.snackBarService.showSuccess(Message.SUCCESS_SAVE);
});
});
}

View File

@ -6,6 +6,7 @@ import {UserService} from '../../services/army-management/user.service';
import {RankService} from '../../services/army-management/rank.service';
import {PromotionService} from '../../services/army-management/promotion.service';
import {LoginService} from '../../services/app-user-service/login-service';
import {Message} from '../../i18n/de.messages';
import {SnackBarService} from '../../services/user-interface/snack-bar/snack-bar.service';
@ -79,7 +80,7 @@ export class RequestPromotionComponent implements OnInit {
this.uncheckedPromotions = promotions;
this.showForm = false;
this.user = {_id: '0'};
this.snackBarService.showSuccess('generic.save.success');
this.snackBarService.showSuccess(Message.SUCCESS_SAVE);
});
});
}

View File

@ -1,11 +1,9 @@
import {Injectable} from '@angular/core';
import {MatSnackBar, MatSnackBarRef} from '@angular/material/snack-bar';
import {TranslateService} from '@ngx-translate/core';
@Injectable()
export class SnackBarService {
constructor(private snackbar: MatSnackBar,
private translate: TranslateService) {
constructor(private snackbar: MatSnackBar) {
}
private show(message: string, action?: string, duration?: number, panelClasses?: string[]): MatSnackBarRef<any> {
@ -29,17 +27,11 @@ export class SnackBarService {
return this.snackbar.open(message, action, config);
}
showSuccess(i18n: string) {
this.translate.get(i18n).subscribe((translated) => {
return this.show(translated, undefined, 2500, ['custom-snack-bar', 'label-success']);
});
showSuccess(message: string) {
return this.show(message, undefined, 2500, ['custom-snack-bar', 'label-success']);
}
showError(i18n: string, duration?: number) {
this.translate.get(i18n).subscribe((translated) => {
this.translate.get('generic.snackbar.error.button.okay').subscribe((translatedOkay) => {
return this.show(translated, translatedOkay, duration, ['custom-snack-bar', 'label-danger']);
});
});
showError(message: string, duration?: number) {
return this.show(message, 'OK', duration, ['custom-snack-bar', 'label-danger']);
}
}

View File

@ -4,6 +4,7 @@ import {NgForm} from '@angular/forms';
import {Subscription} from 'rxjs/Subscription';
import {Campaign} from '../../../models/model-interfaces';
import {CampaignService} from '../../../services/logs/campaign.service';
import {Message} from '../../../i18n/de.messages';
import {SnackBarService} from '../../../services/user-interface/snack-bar/snack-bar.service';
@ -40,7 +41,7 @@ export class CampaignSubmitComponent {
if (this.campaign._id) {
redirectSuccessUrl = '../' + redirectSuccessUrl;
}
this.snackBarService.showSuccess('generic.save.success');
this.snackBarService.showSuccess(Message.SUCCESS_SAVE);
this.router.navigate([redirectSuccessUrl + campaign._id], {relativeTo: this.route});
},
error => this.snackBarService.showError(error._body.error.message, 15000));

View File

@ -49,11 +49,5 @@
"public.army.member.headline": "Auszeichnungen von {{name}}",
"public.army.member.awards.title": "Bezeichnung",
"public.army.member.awards.reason": "Begründung",
"public.army.member.awards.date": "Verliehen am",
"generic.save.success": "Erfolgreich gespeichert",
"generic.snackbar.error.button.okay": "OK",
"generic.signup.success": "Account erfolgreich erstellt",
"generic.signup.error.duplicate": "Benutzername existiert bereits",
"generic.signup.error": "Es ist ein Fehler aufgetreten"
"public.army.member.awards.date": "Verliehen am"
}

View File

@ -7,10 +7,10 @@
"public.error.message.default": "{{fieldName}} is not valid",
"public.common.search.button": "Search",
"navigation.top.board": "To Message Board",
"navigation.top.board": "To message board",
"navigation.top.overview": "Army Overview",
"navigation.top.ranks": "Ranks",
"navigation.top.decorations": "Decorations",
"navigation.top.decorations": "Awards",
"navigation.top.statistics": "Statistics",
"navigation.top.login": "Login",
"navigation.top.logout": "Logout",
@ -48,11 +48,5 @@
"public.army.member.headline": "Awards of {{name}}",
"public.army.member.awards.title": "Title",
"public.army.member.awards.reason": "Reason",
"public.army.member.awards.date": "Decorated at",
"generic.save.success": "Saved successfully",
"generic.snackbar.error.button.okay": "OK",
"generic.signup.success": "Account creation successful",
"generic.signup.error.duplicate": "Username does already exist",
"generic.signup.error": "An error occurred"
"public.army.member.awards.date": "Decorated at"
}

View File

@ -17,7 +17,7 @@
"stats.sidebar.overview": "Overview",
"stats.sidebar.highscore": "Highscore",
"stats.sidebar.battles": "Battles",
"stats.sidebar.battles.battle.from.date": "of",
"stats.sidebar.battles.battle.from.date": "at",
"stats.sidebar.battle.manage.edit": "Edit",
"stats.sidebar.battle.manage.delete": "Delete",
"stats.sidebar.battle.manage.delete.confirm": "Do you really want to delete the battle \"{{title}}\"?",

View File

@ -1,5 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" id="flag-icon-css-de" viewBox="0 0 640 480">
<path fill="#ffce00" d="M0 320h640v160H0z"/>
<path fill="#000" d="M0 0h640v160H0z"/>
<path fill="#d00" d="M0 160h640v160H0z"/>
</svg>

Before

Width:  |  Height:  |  Size: 225 B

View File

@ -1,15 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" id="flag-icon-css-gb" viewBox="0 0 640 480">
<defs>
<clipPath id="a">
<path fill-opacity=".7" d="M-85.3 0h682.6v512H-85.3z"/>
</clipPath>
</defs>
<g clip-path="url(#a)" transform="translate(80) scale(.94)">
<g stroke-width="1pt">
<path fill="#006" d="M-256 0H768v512H-256z"/>
<path fill="#fff" d="M-256 0v57.2L653.5 512H768v-57.2L-141.5 0H-256zM768 0v57.2L-141.5 512H-256v-57.2L653.5 0H768z"/>
<path fill="#fff" d="M170.7 0v512h170.6V0H170.7zM-256 170.7v170.6H768V170.7H-256z"/>
<path fill="#c00" d="M-256 204.8v102.4H768V204.8H-256zM204.8 0v512h102.4V0H204.8zM-256 512L85.3 341.3h76.4L-179.7 512H-256zm0-512L85.3 170.7H9L-256 38.2V0zm606.4 170.7L691.7 0H768L426.7 170.7h-76.3zM768 512L426.7 341.3H503l265 132.5V512z"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 831 B