Project

General

Profile

Actions

Patch #43276

closed

Replace the use of form.text_area with form.textarea

Added by Marius BĂLTEANU 9 months ago. Updated 9 days ago.

Status:
Closed
Priority:
Normal
Category:
Code cleanup/refactoring
Target version:

Description

Follow-up to #43268 to properly fix and align with the new naming from Rails.


Files

Actions #1

Updated by Marius BĂLTEANU 9 months ago

  • Status changed from New to Resolved
Actions #2

Updated by Marius BĂLTEANU 9 months ago

  • Status changed from Resolved to Closed
Actions #3

Updated by Go MAEDA 15 days ago

After r24030, some plugins no longer show labels for textarea fields when calling f.text_area with a label: option.

The root cause of this is rails/rails#52467, as described in #43268. In Rails 8, text_area was renamed to textarea in field_helpers, so LabelledFormBuilder no longer wraps text_area.

To keep existing plugins working without requiring each plugin to replace text_area with textarea, Redmine should patch lib/redmine/views/labelled_form_builder.rb to include text_area in the helper list.

The code that explicitly made text_area a target of LabelledFormBuilder was added in r24020, but it was removed in r24030 when all f.text_area usages in Redmine core were replaced with f.textarea. As a result, plugins that still use f.text_area lost label support. The attached patch restores the code removed in r24030.

Actions #4

Updated by Marius BĂLTEANU 14 days ago

Go MAEDA wrote in #note-3:

To keep existing plugins working without requiring each plugin to replace text_area with textarea, Redmine should patch lib/redmine/views/labelled_form_builder.rb to include text_area in the helper list.

The code that explicitly made text_area a target of LabelledFormBuilder was added in r24020, but it was removed in r24030 when all f.text_area usages in Redmine core were replaced with f.textarea. As a result, plugins that still use f.text_area lost label support. The attached patch restores the code removed in r24030.

This change will ship in a major version where some breaking changes are expected, and sooner or later, plugin developers must update their code to use textarea to remain compatible with core form builders. If preferred, we can deprecate the text_area method in 7.0 and fully remove it in 7.1 to ease the transition, even though the required code change is very minor.

Actions #5

Updated by Go MAEDA 14 days ago

Marius BĂLTEANU wrote in #note-4:

This change will ship in a major version where some breaking changes are expected, and sooner or later, plugin developers must update their code to use textarea to remain compatible with core form builders. If preferred, we can deprecate the text_area method in 7.0 and fully remove it in 7.1 to ease the transition, even though the required code change is very minor.

In Rails 8.0, text_area was renamed to textarea. However, text_area is still available as an alias and has not been deprecated. Therefore, I do not think third-party plugins need to migrate from text_area to textarea immediately.

Given this, it may be reasonable for Redmine's LabelledFormBuilder to continue supporting text_area at least until it is deprecated in Rails. Since Rails itself still provides text_area for compatibility, I think Redmine could also keep supporting it for the time being.

Actions #6

Updated by Marius BĂLTEANU 12 days ago

  • Status changed from Reopened to Closed

Thanks Go MAEDA, I've completely missed the alias. I've committed the change.

Actions #7

Updated by Go MAEDA 9 days ago

  • Subject changed from Replace the use of form.text_area with form.textarea to Replace the use of form.text_area with form.textarea
Actions

Also available in: Atom PDF