mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-29 08:00:57 +03:00
Added ability to favorite a file
Moved file filter options above the list of files, and added option to filter for favorites
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
<h4 mat-dialog-title>{{file.title}}</h4>
|
||||
<h4 mat-dialog-title>
|
||||
{{file.title}}
|
||||
<button [disabled]="!initialized || retrieving_file" (click)="toggleFavorite()" mat-icon-button class="favorite-button"><mat-icon>{{file.favorite ? 'favorite_filled' : 'favorite_outline'}}</mat-icon></button>
|
||||
</h4>
|
||||
|
||||
<mat-dialog-content>
|
||||
<div style="width: 100%; position: relative;">
|
||||
|
||||
@@ -23,4 +23,10 @@
|
||||
|
||||
.a-wrap {
|
||||
word-wrap: break-word
|
||||
}
|
||||
|
||||
.favorite-button {
|
||||
position: absolute;
|
||||
right: 4px;
|
||||
top: 4px;
|
||||
}
|
||||
@@ -19,6 +19,7 @@ export class VideoInfoDialogComponent implements OnInit {
|
||||
category: Category;
|
||||
editing = false;
|
||||
initialized = false;
|
||||
retrieving_file = false;
|
||||
|
||||
constructor(@Inject(MAT_DIALOG_DATA) public data: any, public postsService: PostsService, private datePipe: DatePipe) { }
|
||||
|
||||
@@ -58,9 +59,14 @@ export class VideoInfoDialogComponent implements OnInit {
|
||||
}
|
||||
|
||||
getFile(): void {
|
||||
this.retrieving_file = true;
|
||||
this.postsService.getFile(this.file.uid).subscribe(res => {
|
||||
this.retrieving_file = false;
|
||||
this.file = res['file'];
|
||||
this.initializeFile(this.file);
|
||||
}, err => {
|
||||
this.retrieving_file = false;
|
||||
console.error(err);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -85,4 +91,12 @@ export class VideoInfoDialogComponent implements OnInit {
|
||||
return JSON.stringify(this.file) !== JSON.stringify(this.new_file);
|
||||
}
|
||||
|
||||
toggleFavorite(): void {
|
||||
this.file.favorite = !this.file.favorite;
|
||||
this.retrieving_file = true;
|
||||
this.postsService.updateFile(this.file.uid, {favorite: this.file.favorite}).subscribe(res => {
|
||||
this.getFile();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user