Skip to content

Refactor javascript in decidim core (Part 1)#15045

Merged
greenwoodt merged 38 commits intodecidim:developfrom
i-need-another-coffee:chore/refactor/js-bulk
Aug 14, 2025
Merged

Refactor javascript in decidim core (Part 1)#15045
greenwoodt merged 38 commits intodecidim:developfrom
i-need-another-coffee:chore/refactor/js-bulk

Conversation

@alecslupu
Copy link
Copy Markdown
Contributor

@alecslupu alecslupu commented Aug 7, 2025

🎩 What? Why?

As part of the Hotwire migration we are presenting this PR that performs the following:

  • makes sure that all the relevant forms in the application do implement the same way of generating forms (we had places where we used form_for and decidim_form_for). Now there is only one version allowed so that we can enforms inline for form validation
  • adds @hotwire/stimulus package, as it is needed for further operations
  • Converts some of the javascript classes from Jquery based to vanilla
  • Adds tests for the new classes
  • Converts some of the selectors to data-controller attribute
    • data-clipboard-copy becomes data-controller="clipboard-copy"
    • data-input-emoji becomes data-controller="emoji"
    • .old-user-password becomes data-controller="password-toggler"
    • data-scroll-last-child becomes data-controller="scroll-to-last"
    • data-sticky-buttons becomes data-controller="sticky-buttons"
    • data-sticky-header becomes data-controller="sticky-header"
    • .js-multiple-mentions becomes data-controller="multiple-mentions"
    • form validation is now being added with data-controller="form-validator"
    • .js-mentions becomes data-controller="mention"

📌 Related Issues

Link your PR to an issue

Testing

Each one of the commits have been tested and reviewed individually by @greenwoodt , so the only constraint is "green pipeline"

📷 Screenshots

Please add screenshots of the changes you are proposing
Description

♥️ Thank you!

@github-actions github-actions bot added module: core module: meetings type: internal PRs that aren't necessary to add to the CHANGELOG for implementers configuration labels Aug 7, 2025
github-actions[bot]
github-actions bot previously approved these changes Aug 7, 2025
github-actions[bot]
github-actions bot previously approved these changes Aug 7, 2025
github-actions[bot]
github-actions bot previously approved these changes Aug 7, 2025
@github-actions github-actions bot added the dependencies Pull requests that update a dependency file or issues that talk about updating dependencies label Aug 7, 2025
github-actions[bot]
github-actions bot previously approved these changes Aug 7, 2025
github-actions[bot]
github-actions bot previously approved these changes Aug 7, 2025
github-actions[bot]
github-actions bot previously approved these changes Aug 13, 2025
github-actions[bot]
github-actions bot previously approved these changes Aug 13, 2025
github-actions[bot]
github-actions bot previously approved these changes Aug 13, 2025
github-actions[bot]
github-actions bot previously approved these changes Aug 14, 2025
github-actions[bot]
github-actions bot previously approved these changes Aug 14, 2025
@greenwoodt greenwoodt self-assigned this Aug 14, 2025
@alecslupu alecslupu marked this pull request as ready for review August 14, 2025 09:31
@alecslupu alecslupu requested a review from Copilot August 14, 2025 10:03
Copy link
Copy Markdown
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 refactors JavaScript code in the Decidim core as part of the Hotwire migration. It standardizes form generation to use only decidim_form_for, adds @hotwire/stimulus package, and converts jQuery-based JavaScript classes to vanilla JS with Stimulus controllers.

  • Migrates legacy jQuery-based JavaScript components to Stimulus controllers
  • Standardizes form helpers to use decidim_form_for consistently
  • Adds extensive test coverage for new JavaScript classes

Reviewed Changes

Copilot reviewed 109 out of 114 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/webpacker/package.json Adds @hotwired/stimulus dependency
packages/core/package.json Removes @zeitiger/appendaround dependency
decidim-system/app/views Updates forms to use decidim_form_for and data-controller attributes
decidim-core/app/views Converts data attributes to use data-controller pattern
decidim-core/app/packs/src/decidim Removes legacy JavaScript files and adds Stimulus controllers

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Copy Markdown
Member

@greenwoodt greenwoodt left a comment

Choose a reason for hiding this comment

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

Merging with codecov failure.

image

@greenwoodt greenwoodt merged commit 812a6e3 into decidim:develop Aug 14, 2025
83 of 86 checks passed
@greenwoodt greenwoodt added the javascript Pull requests that update Javascript code label Aug 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

configuration dependencies Pull requests that update a dependency file or issues that talk about updating dependencies javascript Pull requests that update Javascript code module: accountability module: admin module: api module: budgets module: collaborative_texts module: comments module: core module: forms module: initiatives module: meetings module: proposals module: system type: internal PRs that aren't necessary to add to the CHANGELOG for implementers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants