Skip to content

style: update SCSS and VTL files for improved layout and functionality#34535

Open
nicobytes wants to merge 4 commits intomainfrom
32651-edit-mode-the-redirect-url-field-in-edit-page-modal-cannot-be-cleared
Open

style: update SCSS and VTL files for improved layout and functionality#34535
nicobytes wants to merge 4 commits intomainfrom
32651-edit-mode-the-redirect-url-field-in-edit-page-modal-cannot-be-cleared

Conversation

@nicobytes
Copy link
Contributor

@nicobytes nicobytes commented Feb 6, 2026

This pull request updates several custom field templates in the DotCMS Velocity assets, focusing on improving code consistency, readability, and user experience. The main changes include significant refactoring of JavaScript and HTML for modern syntax, improved UI elements, and the addition of a Prettier configuration for formatting .vtl files.

Code and UI Modernization

  • Refactored JavaScript in *_new.vtl and *_old.vtl files for cachettl, og_preview, redirect, and template custom fields to use consistent double quotes, modern syntax, and improved formatting for better readability and maintainability. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]
  • Enhanced UI for the redirect custom field by adding a clear button to allow users to easily remove the redirect URL, improving accessibility and usability. [1] [2]

Conditional Parsing Simplification

  • Simplified the conditional parsing in several .vtl files (cachettl_custom_field.vtl, og_preview.vtl, redirect_custom_field.vtl, template_custom_field.vtl) by reducing Velocity syntax complexity, making the templates easier to maintain. [1] [2] [3] [4]

Styling Consistency

  • Improved CSS formatting in og_preview_new.vtl and updated selector in native-field.component.scss to ensure consistent styling and proper targeting of custom buttons. [1] [2] [3]

Tooling and Formatting

  • Added a Prettier configuration (.prettierrc.json) to ensure consistent formatting of .vtl files using the HTML parser, supporting future maintainability.

Minor Cleanups

  • Removed unnecessary whitespace and improved HTML structure in several templates for clarity. [1] [2]

These changes collectively modernize the codebase, enhance user experience, and streamline template maintenance.

This PR fixes: #32651

- Modified SCSS for native field component to include additional button class.
- Added Prettier configuration for VTL files to enforce HTML parsing.
- Refactored JavaScript in VTL files for cache TTL and redirect custom fields to enhance readability and maintainability.
- Updated OG preview VTL files to improve structure and styling consistency.
- Enhanced text count VTL files for better character counting functionality and UI presentation.
- Adjusted template custom field VTL files to streamline parsing logic.

These changes aim to improve the overall user experience and maintainability of the codebase.
- Updated multiple VTL files to improve consistency in parsing logic for new and old custom fields.
- Ensured proper indentation and formatting for better readability.
- Changes applied to cache TTL, OG preview, redirect, template, text count, and title custom field VTL files.

These modifications enhance maintainability and readability across the codebase.
- Deleted the `.prettierrc.json` file from the project as it is no longer needed for VTL file formatting.
- This change simplifies the project structure and removes unnecessary configuration files.
@nicobytes
Copy link
Contributor Author

QA notes:

Screenshot 2026-02-06 at 2 48 55 PM

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes several dotCMS Velocity custom-field templates used in HTML Page editing (both legacy Dojo and the newer DotCustomFieldApi-based edit mode), improves UI behavior (notably redirect clearing), and adds local formatting tooling for .vtl files. It also updates Angular styling rules so custom buttons in these fields are styled consistently.

Changes:

  • Refactors/normalizes JS + HTML/CSS formatting across multiple *_new.vtl and *_old.vtl custom field templates.
  • Enhances the redirect custom field UX by adding a dedicated “clear redirect” button in the new edit mode template.
  • Adds a local Prettier override for .vtl files and adjusts native-field SCSS button selector exclusions to accommodate new custom buttons.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
dotCMS/src/main/webapp/WEB-INF/velocity/static/htmlpage_assets/title_custom_field_old.vtl Reformats legacy Dojo-based title field JS and markup.
dotCMS/src/main/webapp/WEB-INF/velocity/static/htmlpage_assets/title_custom_field_new.vtl Updates new edit-mode title field wiring via DotCustomFieldApi.
dotCMS/src/main/webapp/WEB-INF/velocity/static/htmlpage_assets/title_custom_field.vtl Wrapper template selecting legacy vs new edit mode include.
dotCMS/src/main/webapp/WEB-INF/velocity/static/htmlpage_assets/text_count_old.vtl Reformats legacy text count UI and DotCustomFieldApi change handling.
dotCMS/src/main/webapp/WEB-INF/velocity/static/htmlpage_assets/text_count_new.vtl Reformats new edit-mode text count logic and markup.
dotCMS/src/main/webapp/WEB-INF/velocity/static/htmlpage_assets/text_count.vtl Wrapper template selecting legacy vs new edit mode include.
dotCMS/src/main/webapp/WEB-INF/velocity/static/htmlpage_assets/template_custom_field_old.vtl Refactors legacy template selector logic (Dojo + REST calls) for readability.
dotCMS/src/main/webapp/WEB-INF/velocity/static/htmlpage_assets/template_custom_field_new.vtl Maintains/expands custom dropdown template selector logic and styling in new edit mode.
dotCMS/src/main/webapp/WEB-INF/velocity/static/htmlpage_assets/template_custom_field.vtl Wrapper template selecting legacy vs new edit mode include.
dotCMS/src/main/webapp/WEB-INF/velocity/static/htmlpage_assets/redirect_custom_field_old.vtl Reformats legacy redirect field (Dojo FileBrowserDialog).
dotCMS/src/main/webapp/WEB-INF/velocity/static/htmlpage_assets/redirect_custom_field_new.vtl Adds clear button + refactors new redirect field modal handling.
dotCMS/src/main/webapp/WEB-INF/velocity/static/htmlpage_assets/redirect_custom_field.vtl Wrapper template selecting legacy vs new edit mode include.
dotCMS/src/main/webapp/WEB-INF/velocity/static/htmlpage_assets/og_preview_old.vtl Reformats legacy OG preview (Dojo dialog).
dotCMS/src/main/webapp/WEB-INF/velocity/static/htmlpage_assets/og_preview_new.vtl Updates new OG preview UI using <dialog> and DotCustomFieldApi.
dotCMS/src/main/webapp/WEB-INF/velocity/static/htmlpage_assets/og_preview.vtl Wrapper template selecting legacy vs new edit mode include.
dotCMS/src/main/webapp/WEB-INF/velocity/static/htmlpage_assets/cachettl_custom_field_old.vtl Reformats legacy cache TTL textbox wiring (Dojo).
dotCMS/src/main/webapp/WEB-INF/velocity/static/htmlpage_assets/cachettl_custom_field_new.vtl Refactors new cache TTL field binding via DotCustomFieldApi.
dotCMS/src/main/webapp/WEB-INF/velocity/static/htmlpage_assets/cachettl_custom_field.vtl Wrapper template selecting legacy vs new edit mode include.
dotCMS/src/main/webapp/WEB-INF/velocity/static/htmlpage_assets/.prettierrc.json Adds local Prettier override to format .vtl as HTML.
core-web/libs/edit-content/src/lib/fields/dot-edit-content-custom-field/components/native-field/native-field.component.scss Excludes .custom-button from generic button styling to support the new redirect clear button.

- Updated the OG preview close button in the VTL file to include an `aria-label` for improved accessibility.
- This change ensures that screen readers can properly identify the button's function, enhancing the user experience for visually impaired users.
Copy link
Member

@oidacra oidacra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nicobytes nicobytes enabled auto-merge February 6, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[Edit Mode] : The Redirect URL field in edit page modal cannot be cleared

3 participants