Skip to content

Conversation

@aaronskiba
Copy link
Collaborator

Changes proposed in this PR:

Added

  • Add headers and "Show more templates" button to template dropdown #1215

Fixed

  • Edit request feedback email to send in app language #1227

Changed

  • Edit footer logos #1203

  • Reorganize template dropdown menu and refactor TemplateOptionsController #1199, #1229

  • Refactor: Consolidate repeated custom colour variables across stylesheets #1218

  • Update template validation on plan creation #1225

Dependency Updates

  • chore(deps): bump nginx from 1.29.1-alpine to 1.29.2-alpine #1207

  • chore(deps): bump docker/login-action from 3.5.0 to 3.6.0 #1197

  • chore(deps): bump rack from 2.2.14 to 2.2.18 #1195

dependabot bot and others added 30 commits October 8, 2025 16:06
Bumps nginx from 1.29.1-alpine to 1.29.2-alpine.

---
updated-dependencies:
- dependency-name: nginx
  dependency-version: 1.29.2-alpine
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
…ation/nginx-1.29.2-alpine

chore(deps): bump nginx from 1.29.1-alpine to 1.29.2-alpine
Bumps [docker/login-action](https://github.com/docker/login-action) from 3.5.0 to 3.6.0.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](docker/login-action@184bdaa...5e57cd1)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-version: 3.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
…s/integration/docker/login-action-3.6.0

chore(deps): bump docker/login-action from 3.5.0 to 3.6.0
- With these changes, if the chosen org is the Alliance, now the first two displayed templates are the Alliance Simplified and Alliance main templates
- The previous code incorrectly excluded org templates that were customizations of other templates. Now those templates are included at the top of the dropdown menu along with other org templates.
Simplified template loading logic by removing explicit default template handling.
- `Template.latest_customizable.where(org_id: funder.id)` and `Template.published.publicly_visible.where(org_id: funder.id, customization_of: nil)` now fetch the default template as well
- Removed manual insertion and filtering of the default template; `sort_templates()` now determines ordering.
The changes in a4fc95e require that the default template belong to the default org.
Reorganize template dropdown menu and refactor `TemplateOptionsController`
Consolidate repeated $color-alliance-* and related variables into `app/assets/stylesheets/dmp-assistant/variables/_colours.scss`.

This removes duplicate variables and centralises colour definitions for better maintainability and consistency across the app.
…ts-variables

Refactor: Consolidate repeated custom colour variables across stylesheets
- select_tag has an issue where a dropdown cannot be kept open after a button is clicked. In order for the "show more templates" button to eventually work intuitively, this behaviour has to be changed.
- Bootstrap dropdowns can be kept open after a certain selection, and so that was the chosen replacement.
- Edit toggleSubmit() so that both select tags and bootstrap dropdowns can still work with the function. The previous behaviour only worked with select tags.
- Edit the success() function to work with the bootstrap dropdown.
`Rails.application.config.default_funder_id` is used multiple times in this controller, so defining a variable for it is best practice.
- Templates will need to be tagged appropriately to allow for organization into groups with headers in the template dropdown.
- The tag_templates function is used to add a source tag to each template.
- All possible error conditions are checked at the beginning to simplify conditional logic.
- `templates` is defined as a variable for `data.templates`
- `only` variable is renamed to `only_template`
- Define arrays for ordering template groups
- Add appendGroup helper function to add templates to proper groups
aaronskiba and others added 27 commits November 10, 2025 14:10
These changes address an unnecessary number of templates being created inside the `before do` block. Some redundancies have been removed from the creation of `@extra_funder_template` as well.
- The previous hardcoded max-height was not working properly, as sometimes the dropdown's max height would extend past the footer.
- Helper function adjustDropdownMaxHeight() was added to dynamically assign the max-height to always be the middle of the footer.
- Function is called in success() after template dropdown becomes visible (as helper cannot work without the values from the DOM)
- Removed select_tag-specific code from toggleSubmit:
  - No longer checks `:selected` since `plan_template_id` is now a hidden field.
- Removed dead lines related to the old select_tag:
  - `$('#plan_template_id').find(':selected').removeAttr('selected')`
  - `$('#plan_template_id option').remove()`
- Simplifies and clarifies template selection handling with the new dropdown implementation.
- Removed `#research-org-controls input.autocomplete-result` change handler:
  - Its functionality is already handled by `handleComboboxChange`.
  - Avoids unnecessary JSON parsing and constant firing on every keystroke.

- Added `resetTemplateDropdown()` call inside `handleComboboxChange`:
  - Simplifies the function by removing explicit lines and instead handling them conditionally inside `resetTemplateDropdown()`
  - Consolidates template dropdown reset logic in a single place, reducing redundant event handlers.
Cache redundant DOM queries with variables

(In adjustDropdownMaxHeight) Replace redundant DOM queries with unwrapping cached jQuery objects using `.get(0)` (https://api.jquery.com/get/).
Instead of binding click handlers to each individual template item, this change creates a single delegated handler on `templateDropdownMenu`.
- Listens at the container level; clicks on child elements bubble up to the handler.
- Adds `data-title` attribute to template items. (Allows us to still set `templateDropdown.text(template.title)`)
- Improves performance and reduces memory usage.
- Consolidate all template dropdown height logic into `adjustDropdownMaxHeight()`.
- Simplifies `success()` by removing inline dropdown sizing logic.
- Stop using raw HTML templates for dropdown items.
- Use jQuery’s attribute map and `.text()` to properly escape content and keep `data-*` attributes on the element.
Refactored templateDropdown strings to support in-app translation.
- These values must be defined and translated on the Rails side first.
- Renamed `adjustDropdownMaxHeight()` to `resizeTemplateDropdownMenu()`
- Set templateDropdownMenu.outerWidth(templateDropdown.outerWidth()) to match dropdown button width, preventing resize when "Show more..." is clicked
- Simplified the `isVisible` check
- Updated template dropdown button ID and references from `templateDropdown` to `template-dropdown` for consistency with other selectors
`#available-templates` was momentarily visible before JavaScript hid it.
Set it hidden in the markup (`display: none`) to ensure it remains invisible until shown intentionally. This eliminates the visual flash during page load.
- Added isValidTemplateResponse helper to validate the structure and content of AJAX template responses.
- Checks now ensure `data.total_templates` is a number greater than 0 and that each template group (`org_templates`, `priority_templates`, `other_templates`) is an array.
- Added a guard to ensure onlyTemplate is defined before accessing its properties.
- Improves safety against malformed or unexpected server responses.
- Add extractTemplateData() helper to handle destructuring of total_templates and template groups (org_templates, priority_templates, other_templates).
- Now, rather than dealing with the template response structure, success() works with clearly defined variables returned from extractTemplateData().
Restrict templates that can be associated with newly created plans. Only templates that are published and unarchived are now allowed.
…ation-on-plan-creation

Update template validation on plan creation
…ments

Add headers and "Show more templates" button to template dropdown
- Previously, the delivered email was always translated to English.
- This fix makes sure the email is delivered in the app's current locale which is selected in the language dropdown
Edit request feedback email to send in app language
…emplate

- The previous behaviour was including the Alliance Simplified Template by only checking for the English template name, thus missing the template when the language was set to French.
…tion-fix

Fix template translation issue in `template_options_controller`
Fix long template titles extending past dropdown
@aaronskiba aaronskiba merged commit e81b5e7 into deployment-portage Nov 18, 2025
11 of 23 checks passed
@aaronskiba aaronskiba deleted the integration-copy branch November 18, 2025 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants