openaire-library/sharedComponents/feedback/feedback.component.ts

55 lines
7.4 KiB
TypeScript
Raw Normal View History

import { Component, Input } from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {StringUtils} from '../../utils/string-utils.class';
@Component({
selector: 'feedback',
template: `
<div id="feedback" class="" (click) = "initialize()">
<a [href]="feedbackQuestionaire ? feedbackQuestionaire : ('mailto:' + feedbackmail +'?Subject=' + subject + '&body=' + body)"
[target]="feedbackQuestionaire ? '_blank' : '_top'" type="button" class="">
<img src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI5LjI5OXB4IiBoZWlnaHQ9IjUwLjYyNXB4IiB2aWV3Qm94PSIwIDAgOS4yOTkgNTAuNjI1IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA5LjI5OSA1MC42MjUiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxnPjxwYXRoIGZpbGw9IiNGRkZGRkYiIGQ9Ik0zLjUxNiw0Ni44N3YxLjYzNWg1LjY2N3YwLjk3NEgzLjUxNnYxLjE0N2gtMC40NGwtMC4zNTItMS4xNDdIMi4zNjdDMC43ODksNDkuNDc4LDAsNDguNzg4LDAsNDcuNDA5YzAtMC4zNCwwLjA2OC0wLjczOCwwLjIwNS0xLjE5NWwwLjc3OSwwLjI1MmMtMC4xMjEsMC4zNzUtMC4xODIsMC42OTUtMC4xOD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TAuNDM5Yy0wLjgzNiwwLTEuNDU5LDAuMTQ2LTEuODY5LDAuNDM5UzMuNDY5LDIxLjQxOCwzLjQ2OSwyMi4wMzJ6Ii8+PHBhdGggZmlsbD0iI0ZGRkZGRiIgZD0iTTkuMTgzLDEzLjU3N0w
</a>
</div>
`
})
export class FeedbackComponent {
@Input()feedbackQuestionaire:string = "";
@Input()feedbackmail:string = "someone@example.com";
@Input()portalName:string = "Explore";
public subject:string;
public body:string = "Send from page";
sub:any;
constructor(private route: ActivatedRoute) {}
ngOnInit() {
// this.feedbackmail = OpenaireProperties.getFeedbackMail();
this.subject = "[Feedback - OpenAIRE "+this.portalName+"]";
this.initialize();
this.sub = this.route.queryParams.subscribe(params => {
this.initialize();
});
}
ngOnDestroy(){
this.sub.unsubscribe();
}
initialize(){
var referrer = null;
if (typeof location !== 'undefined') {
referrer = location.href;
}
this.body = "[Please write your message here] \n\n\nOpenAIRE " + this.portalName + " \nSent from "+((referrer)?referrer:" [referrer not available]")+ " \n(please don't delete this part of the message)";
this.body = StringUtils.URIEncode(this.body);
// this.subject = StringUtils.URIEncode(this.subject);
}
}