Project

General

Profile

Feature #42510

Updated by Marius BÄ‚LTEANU 3 days ago

"Stimulus":https://github.com/hotwired/stimulus-rails is part of the Rails ecosystem, it does not have a huge footprint and the integration is quite minimal. Also, it can be integrated incrementally in our existing code base without any breaking change. 

 In the community, there are a series of components that can be used in order to slowly drop the jQuery UI (at least) dependency. I'm not saying that just replacing jQuery UI with Stimulus is enough, but I think it can make our life easier.  

 Below some examples: 
 * https://www.stimulus-components.com/ 
 * https://github.com/lazaronixon/css-zero: these components are a front-end starter, but they are depending on Stimulus as well where JS is required.  

 I made also a basic patch that integrates Stimulus and rewrite the existing functionality of @copyTextToClipboard@ in Stimulus. 

 Katsuya HIDAKA written in #42515: 

 <pre> 

 This patch introduces "Stimulus":https://stimulus.hotwired.dev/, a JavaScript framework within the Rails ecosystem, and reimplements the partial quote feature added in #41294 using Stimulus. 

 h3. Why introduce Stimulus? 

 Here's why I propose introducing Stimulus: 

 * The current frontend JavaScript is becoming too complex and harder to develop. application.js is getting large, and everything operates in the global scope. 
 * It will make it easier to begin the migration from jQuery UI, which is no longer being developed. Stimulus helps create UI components in vanilla Rails, and many third-party components are also available. 
 * Stimulus works well with Turbo, which is a strong candidate to replace the deprecated rails-ujs, making future adoption smoother. 
 * Introducing a modern environment can revitalize Redmine development and simply make development more enjoyable. 

 As a next step after introducing Stimulus, I plan to migrate the tooltip implementation to Stimulus to further reduce the dependency on jQuery UI. 

 h3. Implementation 

 * importmap-rails was also introduced to install Stimulus and its necessary libraries. 
 * @bin/rails stimulus:install@ creates app/javascript/application.js by default. To avoid conflicts with the existing app/assets/application.js, I renamed the new file to main.js. 
 * turndown, which is used for the partial quote feature, is now also installed via importmap-rails. 
 * I confirmed that CI builds pass and all system tests are successful. 
 </pre>

Back