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

[#47014] Replace Settings::XxxSettingCell by ViewComponent

Dombi Attilafb18ddd9fd1f
diff --git a/app/cells/components/on_off_status_cell.rb b/app/cells/components/on_off_status_cell.rb
deleted file mode 100644
index 9b157e5eaed..00000000000
--- a/app/cells/components/on_off_status_cell.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-module Components
- ##
- # A language switch and text area for updating a localized text setting.
- class OnOffStatusCell < ::RailsCell
- options :on_text
- options :on_description
- options :off_text
- options :off_description
-
- options :is_on
-
- def enabled?
- !!model[:is_on]
- end
- end
-end
diff --git a/app/cells/settings/numeric_setting_cell.rb b/app/cells/settings/numeric_setting_cell.rb
deleted file mode 100644
index 20acc0d4420..00000000000
--- a/app/cells/settings/numeric_setting_cell.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-module Settings
- ##
- # A text field to enter numeric values.
- class NumericSettingCell < ::RailsCell
- include SettingsHelper
-
- options :unit, :title
- options size: 3
-
- # name of setting and tag
- def name
- model
- end
- end
-end
diff --git a/app/cells/settings/text_setting_cell.rb b/app/cells/settings/text_setting_cell.rb
deleted file mode 100644
index 5ed7aabf5cc..00000000000
--- a/app/cells/settings/text_setting_cell.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-module Settings
- ##
- # A language switch and text area for updating a localized text setting.
- class TextSettingCell < ::RailsCell
- include ActionView::Helpers::JavaScriptHelper
- include ActionView::Helpers::FormOptionsHelper
- include OpenProject::FormTagHelper
- include TextFormattingHelper
-
- options :name # name of setting and tag to differentiate between different language selects
-
- def current_language
- model
- end
- end
-end
diff --git a/app/cells/settings/time_zone_setting_cell.rb b/app/cells/settings/time_zone_setting_cell.rb
deleted file mode 100644
index 37f989aa94b..00000000000
--- a/app/cells/settings/time_zone_setting_cell.rb
+++ /dev/null
@@ -1,53 +0,0 @@
-module Settings
- ##
- # A text field to enter numeric values.
- class TimeZoneSettingCell < ::RailsCell
- include ActionView::Helpers::FormOptionsHelper
- include SettingsHelper
-
- options :form, :title
- options container_class: "-wide"
- options include_blank: true
-
- # name of setting and tag
- def name
- model
- end
-
- def render_select
- if form.nil?
- render_setting_select
- else
- render_form_select
- end
- end
-
- def render_form_select
- form.select(
- name,
- time_zone_entries,
- include_blank:,
- container_class:,
- title:
- )
- end
-
- def render_setting_select
- setting_select(
- name,
- time_zone_entries,
- include_blank:,
- container_class:,
- title:
- )
- end
-
- def time_zone_entries
- UserPreferences::UpdateContract
- .assignable_time_zones
- .map do |tz|
- [tz.to_s, tz.tzinfo.canonical_identifier]
- end
- end
- end
-end
diff --git a/app/cells/views/components/on_off_status/show.erb b/app/cells/views/components/on_off_status/show.erb
deleted file mode 100644
index 3bf594d4933..00000000000
--- a/app/cells/views/components/on_off_status/show.erb
+++ /dev/null
@@ -1,19 +0,0 @@
-<%# The javscript for this cell is included in `settings.js.erb`. %>
-
-<div class="on-off-status-cell">
- <% if enabled? %>
- <span class="on-off-status -enabled">
- <%= op_icon 'icon-yes' %>
- <%= model[:on_text] %>
- </span>
- <p>
- <%= model[:on_description] %>
- </p>
- <% else %>
- <span class="on-off-status -disabled">
- <%= op_icon 'icon-not-supported' %>
- <%= model[:off_text] %>
- </span>
- <p><%= model[:off_description] %></p>
- <% end %>
-</div>
diff --git a/app/cells/views/settings/numeric_setting/show.erb b/app/cells/views/settings/numeric_setting/show.erb
deleted file mode 100644
index 1d1496a7630..00000000000
--- a/app/cells/views/settings/numeric_setting/show.erb
+++ /dev/null
@@ -1,11 +0,0 @@
-<div class="form--field">
- <%=
- setting_text_field(
- name,
- size: size,
- unit: t("label_#{unit.singularize}_plural"),
- container_class: '-xslim',
- title: title
- )
- %>
-</div>
diff --git a/app/cells/views/settings/text_setting/show.erb b/app/cells/views/settings/text_setting/show.erb
deleted file mode 100644
index a81d84a03f1..00000000000
--- a/app/cells/views/settings/text_setting/show.erb
+++ /dev/null
@@ -1,45 +0,0 @@
-<%# The javscript for this cell is included in `settings.js.erb`. %>
-
-<div class="form--field">
- <%# Empty label for styling only %>
- <%= styled_label_tag "lang", '' %>
- <div class="form--field-container">
- <%=
- styled_select_tag(
- "lang",
- options_for_select(lang_options_for_select(false), current_language.to_s),
- id: "lang-for-#{name}",
- class: "lang-select-switch",
- container_class: '-slim'
- )
- %>
- </div>
-</div>
-
-<% Setting.available_languages.each do |lang| %>
- <%=
- hidden_field_tag(
- "settings[#{name}][#{lang}]",
- Setting.send(name)[lang],
- id: "lang-for-#{name}-#{lang}"
- )
- %>
-<% end %>
-
-<div class="form--field -visible-overflow">
- <%= styled_label_tag "settings[#{name}]", t("setting_#{name}") %>
- <div class="form--field-container">
- <%=
- styled_text_area_tag(
- "settings[#{name}][#{current_language.to_s}]",
- Setting.send(name)[current_language.to_s],
- label: false,
- id: "settings-#{name}",
- class: 'wiki-edit',
- with_text_formatting: true,
- rows: 5,
- container_class: '-xxwide'
- )
- %>
- </div>
-</div>
diff --git a/app/cells/views/settings/time_zone_setting/show.erb b/app/cells/views/settings/time_zone_setting/show.erb
deleted file mode 100644
index 15e215a2610..00000000000
--- a/app/cells/views/settings/time_zone_setting/show.erb
+++ /dev/null
@@ -1,3 +0,0 @@
-<div class="form--field">
- <%= render_select %>
-</div>
diff --git a/app/components/components/on_off_status_component.html.erb b/app/components/components/on_off_status_component.html.erb
new file mode 100644
index 00000000000..085b2dd60cb
--- /dev/null
+++ b/app/components/components/on_off_status_component.html.erb
@@ -0,0 +1,48 @@
+<%#-- copyright
+OpenProject is an open source project management software.
+Copyright (C) 2012-2023 the OpenProject GmbH
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License version 3.
+
+OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+Copyright (C) 2006-2013 Jean-Philippe Lang
+Copyright (C) 2010-2013 the ChiliProject Team
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+See COPYRIGHT and LICENSE files for more details.
+
+++#%>
+
+<%# The javscript for this cell is included in `settings.js.erb`. %>
+
+<div class="on-off-status-cell">
+ <% if enabled? %>
+ <span class="on-off-status -enabled">
+ <%= op_icon 'icon-yes' %>
+ <%= model[:on_text] %>
+ </span>
+ <p>
+ <%= model[:on_description] %>
+ </p>
+ <% else %>
+ <span class="on-off-status -disabled">
+ <%= op_icon 'icon-not-supported' %>
+ <%= model[:off_text] %>
+ </span>
+ <p><%= model[:off_description] %></p>
+ <% end %>
+</div>
diff --git a/app/components/components/on_off_status_component.rb b/app/components/components/on_off_status_component.rb
new file mode 100644
index 00000000000..5b6fd051afa
--- /dev/null
+++ b/app/components/components/on_off_status_component.rb
@@ -0,0 +1,46 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2023 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+module Components
+ ##
+ # A language switch and text area for updating a localized text setting.
+ class OnOffStatusComponent < ::RailsComponent
+ options :on_text
+ options :on_description
+ options :off_text
+ options :off_description
+
+ options :is_on
+
+ def enabled?
+ !!model[:is_on]
+ end
+ end
+end
diff --git a/app/components/individual_principal_base_filter_component.rb b/app/components/individual_principal_base_filter_component.rb
index 5e1eb9bd369..0e8de2a9807 100644
--- a/app/components/individual_principal_base_filter_component.rb
+++ b/app/components/individual_principal_base_filter_component.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
diff --git a/app/components/settings/numeric_setting_component.html.erb b/app/components/settings/numeric_setting_component.html.erb
new file mode 100644
index 00000000000..4e9297d6ca5
--- /dev/null
+++ b/app/components/settings/numeric_setting_component.html.erb
@@ -0,0 +1,40 @@
+<%#-- copyright
+OpenProject is an open source project management software.
+Copyright (C) 2012-2023 the OpenProject GmbH
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License version 3.
+
+OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+Copyright (C) 2006-2013 Jean-Philippe Lang
+Copyright (C) 2010-2013 the ChiliProject Team
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+See COPYRIGHT and LICENSE files for more details.
+
+++#%>
+
+<div class="form--field">
+ <%=
+ setting_text_field(
+ name,
+ size: size,
+ unit: t("label_#{unit.singularize}_plural"),
+ container_class: '-xslim',
+ title: title
+ )
+ %>
+</div>
diff --git a/app/components/settings/numeric_setting_component.rb b/app/components/settings/numeric_setting_component.rb
new file mode 100644
index 00000000000..e7bb7a27f07
--- /dev/null
+++ b/app/components/settings/numeric_setting_component.rb
@@ -0,0 +1,45 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2023 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+module Settings
+ ##
+ # A text field to enter numeric values.
+ class NumericSettingComponent < ::RailsComponent
+ include SettingsHelper
+
+ options :unit, :title
+ options size: 3
+
+ # name of setting and tag
+ def name
+ model
+ end
+ end
+end
diff --git a/app/components/settings/text_setting_component.html.erb b/app/components/settings/text_setting_component.html.erb
new file mode 100644
index 00000000000..e615c88f6de
--- /dev/null
+++ b/app/components/settings/text_setting_component.html.erb
@@ -0,0 +1,74 @@
+<%#-- copyright
+OpenProject is an open source project management software.
+Copyright (C) 2012-2023 the OpenProject GmbH
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License version 3.
+
+OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+Copyright (C) 2006-2013 Jean-Philippe Lang
+Copyright (C) 2010-2013 the ChiliProject Team
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+See COPYRIGHT and LICENSE files for more details.
+
+++#%>
+
+<%# The javscript for this component is included in `settings.js.erb`. %>
+
+<div class="form--field">
+ <%# Empty label for styling only %>
+ <%= styled_label_tag "lang", '' %>
+ <div class="form--field-container">
+ <%=
+ styled_select_tag(
+ "lang",
+ options_for_select(lang_options_for_select(false), current_language.to_s),
+ id: "lang-for-#{name}",
+ class: "lang-select-switch",
+ container_class: '-slim'
+ )
+ %>
+ </div>
+</div>
+
+<% Setting.available_languages.each do |lang| %>
+ <%=
+ hidden_field_tag(
+ "settings[#{name}][#{lang}]",
+ Setting.send(name)[lang],
+ id: "lang-for-#{name}-#{lang}"
+ )
+ %>
+<% end %>
+
+<div class="form--field -visible-overflow">
+ <%= styled_label_tag "settings[#{name}]", t("setting_#{name}") %>
+ <div class="form--field-container">
+ <%=
+ styled_text_area_tag(
+ "settings[#{name}][#{current_language.to_s}]",
+ Setting.send(name)[current_language.to_s],
+ label: false,
+ id: "settings-#{name}",
+ class: 'wiki-edit',
+ with_text_formatting: true,
+ rows: 5,
+ container_class: '-xxwide'
+ )
+ %>
+ </div>
+</div>
diff --git a/app/components/settings/text_setting_component.rb b/app/components/settings/text_setting_component.rb
new file mode 100644
index 00000000000..b87c9c4daa7
--- /dev/null
+++ b/app/components/settings/text_setting_component.rb
@@ -0,0 +1,46 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2023 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+module Settings
+ ##
+ # A language switch and text area for updating a localized text setting.
+ class TextSettingComponent < ::RailsComponent
+ include ActionView::Helpers::JavaScriptHelper
+ include ActionView::Helpers::FormOptionsHelper
+ include OpenProject::FormTagHelper
+ include TextFormattingHelper
+
+ options :name # name of setting and tag to differentiate between different language selects
+
+ def current_language
+ model
+ end
+ end
+end
diff --git a/app/components/settings/time_zone_setting_component.html.erb b/app/components/settings/time_zone_setting_component.html.erb
new file mode 100644
index 00000000000..9e900b29577
--- /dev/null
+++ b/app/components/settings/time_zone_setting_component.html.erb
@@ -0,0 +1,32 @@
+<%#-- copyright
+OpenProject is an open source project management software.
+Copyright (C) 2012-2023 the OpenProject GmbH
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License version 3.
+
+OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+Copyright (C) 2006-2013 Jean-Philippe Lang
+Copyright (C) 2010-2013 the ChiliProject Team
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+See COPYRIGHT and LICENSE files for more details.
+
+++#%>
+
+<div class="form--field">
+ <%= render_select %>
+</div>
diff --git a/app/components/settings/time_zone_setting_component.rb b/app/components/settings/time_zone_setting_component.rb
new file mode 100644
index 00000000000..40aeb90fedd
--- /dev/null
+++ b/app/components/settings/time_zone_setting_component.rb
@@ -0,0 +1,83 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2023 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+module Settings
+ ##
+ # A text field to enter numeric values.
+ class TimeZoneSettingComponent < ::RailsComponent
+ include ActionView::Helpers::FormOptionsHelper
+ include SettingsHelper
+
+ options :form, :title
+ options container_class: "-wide"
+ options include_blank: true
+
+ # name of setting and tag
+ def name
+ model
+ end
+
+ def render_select
+ if form.nil?
+ render_setting_select
+ else
+ render_form_select
+ end
+ end
+
+ def render_form_select
+ form.select(
+ name,
+ time_zone_entries,
+ include_blank:,
+ container_class:,
+ title:
+ )
+ end
+
+ def render_setting_select
+ setting_select(
+ name,
+ time_zone_entries,
+ include_blank:,
+ container_class:,
+ title:
+ )
+ end
+
+ def time_zone_entries
+ UserPreferences::UpdateContract
+ .assignable_time_zones
+ .map do |tz|
+ [tz.to_s, tz.tzinfo.canonical_identifier]
+ end
+ end
+ end
+end
diff --git a/app/views/admin/settings/authentication_settings/show.html.erb b/app/views/admin/settings/authentication_settings/show.html.erb
index 0182d1cb2e9..8c6c011fd91 100644
--- a/app/views/admin/settings/authentication_settings/show.html.erb
+++ b/app/views/admin/settings/authentication_settings/show.html.erb
@@ -49,12 +49,12 @@ See COPYRIGHT and LICENSE files for more details.
</fieldset>
<% if OpenProject::Configuration.registration_footer.blank? %>
- <%= rails_cell Settings::NumericSettingCell, "invitation_expiration_days", unit: "days" %>
+ <%= render Settings::NumericSettingComponent.new("invitation_expiration_days", unit: "days") %>
<fieldset class="form--fieldset">
<fieldset id="registration_footer" class="form--fieldset">
<legend class="form--fieldset-legend"><%= I18n.t(:setting_registration_footer) %></legend>
- <%= rails_cell Settings::TextSettingCell, I18n.locale, name: "registration_footer" %>
+ <%= render Settings::TextSettingComponent.new(I18n.locale, name: "registration_footer") %>
</fieldset>
</fieldset>
<% end %>
diff --git a/app/views/admin/settings/mail_notifications_settings/show.html.erb b/app/views/admin/settings/mail_notifications_settings/show.html.erb
index 81c141b646e..4e275a2dce8 100644
--- a/app/views/admin/settings/mail_notifications_settings/show.html.erb
+++ b/app/views/admin/settings/mail_notifications_settings/show.html.erb
@@ -40,8 +40,8 @@ See COPYRIGHT and LICENSE files for more details.
</section>
<fieldset id="emails_decorators" class="form--fieldset"><legend class="form--fieldset-legend"><%= t(:setting_emails_header) %> & <%= t(:setting_emails_footer) %></legend>
- <%= rails_cell Settings::TextSettingCell, I18n.locale, name: "emails_header" %>
- <%= rails_cell Settings::TextSettingCell, I18n.locale, name: "emails_footer" %>
+ <%= render Settings::TextSettingComponent.new(I18n.locale, name: "emails_header") %>
+ <%= render Settings::TextSettingComponent.new(I18n.locale, name: "emails_footer") %>
</fieldset>
<% else %>
<div class="nodata">
diff --git a/app/views/admin/settings/users_settings/show.html.erb b/app/views/admin/settings/users_settings/show.html.erb
index ee6604eacf8..77334f3340e 100644
--- a/app/views/admin/settings/users_settings/show.html.erb
+++ b/app/views/admin/settings/users_settings/show.html.erb
@@ -39,13 +39,11 @@ See COPYRIGHT and LICENSE files for more details.
<%= setting_select :default_language, all_lang_options_for_select(false), container_class: '-slim' %>
</div>
- <%=
- cell(
- Settings::TimeZoneSettingCell,
+ <%= render Settings::TimeZoneSettingComponent.new(
"user_default_timezone",
container_class: "-slim",
title: I18n.t("tooltip_user_default_timezone")
- )
+ )
%>
<div class="form--field">
@@ -71,7 +69,7 @@ See COPYRIGHT and LICENSE files for more details.
<%= setting_check_box :consent_required %>
</div>
- <%= rails_cell Settings::TextSettingCell, I18n.locale, name: "consent_info" %>
+ <%= render Settings::TextSettingComponent.new(I18n.locale, name: "consent_info") %>
<div class="form--field">
<%= setting_block("consent_time") do %>
diff --git a/app/views/users/_consent.html.erb b/app/views/users/_consent.html.erb
index 7209052484c..38901662394 100644
--- a/app/views/users/_consent.html.erb
+++ b/app/views/users/_consent.html.erb
@@ -1,11 +1,10 @@
<section class="form--section">
<h3 class="form--section-title"><%=t('consent.title')%></h3>
- <%= rails_cell ::Components::OnOffStatusCell,
- {
- is_on: @user.consented_at.present?,
- on_text: format_time(@user.consented_at),
- on_description: t('consent.user_has_consented'),
- off_text: t(:label_never),
- off_description: t('consent.not_yet_consented')
- } %>
+ <%= render ::Components::OnOffStatusComponent.new({
+ is_on: @user.consented_at.present?,
+ on_text: format_time(@user.consented_at),
+ on_description: t('consent.user_has_consented'),
+ off_text: t(:label_never),
+ off_description: t('consent.not_yet_consented')
+ }) %>
</section>
diff --git a/app/views/users/_preferences.html.erb b/app/views/users/_preferences.html.erb
index 70714aa86a7..cb475eb1306 100644
--- a/app/views/users/_preferences.html.erb
+++ b/app/views/users/_preferences.html.erb
@@ -27,13 +27,11 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
<%= fields_for :pref, @user.pref, builder: TabularFormBuilder, lang: current_language do |pref_fields| %>
- <%=
- cell(
- Settings::TimeZoneSettingCell,
- "time_zone",
- form: pref_fields,
- container_class: (defined? input_size) ? "-#{input_size}" : "-wide"
- )
+ <%= render Settings::TimeZoneSettingComponent.new(
+ "time_zone",
+ form: pref_fields,
+ container_class: (defined? input_size) ? "-#{input_size}" : "-wide"
+ )
%>
<div class="form--field">
<%= pref_fields.select :comments_sorting,
diff --git a/modules/two_factor_authentication/app/views/two_factor_authentication/my/two_factor_devices/_two_factor_status.html.erb b/modules/two_factor_authentication/app/views/two_factor_authentication/my/two_factor_devices/_two_factor_status.html.erb
index 29632a502ce..2f02d4b01c4 100644
--- a/modules/two_factor_authentication/app/views/two_factor_authentication/my/two_factor_devices/_two_factor_status.html.erb
+++ b/modules/two_factor_authentication/app/views/two_factor_authentication/my/two_factor_devices/_two_factor_status.html.erb
@@ -1,8 +1,7 @@
-<%= rails_cell ::Components::OnOffStatusCell,
- { is_on: device.present?,
- on_text: t('two_factor_authentication.label_2fa_enabled'),
- on_description: t('two_factor_authentication.text_2fa_enabled'),
- off_text: t('two_factor_authentication.label_2fa_disabled'),
- off_description: t('two_factor_authentication.text_2fa_disabled')
- }%>
-
+<%= render ::Components::OnOffStatusComponent.new({
+ is_on: device.present?,
+ on_text: t('two_factor_authentication.label_2fa_enabled'),
+ on_description: t('two_factor_authentication.text_2fa_enabled'),
+ off_text: t('two_factor_authentication.label_2fa_disabled'),
+ off_description: t('two_factor_authentication.text_2fa_disabled')
+ })%>
diff --git a/modules/two_factor_authentication/app/views/users/_two_factor_authentication_admin.html.erb b/modules/two_factor_authentication/app/views/users/_two_factor_authentication_admin.html.erb
index c2eb727661a..ff8a4a42075 100644
--- a/modules/two_factor_authentication/app/views/users/_two_factor_authentication_admin.html.erb
+++ b/modules/two_factor_authentication/app/views/users/_two_factor_authentication_admin.html.erb
@@ -2,14 +2,13 @@
<% default_device = @user.otp_devices.get_default %>
<section class="admin--edit-section">
- <%= rails_cell ::Components::OnOffStatusCell,
- {
- is_on: default_device.present?,
- on_text: t('two_factor_authentication.label_2fa_enabled'),
- on_description: t('two_factor_authentication.admin.text_2fa_enabled'),
- off_text: t('two_factor_authentication.label_2fa_disabled'),
- off_description: t('two_factor_authentication.admin.text_2fa_disabled')
- }%>
+ <%= render ::Components::OnOffStatusComponent.new({
+ is_on: default_device.present?,
+ on_text: t('two_factor_authentication.label_2fa_enabled'),
+ on_description: t('two_factor_authentication.admin.text_2fa_enabled'),
+ off_text: t('two_factor_authentication.label_2fa_disabled'),
+ off_description: t('two_factor_authentication.admin.text_2fa_disabled')
+ })%>
</section>
<section class="admin--edit-section">
diff --git a/modules/webhooks/app/views/webhooks/outgoing/admin/show.html.erb b/modules/webhooks/app/views/webhooks/outgoing/admin/show.html.erb
index a27ccb877b2..035f63bdc8c 100644
--- a/modules/webhooks/app/views/webhooks/outgoing/admin/show.html.erb
+++ b/modules/webhooks/app/views/webhooks/outgoing/admin/show.html.erb
@@ -25,14 +25,13 @@
</li>
<% end %>
-<%= rails_cell ::Components::OnOffStatusCell,
- {
- is_on: @webhook.enabled?,
- on_text: t('webhooks.outgoing.status.enabled'),
- on_description: t('webhooks.outgoing.status.enabled_text'),
- off_text: t('webhooks.outgoing.status.disabled'),
- off_description: t('webhooks.outgoing.status.disabled_text')
- } %>
+<%= render ::Components::OnOffStatusComponent.new({
+ is_on: @webhook.enabled?,
+ on_text: t('webhooks.outgoing.status.enabled'),
+ on_description: t('webhooks.outgoing.status.enabled_text'),
+ off_text: t('webhooks.outgoing.status.disabled'),
+ off_description: t('webhooks.outgoing.status.disabled_text')
+ }) %>
<div class="account--section">
<div class="attributes-group">