Start of thumbnail upload dialog
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user