Fix: Convert button on eml-to-pdf html

This commit is contained in:
Balázs Szücs 2025-06-15 00:30:33 +02:00
parent 23ea86c377
commit 571a826a51

View File

@ -7,20 +7,22 @@
</head> </head>
<body> <body>
<th:block th:insert="~{fragments/common :: game}"></th:block>
<div id="page-container"> <div id="page-container">
<div id="content-wrap"> <div id="content-wrap">
<th:block th:insert="~{fragments/navbar.html :: navbar}"></th:block> <th:block th:insert="~{fragments/navbar.html :: navbar}"></th:block>
<div class="container py-4"> <br><br>
<div class="container">
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-md-6"> <div class="col-md-6 bg-card">
<div class="card shadow-sm">
<div class="card-body">
<div class="tool-header"> <div class="tool-header">
<span class="material-symbols-rounded tool-header-icon convertto">email</span> <span class="material-symbols-rounded tool-header-icon convertto">email</span>
<span class="tool-header-text" th:text="#{EMLToPDF.header}"></span> <span class="tool-header-text" th:text="#{EMLToPDF.header}"></span>
</div> </div>
<p th:text="#{processTimeWarning}"></p>
<form method="post" enctype="multipart/form-data" th:action="@{'/api/v1/convert/eml/pdf'}" class="mt-4"> <form method="post" enctype="multipart/form-data" th:action="@{'/api/v1/convert/eml/pdf'}" class="mt-4">
<div th:replace="~{fragments/common :: fileSelector(name='fileInput', multipleInputsForSingleRequest=false, accept='.eml,message/rfc822')}"> <div
th:replace="~{fragments/common :: fileSelector(name='fileInput', multipleInputsForSingleRequest=false, accept='.eml,message/rfc822')}">
</div> </div>
<div class="form-check mb-3"> <div class="form-check mb-3">
@ -39,8 +41,6 @@
<label for="maxAttachmentSizeMB" class="form-label" th:text="#{EMLToPDF.maxAttachmentSize}"></label> <label for="maxAttachmentSizeMB" class="form-label" th:text="#{EMLToPDF.maxAttachmentSize}"></label>
<input type="number" class="form-control" id="maxAttachmentSizeMB" name="maxAttachmentSizeMB" value="10" min="1" max="100"> <input type="number" class="form-control" id="maxAttachmentSizeMB" name="maxAttachmentSizeMB" value="10" min="1" max="100">
</div> </div>
</div> </div>
<div class="mb-4"> <div class="mb-4">
@ -59,10 +59,12 @@
</div> </div>
</div> </div>
<div>
<br />
<button type="submit" id="submitBtn" class="btn btn-primary" th:text="#{EMLToPDF.submit}"></button> <button type="submit" id="submitBtn" class="btn btn-primary" th:text="#{EMLToPDF.submit}"></button>
</div>
</form> </form>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -75,11 +77,12 @@
const downloadHtml = document.getElementById('downloadHtml'); const downloadHtml = document.getElementById('downloadHtml');
const pdfOnlyOptions = document.getElementById('pdfOnlyOptions'); const pdfOnlyOptions = document.getElementById('pdfOnlyOptions');
const submitBtn = document.getElementById('submitBtn'); const submitBtn = document.getElementById('submitBtn');
const submitText = /*[[#{EMLToPDF.submit}]]*/ 'Convert to PDF';
function updateFormState() { function updateFormState() {
if (pdfOnlyOptions && submitBtn) { if (pdfOnlyOptions && submitBtn) {
pdfOnlyOptions.style.display = downloadHtml.checked ? 'none' : 'block'; pdfOnlyOptions.style.display = downloadHtml.checked ? 'none' : 'block';
submitBtn.textContent = downloadHtml.checked ? 'Download HTML' : '[[#{EMLToPDF.submit}]]'; submitBtn.textContent = downloadHtml.checked ? 'Download HTML' : submitText;
} }
} }