Project

General

Profile

Actions

Patch #42515

open

Reimplement partial quote feature using Stimulus

Added by Katsuya HIDAKA 2 months ago. Updated 14 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Code cleanup/refactoring
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

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 - Feature #42510: Add Stimulus as a Javascript frameworkClosedMarius BĂLTEANU

Actions
Actions #1

Updated by Katsuya HIDAKA 2 months ago

Implementation
  • 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.

Regarding the above, similar to the patch in #42510, it might be better to rename the existing app/assets/application.js to application-legacy.js. This could also serve as an explicit message to encourage migration to implementations using Stimulus or migration from app/assets/application.js.

Actions #3

Updated by Marius BĂLTEANU 2 months ago

  • Related to Feature #42510: Add Stimulus as a Javascript framework added
Actions #4

Updated by Marius BĂLTEANU 2 months ago

Thanks for your work and for the patches.

Let's discuss the integration of Stimulus in #42510 and then we can get back to this.

Actions #5

Updated by Katsuya HIDAKA about 1 month ago

I've updated the patch to re-implement the quote reply feature using Stimulus to the latest master branch, as Stimulus was introduced in #42510.

I have confirmed that this patch passes all tests, including system tests:
https://github.com/hidakatsuya/redmine/actions/runs/14954740472

Please review it. If it looks good, I would appreciate your commit.

Actions #6

Updated by Go MAEDA 25 days ago

  • Subject changed from Introduce Stimulus and reimplement partial quote feature to Reimplement partial quote feature using Stimulus
  • Category set to Code cleanup/refactoring
  • Target version set to 6.1.0

Setting the target version to 6.1.0.

Actions #7

Updated by Go MAEDA 18 days ago

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

After applying the latest version of Reimplement-partial-quote-feature-using-stimulus.patch, the quote button on issues stopped working in my environment. Could you please check the patch again to make sure it is working correctly?

Actions #8

Updated by Katsuya HIDAKA 18 days ago

Thank you for your feedback. I'll check the patch and address the issue.

Actions #9

Updated by Katsuya HIDAKA 18 days ago

When I applied Reimplement-partial-quote-feature-using-stimulus.patch attached in #note-5 in my environment, I encountered an error due to conflicts:

$ git apply Reimplement-partial-quote-feature-using-stimulus.patch
error: patch failed: app/helpers/journals_helper.rb:46
error: app/helpers/journals_helper.rb: patch does not apply
...

This conflict might be related to the issue you experienced with the quote button not working.

I resolved the conflicts and attached the updated patch. Could you please try it again?

In my environment, the quote button on issues works as expected. All tests, including system tests, are also passing:
https://github.com/hidakatsuya/redmine/actions/runs/15239419967/job/42857592412

Actions #10

Updated by Go MAEDA 14 days ago

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

Also available in: Atom PDF