Fix army member click area & sort campaign all overview sorting

pull/12/head
Florian Hartwich 2017-10-07 13:05:10 +02:00
parent 51a203861b
commit 436f6585c2
4 changed files with 36 additions and 25 deletions

View File

@ -55,7 +55,6 @@ img {
.member-link {
cursor: pointer;
display: block;
text-decoration: underline;
}

View File

@ -11,10 +11,13 @@
</div>
<div class="row middle-row">
<div class="squad-cell name-cell">
<span class="member-link text-blufor"
*ngFor="let member of squad.members"
(click)="select(member._id)">
{{member.rank}} {{member.username}}
<span class="text-blufor"
style="display: block"
*ngFor="let member of squad.members">
<span class="member-link"
(click)="select(member._id)">
{{member.rank}} {{member.username}}
</span>
</span>
</div>
</div>
@ -37,10 +40,13 @@
</div>
<div class="row middle-row">
<div class="squad-cell name-cell">
<span class="member-link text-opfor"
*ngFor="let member of squad.members"
(click)="select(member._id)">
{{member.rank}} {{member.username}}
<span class="text-opfor"
style="display: block"
*ngFor="let member of squad.members">
<span class="member-link"
(click)="select(member._id)">
{{member.rank}} {{member.username}}
</span>
</span>
</div>
</div>

View File

@ -1,15 +1,15 @@
<div class="slide-chart-container" style="height: 150px;">
<h2 style="margin-bottom: 20px">{{title}}</h2>
<div class="btn btn-default" [style.background]="isActiveSlide(0)"
(click)="goToSlide(0)" *ngIf="id != 'all'">Gesamtpunktzahl
</div>
<div class="btn btn-default" [style.background]="isActiveSlide(1)"
(click)="goToSlide(1)">Punkte je Schlacht
</div>
<div class="btn btn-default" [style.background]="isActiveSlide(2)"
(click)="goToSlide(2)">Spielerzahlen
</div>
<div class="btn btn-default" [style.background]="isActiveSlide(0)"
(click)="goToSlide(0)" *ngIf="id != 'all'">Gesamtpunktzahl
</div>
<div class="btn btn-default" [style.background]="isActiveSlide(1)"
(click)="goToSlide(1)">Punkte je Schlacht
</div>
<div class="btn btn-default" [style.background]="isActiveSlide(2)"
(click)="goToSlide(2)">Spielerzahlen
</div>
</div>
<div class="fade-in">
<div class="slide-chart-container">
@ -25,7 +25,8 @@
[showYAxisLabel]="showYAxisLabel"
[yAxisLabel]="yAxisLabel"
[autoScale]="autoscale"
[timeline]="timeline">
[timeline]="timeline"
[roundDomains]="roundDomains">
</ngx-charts-line-chart>
</div>
</div>

View File

@ -38,7 +38,6 @@ export class StatisticOverviewComponent {
autoscale = true;
timeline = false;
constructor(private route: ActivatedRoute,
private campaignService: CampaignService) {
}
@ -63,14 +62,20 @@ export class StatisticOverviewComponent {
let itemsProcessed = 0;
campaigns = campaigns.filter(campaign => this.id === 'all' || campaign._id === this.id);
campaigns.forEach(campaign => {
if (this.id === 'all') {
this.title = "Gesamtübersicht";
} else {
this.title = campaign.title;
}
wars = wars.concat(campaign.wars);
itemsProcessed++;
if (itemsProcessed === campaigns.length) {
if (this.id === 'all') {
this.title = "Gesamtübersicht";
wars.sort((a, b) => {
// sort by dates, because older campaign can contain newer war
if (a['date'] > (b['date'])) return -1;
if (a['date'] < (b['date'])) return 1;
return 0;
})
} else {
this.title = campaign.title;
}
this.initChart(wars);
}
})