import {Component, Input, ViewChild} from "@angular/core";
import {StringUtils} from "../string-utils.class";
import {RouterHelper} from "../routerHelper.class";
import {properties} from "../../../../environments/environment";
@Component({
selector: 'entity-actions',
template: `
`
})
export class EntityActionsComponent {
@Input() result: any;
@Input() type: string;
@Input() id: string;
@Input() linking: boolean = false;
@Input() share: boolean = false;
@Input() cite: boolean = false;
@Input() url: string;
public piwikSiteId = properties.piwikSiteId;
public citeThisClicked: boolean;
public routerHelper: RouterHelper = new RouterHelper();
@ViewChild('citeModal') citeModal;
@ViewChild('addThisModal') addThisModal;
constructor() {
}
get linkTo():string {
return this.type === 'project'?'result':'project';
}
public getTypeName(): string {
return StringUtils.getEntityName(this.type, false);
}
public openCiteModal() {
this.citeThisClicked = true;
this.citeModal.cancelButton = false;
this.citeModal.okButton = false;
this.citeModal.alertTitle = "Cite this " + this.getTypeName();
this.citeModal.open();
}
public openAddThisModal() {
console.log(this.url);
this.addThisModal.cancelButton = false;
this.addThisModal.okButton = false;
this.addThisModal.alertTitle = "Share this " + this.getTypeName() + " in your social networks";
this.addThisModal.open();
}
}