Update toHtml() method in Form.java

Simplified the HTML structure for the `toHtml` method by switching from a table layout to paragraph tags. This removes unnecessary table formatting for improved readability and maintainability. Also updated workspace.xml with task tracking and removed outdated comments.
This commit is contained in:
Teriuihi 2024-08-11 18:24:37 +02:00
parent 4a0aebce82
commit fcda4c9e53
2 changed files with 15 additions and 21 deletions

View File

@ -4,12 +4,8 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="ce59df2a-8d56-446a-867b-80e627daf479" name="Changes" comment="Add branch condition to Discord notification stage&#10;&#10;The Discord notification stage now runs only on 'main' or 'master' branches. This helps to avoid unnecessary notifications for feature or bugfix branches.">
<change afterPath="$PROJECT_DIR$/src/main/java/com/alttd/forms/mail/mail_forms/Mailable.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/alttd/forms/controlers/contact/ContactFormData.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/alttd/forms/controlers/contact/ContactFormData.java" afterDir="false" />
<list default="true" id="ce59df2a-8d56-446a-867b-80e627daf479" name="Changes" comment="Improve email handling with Mailable interface&#10;&#10;Added a new Mailable interface for extracting email-related data like receiver and subject. Updated StaffAppFormData and ContactFormData to implement this interface, and refactored MailForm to utilize these details. This enhances flexibility and decouples email details from form classes.">
<change beforePath="$PROJECT_DIR$/src/main/java/com/alttd/forms/form/Form.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/alttd/forms/form/Form.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/alttd/forms/mail/mail_forms/MailForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/alttd/forms/mail/mail_forms/MailForm.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -396,7 +392,7 @@
<workItem from="1723242314809" duration="9799000" />
<workItem from="1723307861750" duration="2179000" />
<workItem from="1723392202182" duration="258000" />
<workItem from="1723392471077" duration="533000" />
<workItem from="1723392471077" duration="905000" />
</task>
<task id="LOCAL-00001" summary="Initial commit for site for forms">
<option name="closed" value="true" />
@ -670,7 +666,15 @@
<option name="project" value="LOCAL" />
<updated>1723392636255</updated>
</task>
<option name="localTasksCounter" value="35" />
<task id="LOCAL-00035" summary="Improve email handling with Mailable interface&#10;&#10;Added a new Mailable interface for extracting email-related data like receiver and subject. Updated StaffAppFormData and ContactFormData to implement this interface, and refactored MailForm to utilize these details. This enhances flexibility and decouples email details from form classes.">
<option name="closed" value="true" />
<created>1723393276632</created>
<option name="number" value="00035" />
<option name="presentableId" value="LOCAL-00035" />
<option name="project" value="LOCAL" />
<updated>1723393276632</updated>
</task>
<option name="localTasksCounter" value="36" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@ -688,7 +692,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="Refactor logging for better granularity&#10;&#10;Updated logging levels in multiple classes to differentiate between debug and trace information. Improved log messages to support parameterized logs, ensuring sensitive or variable information is handled appropriately without concatenation." />
<MESSAGE value="Enhance logging for mail verification details&#10;&#10;Updated logging to provide more detailed information about user credentials and email actions. This helps in debugging and monitoring mail verification processes more effectively. Adjusted trace messages to include username and password for better traceability." />
<MESSAGE value="Update URI to point to Discord bot endpoint&#10;&#10;Changed the URI in VerifyController to use the Discord bot's endpoint for form submission. This adjustment is part of the process to route form data correctly through the specified internal service." />
<MESSAGE value="Rename StoreFormQuery package to forms.form&#10;&#10;Updated the package name for consistency and better categorization. Adjusted imports in related test files to reflect the new package structure." />
@ -713,7 +716,8 @@
<MESSAGE value="Ensure NOT NULL constraints in SQL tables&#10;&#10;Refactor SQL table creation scripts to add NOT NULL constraints where necessary. This change ensures data integrity by preventing null values in critical columns across the 'verify_form', 'form', 'rate_limit', and 'form_active' tables." />
<MESSAGE value="Add JSON response handling for form activity check&#10;&#10;Refactor `FormActiveController` to return JSON responses using `BooleanResponse`. Introduce exception handling for JSON processing errors and update `FormActiveData` to allow object initialization without parameters." />
<MESSAGE value="Add branch condition to Discord notification stage&#10;&#10;The Discord notification stage now runs only on 'main' or 'master' branches. This helps to avoid unnecessary notifications for feature or bugfix branches." />
<option name="LAST_COMMIT_MESSAGE" value="Add branch condition to Discord notification stage&#10;&#10;The Discord notification stage now runs only on 'main' or 'master' branches. This helps to avoid unnecessary notifications for feature or bugfix branches." />
<MESSAGE value="Improve email handling with Mailable interface&#10;&#10;Added a new Mailable interface for extracting email-related data like receiver and subject. Updated StaffAppFormData and ContactFormData to implement this interface, and refactored MailForm to utilize these details. This enhances flexibility and decouples email details from form classes." />
<option name="LAST_COMMIT_MESSAGE" value="Improve email handling with Mailable interface&#10;&#10;Added a new Mailable interface for extracting email-related data like receiver and subject. Updated StaffAppFormData and ContactFormData to implement this interface, and refactored MailForm to utilize these details. This enhances flexibility and decouples email details from form classes." />
</component>
<component name="XSLT-Support.FileAssociations.UIState">
<expand />

View File

@ -18,25 +18,15 @@ public abstract class Form {
public String toHtml(String[] fields, String[] values) {
StringBuilder htmlOutput = new StringBuilder();
//language=HTML
htmlOutput.append("<table style='border-collapse: collapse; width: 100%;'>");
for (int i = 0; i < fields.length; i++) {
htmlOutput.append(
String.format(
//language=HTML
"""
<tr style='border: 1px solid #ddd;'>
<td style='border: 1px solid #ddd; padding: 10px; font-weight: bold;'>
%s
</td>
<td style='border: 1px solid #ddd; padding: 10px;'>
%s
</td>
</tr>
<p><strong>%s</strong></p>
<p>%s</p>
""", fields[i], values[i]));
}
//language=HTML
htmlOutput.append("</table>");
return htmlOutput.toString();
}