transpose & history
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<div>
|
||||
<app-edit-song></app-edit-song>
|
||||
<app-edit-file></app-edit-file>
|
||||
<app-history></app-history>
|
||||
</div>
|
||||
|
||||
@@ -24,10 +24,11 @@ import {ButtonModule} from '../../../../widget-modules/components/button/button.
|
||||
import {MatTooltipModule} from '@angular/material/tooltip';
|
||||
import {SaveDialogComponent} from './edit-song/save-dialog/save-dialog.component';
|
||||
import {MatDialogModule} from '@angular/material/dialog';
|
||||
import {HistoryComponent} from './history/history.component';
|
||||
|
||||
|
||||
@NgModule({
|
||||
declarations: [EditComponent, EditSongComponent, EditFileComponent, FileComponent, SaveDialogComponent],
|
||||
declarations: [EditComponent, EditSongComponent, EditFileComponent, FileComponent, SaveDialogComponent, HistoryComponent],
|
||||
exports: [EditComponent],
|
||||
bootstrap: [SaveDialogComponent],
|
||||
imports: [
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<app-card *ngIf="song && song.edits" heading="letzte Änderungen">
|
||||
<div *ngFor="let edit of song.edits" class="list">
|
||||
<div>{{edit.username}}</div>
|
||||
<div>{{edit.timestamp.toDate()|date:'dd.MM.yyyy'}}</div>
|
||||
</div>
|
||||
</app-card>
|
||||
@@ -0,0 +1,4 @@
|
||||
.list {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
|
||||
import {HistoryComponent} from './history.component';
|
||||
|
||||
describe('HistoryComponent', () => {
|
||||
let component: HistoryComponent;
|
||||
let fixture: ComponentFixture<HistoryComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [HistoryComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(HistoryComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
31
src/app/modules/songs/song/edit/history/history.component.ts
Normal file
31
src/app/modules/songs/song/edit/history/history.component.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {first, map, switchMap} from 'rxjs/operators';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
import {SongService} from '../../../services/song.service';
|
||||
import {Song} from '../../../services/song';
|
||||
|
||||
@Component({
|
||||
selector: 'app-history',
|
||||
templateUrl: './history.component.html',
|
||||
styleUrls: ['./history.component.less']
|
||||
})
|
||||
export class HistoryComponent implements OnInit {
|
||||
public song: Song;
|
||||
|
||||
constructor(
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private songService: SongService,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
public ngOnInit(): void {
|
||||
this.activatedRoute.params.pipe(
|
||||
map(param => param.songId),
|
||||
switchMap(songId => this.songService.read$(songId)),
|
||||
first()
|
||||
).subscribe(song => {
|
||||
this.song = song;
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user