list shows for public and own filter
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import {Component, Input, OnInit} from '@angular/core';
|
||||
import {Component, Input} from '@angular/core';
|
||||
import {Show} from '../../services/show';
|
||||
|
||||
@Component({
|
||||
@@ -6,13 +6,6 @@ import {Show} from '../../services/show';
|
||||
templateUrl: './list-item.component.html',
|
||||
styleUrls: ['./list-item.component.less']
|
||||
})
|
||||
export class ListItemComponent implements OnInit {
|
||||
export class ListItemComponent {
|
||||
@Input() public show: Show;
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,16 @@
|
||||
<div>
|
||||
<app-list-header></app-list-header>
|
||||
|
||||
<app-card *ngIf="shows$ | async as shows" [@fade] [padding]="false">
|
||||
<app-list-item *ngFor="let show of shows" [routerLink]="show.id" [show]="show"></app-list-item>
|
||||
</app-card>
|
||||
<ng-container *ngIf="shows$ | async as shows">
|
||||
<app-card *ngIf="getPrivateSongs(shows).length>0" [@fade] [padding]="false" heading="meine Veranstaltungen">
|
||||
<app-list-item *ngFor="let show of getPrivateSongs(shows)" [routerLink]="show.id" [show]="show"></app-list-item>
|
||||
</app-card>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="shows$ | async as shows">
|
||||
<app-card *ngIf="getPublicShows(shows).length>0" [@fade] [padding]="false"
|
||||
heading="veröffentlichte Veranstaltungen">
|
||||
<app-list-item *ngFor="let show of getPublicShows(shows)" [routerLink]="show.id" [show]="show"></app-list-item>
|
||||
</app-card>
|
||||
</ng-container>
|
||||
</div>
|
||||
|
||||
@@ -17,4 +17,12 @@ export class ListComponent {
|
||||
this.shows$ = showService.list$();
|
||||
}
|
||||
|
||||
public getPublicShows(songs: Show[]): Show[] {
|
||||
return songs.filter(_ => _.published)
|
||||
}
|
||||
|
||||
public getPrivateSongs(songs: Show[]): Show[] {
|
||||
return songs.filter(_ => !_.published)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user