Project

General

Profile

Actions

Feature #42510

open

Add Stimulus as a Javascript framework

Added by Marius BĂLTEANU 24 days ago. Updated 6 days ago.

Status:
New
Priority:
Normal
Category:
Gems support
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed

Description

Stimulus 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:

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

Katsuya HIDAKA written in #42515:

This patch introduces Stimulus, a JavaScript framework within the Rails ecosystem, and reimplements the partial quote feature added in #41294 using Stimulus.

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.

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.

Files


Related issues

Related to Redmine - Patch #42515: Introduce Stimulus and reimplement partial quote featureNew

Actions
Related to Redmine - Patch #42521: Reimplement modal dialog with StimulusNew

Actions
Related to Redmine - Feature #35536: Use webpack to improve javascripts and stylesheets managementClosed

Actions
Related to Redmine - Feature #30486: Convert all jQuery to ECMA ScriptClosedMarius BĂLTEANU

Actions
Actions #1

Updated by Marius BĂLTEANU 24 days ago

  • Description updated (diff)
Actions #2

Updated by Katsuya HIDAKA 22 days ago

I strongly support the introduction of Stimulus. I have created #42515 to reimplement the existing quote reply functionality using Stimulus. I would appreciate your feedback.

Actions #3

Updated by Marius BĂLTEANU 21 days ago

  • Related to Patch #42515: Introduce Stimulus and reimplement partial quote feature added
Actions #4

Updated by Marius BĂLTEANU 21 days ago

Katsuya HIDAKA, I've update the description of this issue with the one provided by you in #42515.

I'm in favour of this move, but being quite an important change, I would like to get feedback from Go MAEDA and someone from Plan.io (Holger Just). Once we decide to integrate this, we can move on to the tickets that rewrite existing functionality.

I've created a patch that only integrates Stimulus without any other change.

Actions #5

Updated by Marius BĂLTEANU 21 days ago

  • Related to Patch #42521: Reimplement modal dialog with Stimulus added
Actions #6

Updated by Go MAEDA 16 days ago

I am strongly in favor of introducing Stimulus. It is a well-established JavaScript framework that has matured over the years and is now the standard in Rails.

Using Stimulus for new JavaScript code and gradually replacing existing jQuery and jQuery UI code is a practical approach.

I believe this change will help improve Redmine's user interface and user experience.

Actions #7

Updated by Marius BĂLTEANU 16 days ago

  • Target version changed from Candidate for next major release to 6.1.0
Actions #8

Updated by Holger Just 12 days ago

  • Description updated (diff)
Actions #9

Updated by Jens Krämer 11 days ago

We've had a chat about this at Planio and consensus was that introducing Stimulus for new functionality and, over time, migrating existing features from JQuery / JQueryUI to Stimulus seems to be a good course of action.

Actions #10

Updated by Marius BĂLTEANU 6 days ago

  • Subject changed from Evaluate the option to add Stimulus as a Javascript framework to Add Stimulus as a Javascript framework
  • Category set to Gems support
Actions #11

Updated by Marius BĂLTEANU 6 days ago

  • Status changed from New to Resolved
Actions #12

Updated by Marius BĂLTEANU 6 days ago

  • Resolution set to Fixed
Actions #13

Updated by Marius BĂLTEANU 6 days ago

  • Status changed from Resolved to New

I've committed the first patch that adds Stimulus to the core. Thanks Go MAEDA and Jens Krämer for supporting this!

I keep this open in order to provide details for plugins developers.

Actions #14

Updated by Marius BĂLTEANU 6 days ago

  • Related to Feature #35536: Use webpack to improve javascripts and stylesheets management added
Actions #15

Updated by Marius BĂLTEANU 6 days ago

Actions

Also available in: Atom PDF