Skip to content
Snippets Groups Projects
Unverified Commit 47eba2c2 authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire:
Browse files

Implement annotation value pre-setting and refactor annotation block html (#37)

parent c7d7c2bd
No related branches found
No related tags found
No related merge requests found
Pipeline #19070 passed
...@@ -59,6 +59,10 @@ export class PdfAnnotationView extends ScopedElementsMixin(DBPLitElement) { ...@@ -59,6 +59,10 @@ export class PdfAnnotationView extends ScopedElementsMixin(DBPLitElement) {
super.update(changedProperties); super.update(changedProperties);
} }
setAnnotationRows(rows) {
this.annotationRows = rows ? rows : [];
}
/** /**
* Deletes all fields and restore introduction text * Deletes all fields and restore introduction text
*/ */
...@@ -266,44 +270,30 @@ export class PdfAnnotationView extends ScopedElementsMixin(DBPLitElement) { ...@@ -266,44 +270,30 @@ export class PdfAnnotationView extends ScopedElementsMixin(DBPLitElement) {
const annotationTypeData = utils.getAnnotationTypes(data.annotationType); const annotationTypeData = utils.getAnnotationTypes(data.annotationType);
const name = annotationTypeData.name[this.lang]; const name = annotationTypeData.name[this.lang];
if (annotationTypeData.hasOrganization) {
results.push(html` results.push(html`
<div class="annotation-block annotation-block-${this.key}-${id} with-organization"> <div class="${classMap({'with-organization': annotationTypeData.hasOrganization, 'annotation-block': true})}">
<label>${name}</label> <label>${name}</label>
<dbp-organization-select subscribe="lang:lang,entry-point-url:entry-point-url,auth:auth" <dbp-organization-select subscribe="lang:lang,entry-point-url:entry-point-url,auth:auth"
class="${classMap({hidden: !annotationTypeData.hasOrganization})}"
value="${data.organizationValue}" value="${data.organizationValue}"
@change=${e => { @change=${e => {
this.updateAnnotation(id, 'organizationValue', e.target.value); this.updateAnnotation(id, 'organizationValue', e.target.value);
this.updateAnnotation(id, 'organizationNumber', JSON.parse(e.target.getAttribute("data-object")).alternateName); this.updateAnnotation(id, 'organizationNumber', JSON.parse(e.target.getAttribute("data-object")).alternateName);
}}></dbp-organization-select> }}></dbp-organization-select>
<input type="text" class="input" placeholder="${i18n.t('annotation-view.businessnumber-placeholder')}" @change=${e => { this.updateAnnotation(id, 'value', e.target.value); }}> <input type="text" .value="${data.value}" class="input" placeholder="${i18n.t('annotation-view.businessnumber-placeholder')}" @change=${e => { this.updateAnnotation(id, 'value', e.target.value); }}>
<button class="button close" <button class="button close"
title="${i18n.t('annotation-view.remove-field')}" title="${i18n.t('annotation-view.remove-field')}"
@click="${() => { this.removeAnnotation(id); } }"> @click="${() => { this.removeAnnotation(id); } }">
<dbp-icon name="trash"></dbp-icon></button> <dbp-icon name="trash"></dbp-icon></button>
</div> </div>
`); `);
} else {
results.push(html`
<div class="annotation-block annotation-block-${this.key}-${id}">
<label>${name}</label>
<input type="text" class="input" placeholder="${i18n.t('annotation-view.intended-use-placeholder')}" @change=${e => { this.updateAnnotation(id, 'value', e.target.value); }}>
<button class="button close"
title="${i18n.t('annotation-view.remove-field')}"
@click="${() => { this.removeAnnotation(id); } }">
<dbp-icon name="trash"></dbp-icon></button>
</div>
`);
}
}); });
return results; return results;
} }
render() { render() {
return html` return html`
<div id="pdf-main-container"> <div id="pdf-main-container">
<div id="pdf-meta"> <div id="pdf-meta">
<div class="nav-buttons"> <div class="nav-buttons">
......
...@@ -131,6 +131,7 @@ export default class DBPSignatureLitElement extends DBPSignatureBaseLitElement { ...@@ -131,6 +131,7 @@ export default class DBPSignatureLitElement extends DBPSignatureBaseLitElement {
const viewTag = this.constructor.getScopedTagName('dbp-pdf-annotation-view'); const viewTag = this.constructor.getScopedTagName('dbp-pdf-annotation-view');
this._(viewTag).setAttribute('key', key); this._(viewTag).setAttribute('key', key);
this._(viewTag).setAnnotationRows(this.queuedFilesAnnotations[key]);
this.isAnnotationViewVisible = true; this.isAnnotationViewVisible = true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment