website init

This commit is contained in:
Benjamin Ifland
2019-03-23 14:13:18 +01:00
parent 8842a192c7
commit 14a033a56c
54 changed files with 11443 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
<mat-card>
<mat-card-header>
<div mat-card-avatar>
<button mat-icon-button [routerLink]="['/songs']" >
<fa-icon [icon]="faArrow"></fa-icon>
</button>
</div>
<mat-card-title>{{ song.Name }}</mat-card-title>
<mat-card-subtitle>{{ song.Key }} - {{ song.Velocity }}</mat-card-subtitle>
</mat-card-header>
<mat-card-content>
<p>{{ song.Text }}</p>
</mat-card-content>
<mat-card-actions>
<button mat-button (click)="onClickDownload()">Herunterladen</button>
</mat-card-actions>
</mat-card>

View File

@@ -0,0 +1,14 @@
.mat-card {
width: 500px;
}
.mat-card-title {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: 450px;
}
.mat-card-content {
white-space: pre-wrap;
}

View File

@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SongComponent } from './song.component';
describe('SongComponent', () => {
let component: SongComponent;
let fixture: ComponentFixture<SongComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SongComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SongComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,32 @@
import { DownloadService } from './../../data/download.service';
import { Component, OnInit } from '@angular/core';
import { SongDetailModel } from 'src/app/models/song-list-detail.model';
import { ActivatedRoute } from '@angular/router';
import { faLongArrowAltLeft } from '@fortawesome/free-solid-svg-icons';
@Component({
selector: 'app-song',
templateUrl: './song.component.html',
styleUrls: ['./song.component.less']
})
export class SongComponent implements OnInit {
public song: SongDetailModel;
public faArrow = faLongArrowAltLeft;
constructor(
private route: ActivatedRoute,
private downloadService: DownloadService
) {}
ngOnInit() {
this.route.data.subscribe((data: { song: SongDetailModel }) => {
this.song = data.song;
});
}
public onClickDownload(): void {
const id = this.song.Id;
const withKey = this.song.HasKeyFile;
this.downloadService.get(id, withKey);
}
}

View File

@@ -0,0 +1 @@
<app-table [songs]="songs"></app-table>

View File

@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SongsComponent } from './songs.component';
describe('SongsComponent', () => {
let component: SongsComponent;
let fixture: ComponentFixture<SongsComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SongsComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SongsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,22 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { SongListModel } from 'src/app/models/song-list.model';
@Component({
selector: 'app-songs',
templateUrl: './songs.component.html',
styleUrls: ['./songs.component.less']
})
export class SongsComponent implements OnInit {
public songs: SongListModel;
constructor(private route: ActivatedRoute) {}
ngOnInit() {
this.route.data.subscribe((data: { songs: SongListModel }) => {
this.songs = data.songs;
});
}
}

View File

@@ -0,0 +1,31 @@
<table *ngIf="songs.SongList" mat-table [dataSource]="songs.SongList" class="mat-elevation-z8">
<ng-container matColumnDef="Id">
<th mat-header-cell *matHeaderCellDef>#</th>
<td mat-cell *matCellDef="let element">{{element.Id}}</td>
</ng-container>
<ng-container matColumnDef="Name">
<th mat-header-cell *matHeaderCellDef>Titel</th>
<td mat-cell *matCellDef="let element">{{element.Name}}</td>
</ng-container>
<ng-container matColumnDef="Key">
<th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let element">{{element.Key}}</td>
</ng-container>
<ng-container matColumnDef="Type">
<th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let element">{{element.Type}}</td>
</ng-container>
<ng-container matColumnDef="Velocity">
<th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let element">{{element.Velocity}}</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="columns; sticky: true"></tr>
<tr mat-row *matRowDef="let row; columns: columns;" [routerLink]="['/songs', row.Id]" routerLinkActive="router-link-active" ></tr>
</table>

View File

@@ -0,0 +1,4 @@
table {
width: 100%;
}

View File

@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TableComponent } from './table.component';
describe('TableComponent', () => {
let component: TableComponent;
let fixture: ComponentFixture<TableComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TableComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(TableComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,26 @@
import { Component, OnInit, Input } from '@angular/core';
import { SongListModel } from 'src/app/models/song-list.model';
@Component({
selector: 'app-table',
templateUrl: './table.component.html',
styleUrls: ['./table.component.less']
})
export class TableComponent implements OnInit {
@Input() public songs: SongListModel;
public columns = [
'Id',
'Name',
'Key',
'Type',
'Velocity',
];
constructor() { }
ngOnInit() {
console.log(this.songs);
}
}