diff --git a/src/app/modules/shows/list/list-item/list-item.component.ts b/src/app/modules/shows/list/list-item/list-item.component.ts index 8f577b7..26a0299 100644 --- a/src/app/modules/shows/list/list-item/list-item.component.ts +++ b/src/app/modules/shows/list/list-item/list-item.component.ts @@ -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() { - } - } diff --git a/src/app/modules/shows/list/list.component.html b/src/app/modules/shows/list/list.component.html index 3d45e17..fa8e5a6 100644 --- a/src/app/modules/shows/list/list.component.html +++ b/src/app/modules/shows/list/list.component.html @@ -1,7 +1,16 @@
- - - + + + + + + + + + + +
diff --git a/src/app/modules/shows/list/list.component.ts b/src/app/modules/shows/list/list.component.ts index b80abbc..06d5c3b 100644 --- a/src/app/modules/shows/list/list.component.ts +++ b/src/app/modules/shows/list/list.component.ts @@ -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) + } + } diff --git a/src/app/modules/shows/show/show.component.html b/src/app/modules/shows/show/show.component.html index 5eda0ae..6588aab 100644 --- a/src/app/modules/shows/show/show.component.html +++ b/src/app/modules/shows/show/show.component.html @@ -22,11 +22,14 @@ [songs]="songs"> - Archivieren - Wiederherstellen - Veröffentlichen - Veröffentlichung zurückziehen - + + + Archivieren + Wiederherstellen + Veröffentlichen + Veröffentlichung zurückziehen + + Herunterladen diff --git a/src/app/modules/shows/shows.module.ts b/src/app/modules/shows/shows.module.ts index 7cf42b1..69210ae 100644 --- a/src/app/modules/shows/shows.module.ts +++ b/src/app/modules/shows/shows.module.ts @@ -25,6 +25,7 @@ import {SongTextModule} from '../../widget-modules/components/song-text/song-tex import {NgxMatSelectSearchModule} from 'ngx-mat-select-search'; import {AddSongModule} from '../../widget-modules/components/add-song/add-song.module'; import {ButtonModule} from '../../widget-modules/components/button/button.module'; +import {OwnerModule} from '../../services/user/owner.module'; @NgModule({ @@ -51,6 +52,7 @@ import {ButtonModule} from '../../widget-modules/components/button/button.module NgxMatSelectSearchModule, AddSongModule, ButtonModule, + OwnerModule, ] }) export class ShowsModule { diff --git a/src/app/services/user/owner.directive.ts b/src/app/services/user/owner.directive.ts new file mode 100644 index 0000000..77a09b6 --- /dev/null +++ b/src/app/services/user/owner.directive.ts @@ -0,0 +1,42 @@ +import {Directive, ElementRef, Input, OnInit, TemplateRef, ViewContainerRef} from '@angular/core'; +import {User} from './user'; +import {UserService} from './user.service'; + +@Directive({ + selector: '[appOwner]' +}) +export class OwnerDirective implements OnInit { + @Input() appOwner: string; + private currentUser: User; + private loggedIn: boolean; + + constructor( + private element: ElementRef, + private templateRef: TemplateRef, + private viewContainer: ViewContainerRef, + private userService: UserService + ) { + + } + + public ngOnInit(): void { + this.userService.user$.subscribe(user => { + this.currentUser = user; + this.updateView(); + }); + this.userService.loggedIn$().subscribe(_ => { + this.loggedIn = !!_; + this.updateView(); + }); + this.updateView(); + } + + private updateView() { + this.viewContainer.clear(); + if (this.loggedIn && this.currentUser.id === this.appOwner) { + this.viewContainer.createEmbeddedView(this.templateRef); + } + } + + +} diff --git a/src/app/services/user/owner.module.ts b/src/app/services/user/owner.module.ts new file mode 100644 index 0000000..3d764dc --- /dev/null +++ b/src/app/services/user/owner.module.ts @@ -0,0 +1,13 @@ +import {NgModule} from '@angular/core'; +import {OwnerDirective} from './owner.directive'; +import {CommonModule} from '@angular/common'; + +@NgModule({ + declarations: [OwnerDirective], + exports: [OwnerDirective], + imports: [ + CommonModule + ] +}) +export class OwnerModule { +} diff --git a/src/app/widget-modules/components/card/card.component.less b/src/app/widget-modules/components/card/card.component.less index 8324552..efcddfd 100644 --- a/src/app/widget-modules/components/card/card.component.less +++ b/src/app/widget-modules/components/card/card.component.less @@ -29,6 +29,12 @@ margin-bottom: 20px; margin-right: 20px; opacity: 0.7; + padding-left: 20px; + padding-top: 20px; +} + +.padding .heading { + padding: 0; } .btn-close {