clean up code

pull/37/head
HardiReady 2018-06-17 16:03:25 +02:00
parent 162453c894
commit d1f53f78c9
4 changed files with 18 additions and 18 deletions

View File

@ -51,7 +51,6 @@ export class AwardUserComponent implements OnInit {
.subscribe(id => this.userId = id); .subscribe(id => this.userId = id);
} }
toggleDecoPreview(descriptionField, decorationId, image) { toggleDecoPreview(descriptionField, decorationId, image) {
if (decorationId !== '0') { if (decorationId !== '0') {
this.decoPreviewDisplay = 'flex'; // visible & keep same height for all children this.decoPreviewDisplay = 'flex'; // visible & keep same height for all children
@ -72,10 +71,10 @@ export class AwardUserComponent implements OnInit {
const reason = reasonField.value; const reason = reasonField.value;
if (decorationId && reason.length > 0) { if (decorationId && reason.length > 0) {
const award = { const award = {
'userId': this.userId, userId: this.userId,
'decorationId': decorationId, decorationId: decorationId,
'reason': reason, reason: reason,
'date': Date.now() date: Date.now()
}; };
this.awardingService.addAwarding(award).subscribe(() => { this.awardingService.addAwarding(award).subscribe(() => {
this.awardingService.getUserAwardings(this.userId) this.awardingService.getUserAwardings(this.userId)

View File

@ -53,10 +53,12 @@ export class EditUserComponent implements OnInit {
user.squadId = '0'; user.squadId = '0';
this.ranksDisplay = 'none'; this.ranksDisplay = 'none';
} else { } else {
this.rankService.findRanks('', user.squadId.fraction).subscribe(ranks => { this.rankService
this.ranks = ranks; .findRanks('', user.squadId.fraction)
this.ranksDisplay = 'block'; .subscribe(ranks => {
}); this.ranks = ranks;
this.ranksDisplay = 'block';
});
} }
this.user = user; this.user = user;
}); });
@ -68,12 +70,14 @@ export class EditUserComponent implements OnInit {
toggleRanks() { toggleRanks() {
if (this.user.squadId !== '0') { if (this.user.squadId !== '0') {
this.rankService.findRanks('', this.user.squadId.fraction).subscribe( this.rankService
ranks => { .findRanks('', this.user.squadId.fraction)
this.ranks = ranks; .subscribe(
this.ranksDisplay = 'block'; ranks => {
} this.ranks = ranks;
); this.ranksDisplay = 'block';
}
);
} else { } else {
this.ranksDisplay = 'none'; this.ranksDisplay = 'none';
} }

View File

@ -34,6 +34,5 @@ export class UserItemComponent {
delete() { delete() {
this.userDelete.emit(this.user); this.userDelete.emit(this.user);
} }
} }

View File

@ -41,7 +41,6 @@ export class UserListComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.users$ = this.userService.users$; this.users$ = this.userService.users$;
const paramsStream = this.route.queryParams const paramsStream = this.route.queryParams
@ -106,5 +105,4 @@ export class UserListComponent implements OnInit {
this.location.replaceState(absoluteUrl, queryPart); this.location.replaceState(absoluteUrl, queryPart);
} }
} }