Start of thumbnail upload dialog

This commit is contained in:
Willem Dantuma
2021-02-25 19:57:09 +01:00
parent b537239c96
commit a098f72b1a
11 changed files with 143 additions and 34 deletions

View File

@@ -1,6 +1,7 @@
import { Component,Input } from '@angular/core';
import { Component,Input ,ViewChild,ElementRef} from '@angular/core';
import { Store } from '@ngrx/store';
import { IItem } from '../../models/item';
import {NgbModal} from "@ng-bootstrap/ng-bootstrap"
import { IListItem } from '../../models/list.item';
import { commonReducers,ItemTypeService } from '../../../public-api'
@Component({
@@ -11,12 +12,40 @@ import { commonReducers,ItemTypeService } from '../../../public-api'
export class ThumbnailComponent {
@Input() public item: IItem;
@Input() public item: IListItem;
@Input() public edit: boolean = false;
@ViewChild('thumbnail') el:ElementRef;
@ViewChild('thumbnail_upload') modal:ElementRef;
constructor(public store: Store<commonReducers.State>, public itemTypeService: ItemTypeService) {
constructor(public store: Store<commonReducers.State>, public itemTypeService: ItemTypeService,private modalService: NgbModal) {
}
getThumbnailUrl(item:IItem):string {
getThumbnailUrl(item:IListItem):string {
return item.url+'/thumbnail?v=' + Date.parse(item.updated);
}
}
getFontSize():string {
if(this.el) {
var h = this.el.nativeElement.offsetHeight - (this.el.nativeElement.offsetHeight / 5 )
return h + "px";
} else {
return "1em";
}
}
getLineHeight():string {
if(this.el) {
return this.el.nativeElement.offsetHeight + "px";
} else {
return "1em";
}
}
canEdit():boolean {
return this.edit && this.item != null;
}
onEditClick() {
this.modalService.open(this.modal);
}
}