From d8544edb5e15d0632c2c4a053991acc0b6b3577e Mon Sep 17 00:00:00 2001 From: HardiReady Date: Mon, 6 Aug 2018 20:50:04 +0200 Subject: [PATCH] Add new war and campaign edit/delete menus --- static/src/app/app.component.ts | 21 ++------ .../campaign-navigation.component.html | 19 +++++++ .../campaign-navigation.component.ts | 16 ++++++ static/src/app/statistic/stats.component.html | 4 +- static/src/app/statistic/stats.component.ts | 27 +++++----- static/src/app/statistic/stats.module.ts | 4 +- .../war/war-list/war-item.component.html | 34 ++++++------- .../war/war-list/war-list.component.html | 6 +-- .../src/assets/icon/baseline-delete-24px.svg | 4 ++ static/src/assets/icon/baseline-edit-24px.svg | 4 ++ .../assets/icon/baseline-more_vert-24px.svg | 4 ++ .../src/assets/icon/twotone-delete-24px.svg | 49 ------------------- static/src/assets/icon/twotone-edit-24px.svg | 20 -------- 13 files changed, 86 insertions(+), 126 deletions(-) create mode 100644 static/src/assets/icon/baseline-delete-24px.svg create mode 100644 static/src/assets/icon/baseline-edit-24px.svg create mode 100644 static/src/assets/icon/baseline-more_vert-24px.svg delete mode 100644 static/src/assets/icon/twotone-delete-24px.svg delete mode 100644 static/src/assets/icon/twotone-edit-24px.svg diff --git a/static/src/app/app.component.ts b/static/src/app/app.component.ts index 8507ea3..78be8bc 100644 --- a/static/src/app/app.component.ts +++ b/static/src/app/app.component.ts @@ -26,21 +26,18 @@ export class AppComponent implements OnInit { scrollBtnVisibleVal = 100; - leftBackground; - - leftBoxShadow; - // a map of svgIcon names and associated svg file names // to load from assets/icon folder svgIcons = { 'add': 'outline-add_box-24px', 'add-user': 'twotone-person_add-24px', - 'edit': 'twotone-edit-24px', - 'delete': 'twotone-delete-24px', + 'edit': 'baseline-edit-24px', + 'delete': 'baseline-delete-24px', 'stats-detail': 'round-assessment-24px', 'chevron-left': 'baseline-chevron_left-24px', 'chevron-right': 'baseline-chevron_right-24px', 'arrow-up': 'baseline-arrow_upward-24px', + 'more-vert': 'baseline-more_vert-24px', // --------STATISTICS--------- 'award': 'stats/award', 'battle': 'stats/battle', @@ -79,18 +76,6 @@ export class AppComponent implements OnInit { if (currentUrl.includes('/overview')) { this.scrollToTop(); } - - // remove sidebar styling for components that are rendered inside, - // but not really shown as sidebar (legacy) - if (currentUrl.includes('/login') || - currentUrl.includes('/signup') || - currentUrl.endsWith('/404')) { - this.leftBackground = 'none'; - this.leftBoxShadow = 'none'; - } else { - this.leftBackground = '#f9f9f9'; - this.leftBoxShadow = '2px 1px 5px grey'; - } } }); } diff --git a/static/src/app/statistic/campaign/campaign-navigation/campaign-navigation.component.html b/static/src/app/statistic/campaign/campaign-navigation/campaign-navigation.component.html index b2835f7..8747662 100644 --- a/static/src/app/statistic/campaign/campaign-navigation/campaign-navigation.component.html +++ b/static/src/app/statistic/campaign/campaign-navigation/campaign-navigation.component.html @@ -16,6 +16,25 @@ [ngClass]="{active : campaign._id === selectedCampaignId}" (click)="select(campaign)"> {{campaign.title}} + + + + + + + diff --git a/static/src/app/statistic/campaign/campaign-navigation/campaign-navigation.component.ts b/static/src/app/statistic/campaign/campaign-navigation/campaign-navigation.component.ts index c18ed75..8b2eed2 100644 --- a/static/src/app/statistic/campaign/campaign-navigation/campaign-navigation.component.ts +++ b/static/src/app/statistic/campaign/campaign-navigation/campaign-navigation.component.ts @@ -1,5 +1,6 @@ import {Component, ElementRef, EventEmitter, Input, OnChanges, Output, ViewChild} from '@angular/core'; import {Campaign} from '../../../models/model-interfaces'; +import {LoginService} from '../../../services/app-user-service/login-service'; @Component({ selector: 'campaign-navigation', @@ -14,6 +15,10 @@ export class CampaignNavigationComponent implements OnChanges { @Output() campaignSelect = new EventEmitter(); + @Output() campaignEdit = new EventEmitter(); + + @Output() campaignDelete = new EventEmitter(); + @ViewChild('horizontalList', {read: ElementRef}) public panel: ElementRef; isLeftScrollVisible = false; @@ -22,6 +27,9 @@ export class CampaignNavigationComponent implements OnChanges { repeater; + constructor(public loginService: LoginService) { + } + ngOnChanges() { this.isRightScrollVisible = this.campaigns.length > 4; } @@ -31,6 +39,14 @@ export class CampaignNavigationComponent implements OnChanges { this.campaignSelect.emit(campaign); } + edit(campaign) { + this.campaignEdit.emit(campaign); + } + + delete(campaign) { + this.campaignDelete.emit(campaign); + } + public scrollList(scrollValue: number): void { const prevScrollLeftValue = this.panel.nativeElement.scrollLeft; diff --git a/static/src/app/statistic/stats.component.html b/static/src/app/statistic/stats.component.html index 0d2a08d..7378a3c 100644 --- a/static/src/app/statistic/stats.component.html +++ b/static/src/app/statistic/stats.component.html @@ -1,7 +1,9 @@ + (campaignSelect)="switchCampaign($event)" + (campaignEdit)="editCampaign($event)" + (campaignDelete)="deleteCampaign($event)">
{ + this.campaigns.splice(this.campaigns.indexOf(campaign), 1); + }); + } + } - // TODO: REACTIVATE - // deleteCampaign(campaign) { - // if (confirm('Soll die Kampagne ' + campaign.title + ' wirklich gelöscht werden?')) { - // this.campaignService.deleteCampaign(campaign._id) - // .subscribe((res) => { - // if (this.selectedWarId === campaign._id) { - // this.selectOverview('all'); - // } - // this.campaigns.splice(this.campaigns.indexOf(campaign), 1); - // }); - // } - // } - // - // editCampaign(selectCampaign) { - // this.router.navigate([{outlets: {'right': ['campaign', selectCampaign._id]}}], {relativeTo: this.route}); - // } + editCampaign(selectCampaign) { + this.router.navigate([{outlets: {'right': ['campaign', selectCampaign._id]}}], {relativeTo: this.route}); + } } diff --git a/static/src/app/statistic/stats.module.ts b/static/src/app/statistic/stats.module.ts index d3ba14c..cab724e 100644 --- a/static/src/app/statistic/stats.module.ts +++ b/static/src/app/statistic/stats.module.ts @@ -7,13 +7,13 @@ import {NgxChartsModule} from '@swimlane/ngx-charts'; import {CampaignService} from '../services/logs/campaign.service'; import {PlayerService} from '../services/logs/player.service'; import {LogsService} from '../services/logs/logs.service'; -import {MatButtonToggleModule, MatSortModule, MatTableModule} from '@angular/material'; +import {MatButtonToggleModule, MatMenuModule, MatSortModule, MatTableModule} from '@angular/material'; @NgModule({ declarations: statsRoutingComponents, imports: [CommonModule, SharedModule, NgxChartsModule, MatButtonToggleModule, MatTableModule, MatSortModule, - statsRouterModule], + MatMenuModule, statsRouterModule], providers: [WarService, CampaignService, PlayerService, LogsService] }) export class StatsModule { diff --git a/static/src/app/statistic/war/war-list/war-item.component.html b/static/src/app/statistic/war/war-list/war-item.component.html index f13e49f..0b01054 100644 --- a/static/src/app/statistic/war/war-list/war-item.component.html +++ b/static/src/app/statistic/war/war-list/war-item.component.html @@ -8,25 +8,25 @@ ◦ {{war.title}} - + + + + + + + +
vom {{war.date | date: 'dd.MM.yyyy'}}
- -
- - -
diff --git a/static/src/app/statistic/war/war-list/war-list.component.html b/static/src/app/statistic/war/war-list/war-list.component.html index 5bb9f91..265d2a3 100644 --- a/static/src/app/statistic/war/war-list/war-list.component.html +++ b/static/src/app/statistic/war/war-list/war-list.component.html @@ -1,10 +1,10 @@
- +
diff --git a/static/src/assets/icon/baseline-delete-24px.svg b/static/src/assets/icon/baseline-delete-24px.svg new file mode 100644 index 0000000..9308f4d --- /dev/null +++ b/static/src/assets/icon/baseline-delete-24px.svg @@ -0,0 +1,4 @@ + + + + diff --git a/static/src/assets/icon/baseline-edit-24px.svg b/static/src/assets/icon/baseline-edit-24px.svg new file mode 100644 index 0000000..015dc1b --- /dev/null +++ b/static/src/assets/icon/baseline-edit-24px.svg @@ -0,0 +1,4 @@ + + + + diff --git a/static/src/assets/icon/baseline-more_vert-24px.svg b/static/src/assets/icon/baseline-more_vert-24px.svg new file mode 100644 index 0000000..ec52bbe --- /dev/null +++ b/static/src/assets/icon/baseline-more_vert-24px.svg @@ -0,0 +1,4 @@ + + + + diff --git a/static/src/assets/icon/twotone-delete-24px.svg b/static/src/assets/icon/twotone-delete-24px.svg deleted file mode 100644 index 9a51fa1..0000000 --- a/static/src/assets/icon/twotone-delete-24px.svg +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/static/src/assets/icon/twotone-edit-24px.svg b/static/src/assets/icon/twotone-edit-24px.svg deleted file mode 100644 index 63de457..0000000 --- a/static/src/assets/icon/twotone-edit-24px.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - -