Skip to content

Commit

Permalink
Merge branch 'main' into 289-export-pdf-attachments-in-addition
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/resources/webapp/pdf-exporter/js/pdf-exporter.js
  • Loading branch information
grigoriev committed Nov 28, 2024
2 parents e4e9c5f + b1e84b9 commit 7556d2c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ String adjustCellWidth(@NotNull String html, @NotNull ExportParams exportParams)
// This regexp searches for <td> or <th> elements of regular tables which width in styles specified in pixels ("px").
// <td> or <th> element till "width:" in styles matched into first unnamed group and width value - into second unnamed group.
// Then we replace matched content by first group content plus "auto" instead of value in pixels.
html = RegexMatcher.get("(<t[dh].+?width:.*?)(\\d+px)")
html = RegexMatcher.get("(<t[dh][^>]+?width:.*?)(\\d+px)")
.replace(html, regexEngine -> regexEngine.group(1) + "auto");
}

Expand Down
18 changes: 9 additions & 9 deletions src/main/resources/webapp/pdf-exporter/html/popupForm.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@

<div class="flex-container">
<div class="flex-column">
<div class='property-wrapper only-live-doc'>
<div class='property-wrapper hidden visible-for-live-doc visible-for-test-run'>
<label for='popup-fit-to-page'>
<input id='popup-fit-to-page' type='checkbox'/>
Fit images and tables to page
Expand All @@ -104,7 +104,7 @@
Follow HTML presentational hints
</label>
</div>
<div class='property-wrapper only-live-doc'>
<div class='property-wrapper hidden visible-for-live-doc'>
<label for='popup-enable-comments-rendering'>
<input id='popup-enable-comments-rendering' type='checkbox'/>
Comments rendering
Expand All @@ -118,13 +118,13 @@
</div>
</div>
<div class="flex-column">
<div class='property-wrapper only-live-doc'>
<div class='property-wrapper hidden visible-for-live-doc'>
<label for='popup-cut-empty-chapters'>
<input id='popup-cut-empty-chapters' type='checkbox'/>
Cut empty chapters (any level)
</label>
</div>
<div class='property-wrapper only-live-doc'>
<div class='property-wrapper hidden visible-for-live-doc'>
<label for='popup-cut-empty-wi-attributes'>
<input id='popup-cut-empty-wi-attributes' type='checkbox'/>
Cut empty Workitem attributes
Expand All @@ -136,7 +136,7 @@
Cut local Polarion URLs
</label>
</div>
<div class='property-wrapper only-live-doc'>
<div class='property-wrapper hidden visible-for-live-doc'>
<label for='popup-mark-referenced-workitems'>
<input id='popup-mark-referenced-workitems' type='checkbox'/>
Mark referenced Workitems
Expand All @@ -154,14 +154,14 @@

<div class="flex-container">
<div class="flex-column">
<div class='property-wrapper only-live-doc'>
<div class='property-wrapper hidden visible-for-live-doc'>
<label for='popup-custom-list-styles'>
<input id='popup-custom-list-styles' onchange='document.getElementById("popup-numbered-list-styles").style.visibility = this.checked ? "visible" : "hidden"' type='checkbox'/>
Custom styles of numbered lists
</label>
<input id='popup-numbered-list-styles' placeholder='eg. 1ai' style='width: 84px' type='text'/>
</div>
<div class='property-wrapper only-live-doc'>
<div class='property-wrapper hidden visible-for-live-doc'>
<label for='popup-specific-chapters'>
<input id='popup-specific-chapters' onchange='document.getElementById("popup-chapters").style.visibility = this.checked ? "visible" : "hidden"' type='checkbox'/>
Specific higher level chapters
Expand All @@ -170,7 +170,7 @@
</div>
</div>
<div class="flex-column">
<div class='property-wrapper only-live-doc'>
<div class='property-wrapper hidden visible-for-live-doc'>
<label for='popup-localization'>
<input id='popup-localization' onchange='document.getElementById("popup-language").style.visibility = this.checked ? "visible" : "hidden"' type='checkbox'/>
Localize enums
Expand All @@ -181,7 +181,7 @@
<option value='it'>Italiano</option>
</select>
</div>
<div class='property-wrapper only-live-doc'>
<div class='property-wrapper hidden visible-for-live-doc'>
<label for='popup-selected-roles' style="align-self: flex-start;">
<input id='popup-selected-roles' onchange='document.getElementById("popup-roles-selector").style.display = this.checked ? "inline-block" : "none"' type='checkbox'/>
Specific Workitem roles
Expand Down
22 changes: 15 additions & 7 deletions src/main/resources/webapp/pdf-exporter/js/pdf-exporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,20 @@ const PdfExporter = {

this.hideAlerts();
this.loadFormData();
const documentContext = this.exportContext.getDocumentType() === ExportParams.DocumentType.LIVE_DOC;
document.querySelectorAll(".modal__container.pdf-exporter .property-wrapper.only-live-doc")
.forEach(propertyBlock => propertyBlock.style.display = (documentContext ? "flex" : "none"));
const mixedContext = this.exportContext.getDocumentType() === ExportParams.DocumentType.MIXED;
document.querySelectorAll(".modal__container.pdf-exporter .property-wrapper.not-mixed")
.forEach(propertyBlock => propertyBlock.style.display = (mixedContext ? "none" : "flex"));
switch (this.exportContext.getDocumentType()) {
case ExportParams.DocumentType.LIVE_DOC:
document.querySelectorAll(".modal__container.pdf-exporter .property-wrapper.visible-for-live-doc")
.forEach(propertyBlock => propertyBlock.style.display = "flex");
break;
case ExportParams.DocumentType.TEST_RUN:
document.querySelectorAll(".modal__container.pdf-exporter .property-wrapper.visible-for-test-run")
.forEach(propertyBlock => propertyBlock.style.display = "flex");
break;
case ExportParams.DocumentType.MIXED:
document.querySelectorAll(".modal__container.pdf-exporter .property-wrapper.not-mixed")
.forEach(propertyBlock => propertyBlock.style.display = "none");
break;
}
MicroModal.show(POPUP_ID);
},

Expand Down Expand Up @@ -531,7 +539,7 @@ const PdfExporter = {
.setHeadersColor(document.getElementById("popup-headers-color").value)
.setPaperSize(document.getElementById("popup-paper-size-selector").value)
.setOrientation(document.getElementById("popup-orientation-selector").value)
.setFitToPage(live_doc && document.getElementById('popup-fit-to-page').checked)
.setFitToPage((live_doc || test_run) && document.getElementById('popup-fit-to-page').checked)
.setEnableCommentsRendering(live_doc && document.getElementById('popup-enable-comments-rendering').checked)
.setWatermark(document.getElementById("popup-watermark").checked)
.setMarkReferencedWorkitems(live_doc && document.getElementById("popup-mark-referenced-workitems").checked)
Expand Down

0 comments on commit 7556d2c

Please sign in to comment.