From 9bacebf2e9349a5de1455dc0ea281791809a944d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Sz=C3=BCcs?= <127139797+Balazs-Szucs@users.noreply.github.com> Date: Mon, 16 Jun 2025 19:03:31 +0200 Subject: [PATCH] Fix: Correct Convert Button Visuals and Make Consistent Code for EML-to-PDF (#3707) # Description of Changes ### Before: ![image](https://github.com/user-attachments/assets/cbf3b0e5-ecb4-4959-9756-cb954858e08a) ### After: ![image](https://github.com/user-attachments/assets/d7d5a1bb-9f07-474f-b180-f8b0b15bfe62) As I was reviewing my translation I noticed that there is a problem how Convert button is being displayed as "Convert", after further review I realized Eml-To-pdf.html was a bit inconsistent with other HTMLs. This PR updates the `eml-to-pdf.html`, and addresses consistency issues, as well the visual Convert button problem. Updated the `eml-to-pdf.html` template to improve its structure, styling, and functionality. The changes include enhancements to the layout, better handling of dynamic text, and minor code cleanups. ### Layout and Styling Updates: * Added a new block (`th:block`) to include a common game fragment and adjusted the layout by removing extra `
` tags and modifying the container structure for better alignment. * Updated the class of a `
` element to include `bg-card` for improved styling. ### Functional Improvements: * Refactored the JavaScript to use a pre-defined `submitText` variable for dynamic button text, improving maintainability. ### Code Cleanup: * Removed unnecessary blank lines and improved the indentation for better readability. --- ## Checklist ### General - [x] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [x] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md) (if applicable) - [x] I have performed a self-review of my own code - [x] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### UI Changes (if applicable) - [x] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [x] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing) for more details. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../templates/convert/eml-to-pdf.html | 108 +++++++++--------- 1 file changed, 56 insertions(+), 52 deletions(-) diff --git a/stirling-pdf/src/main/resources/templates/convert/eml-to-pdf.html b/stirling-pdf/src/main/resources/templates/convert/eml-to-pdf.html index 2f1eb3ba3..e3b469ab9 100644 --- a/stirling-pdf/src/main/resources/templates/convert/eml-to-pdf.html +++ b/stirling-pdf/src/main/resources/templates/convert/eml-to-pdf.html @@ -7,62 +7,64 @@ +
-
+
+
-
-
-
-
- email - -
-
-
-
- -
- - -
-
- -
-
- - -
- -
- - -
- - -
- -
- -
-
-

-
    -
  • -
  • -
  • -
-
-
-
- - -
-
+
+
+ email +
+

+
+
+
+ +
+ + +
+
+ +
+
+ + +
+ +
+ + +
+
+ +
+ +
+
+

+
    +
  • +
  • +
  • +
+
+
+
+ +
+
+ +
+
+
@@ -75,11 +77,13 @@ const downloadHtml = document.getElementById('downloadHtml'); const pdfOnlyOptions = document.getElementById('pdfOnlyOptions'); const submitBtn = document.getElementById('submitBtn'); + const submitText = /*[[#{EMLToPDF.submit}]]*/ 'Convert to PDF'; + const downloadHtmlText = 'Download HTML intermediate file instead of PDF'; function updateFormState() { if (pdfOnlyOptions && submitBtn) { pdfOnlyOptions.style.display = downloadHtml.checked ? 'none' : 'block'; - submitBtn.textContent = downloadHtml.checked ? 'Download HTML' : '[[#{EMLToPDF.submit}]]'; + submitBtn.textContent = downloadHtml.checked ? downloadHtmlText : submitText; } }