Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Use Settings::FormHelper in TextSettingComponent

Alexander Brandon Colese3c1fe90dc52
diff --git a/app/components/settings/text_setting_component.html.erb b/app/components/settings/text_setting_component.html.erb
index 9774f600168..534172f4f7e 100644
--- a/app/components/settings/text_setting_component.html.erb
+++ b/app/components/settings/text_setting_component.html.erb
@@ -31,7 +31,7 @@ See COPYRIGHT and LICENSE files for more details.
<div class="form--field">
<%= styled_label_tag "lang-for-#{name}" do %>
- <%= content_tag(:span, t("setting_#{name}"), class: "sr-only") %>
+ <%= content_tag(:span, setting_label(name), class: "sr-only") %>
<% end %>
<div class="form--field-container">
<%=
@@ -50,20 +50,20 @@ See COPYRIGHT and LICENSE files for more details.
<%=
hidden_field_tag(
"settings[#{name}][#{lang}]",
- Setting.send(name)[lang],
+ setting_value(name)[lang],
id: "lang-for-#{name}-#{lang}"
)
%>
<% end %>
<div class="form--field -visible-overflow">
- <%= styled_label_tag "settings-#{name}", t("setting_#{name}") %>
+ <%= styled_label_tag "settings-#{name}", setting_label(name) %>
<div class="form--field-container">
<%=
styled_text_area_tag(
"settings[#{name}][#{current_language}]",
- Setting.send(name)[current_language.to_s],
- disabled: !Setting.send(:"#{name}_writable?"),
+ setting_value(name)[current_language.to_s],
+ disabled: setting_disabled?(name),
label: false,
id: "settings-#{name}",
class: "wiki-edit",
diff --git a/app/components/settings/text_setting_component.rb b/app/components/settings/text_setting_component.rb
index 402e0407f80..6abb1a06778 100644
--- a/app/components/settings/text_setting_component.rb
+++ b/app/components/settings/text_setting_component.rb
@@ -33,6 +33,7 @@ module Settings
# A language switch and text area for updating a localized text setting.
class TextSettingComponent < ::ApplicationComponent
include OpenProject::FormTagHelper
+ include Settings::FormHelper
options :name # name of setting and tag to differentiate between different language selects