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

Common form component

Oliver Günther5232f3783019
diff --git a/modules/auth_saml/app/components/saml/providers/sections/configuration_form_component.html.erb b/modules/auth_saml/app/components/saml/providers/sections/configuration_form_component.html.erb
deleted file mode 100644
index e31e20b07a2..00000000000
--- a/modules/auth_saml/app/components/saml/providers/sections/configuration_form_component.html.erb
+++ /dev/null
@@ -1,24 +0,0 @@
-<%=
- primer_form_with(
- model: provider,
- url: saml_provider_path(provider, state: :configuration),
- method: :put
- ) do |form|
- flex_layout do |flex|
- flex.with_row do
- render(Primer::Beta::Text.new(tag: :p, mb: 4, font_size: :small)) do
- t("saml.providers.section_texts.metadata_form")
- end
- end
-
- flex.with_row do
- render(Saml::Providers::ConfigurationForm.new(form, provider:))
- end
-
- flex.with_row(mt: 4) do
- render(Saml::Providers::SubmitOrCancelForm.new(form,
- provider:))
- end
- end
- end
-%>
diff --git a/modules/auth_saml/app/components/saml/providers/sections/encryption_form_component.html.erb b/modules/auth_saml/app/components/saml/providers/sections/encryption_form_component.html.erb
deleted file mode 100644
index e6cbdf4dd7b..00000000000
--- a/modules/auth_saml/app/components/saml/providers/sections/encryption_form_component.html.erb
+++ /dev/null
@@ -1,24 +0,0 @@
-<%=
- primer_form_with(
- model: provider,
- url: saml_provider_path(provider, state: :encryption),
- method: :put
- ) do |form|
- flex_layout do |flex|
- flex.with_row do
- render(Primer::Beta::Text.new(tag: :p, mb: 4, font_size: :small)) do
- t("saml.providers.section_texts.encryption_form")
- end
- end
-
- flex.with_row do
- render(Saml::Providers::EncryptionForm.new(form, provider:))
- end
-
- flex.with_row(mt: 4) do
- render(Saml::Providers::SubmitOrCancelForm.new(form,
- provider:))
- end
- end
- end
-%>
diff --git a/modules/auth_saml/app/components/saml/providers/sections/encryption_form_component.rb b/modules/auth_saml/app/components/saml/providers/sections/encryption_form_component.rb
deleted file mode 100644
index 9b904da0aff..00000000000
--- a/modules/auth_saml/app/components/saml/providers/sections/encryption_form_component.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-# frozen_string_literal: true
-
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) 2012-2024 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 Saml::Providers::Sections
- class EncryptionFormComponent < SectionComponent
- end
-end
diff --git a/modules/auth_saml/app/components/saml/providers/sections/mapping_form_component.html.erb b/modules/auth_saml/app/components/saml/providers/sections/form_component.html.erb
similarity index 53%
rename from modules/auth_saml/app/components/saml/providers/sections/mapping_form_component.html.erb
rename to modules/auth_saml/app/components/saml/providers/sections/form_component.html.erb
index 6717765444a..5a7c0dce3f0 100644
--- a/modules/auth_saml/app/components/saml/providers/sections/mapping_form_component.html.erb
+++ b/modules/auth_saml/app/components/saml/providers/sections/form_component.html.erb
@@ -1,18 +1,20 @@
<%=
primer_form_with(
model: provider,
- url: saml_provider_path(provider, state: :mapping),
- method: :put
+ url:,
+ method: form_method,
) do |form|
flex_layout do |flex|
- flex.with_row do
- render(Primer::Beta::Text.new(tag: :p, mb: 4, font_size: :small)) do
- t("saml.instructions.mapping")
+ if @heading
+ flex.with_row do
+ render(Primer::Beta::Text.new(tag: :p, mb: 4, font_size: :small)) do
+ @heading
+ end
end
end
flex.with_row do
- render(Saml::Providers::MappingForm.new(form, provider:))
+ render(@form_class.new(form, provider:))
end
flex.with_row(mt: 4) do
diff --git a/modules/auth_saml/app/components/saml/providers/sections/configuration_form_component.rb b/modules/auth_saml/app/components/saml/providers/sections/form_component.rb
similarity index 71%
rename from modules/auth_saml/app/components/saml/providers/sections/configuration_form_component.rb
rename to modules/auth_saml/app/components/saml/providers/sections/form_component.rb
index dd773546a62..bcf8541645a 100644
--- a/modules/auth_saml/app/components/saml/providers/sections/configuration_form_component.rb
+++ b/modules/auth_saml/app/components/saml/providers/sections/form_component.rb
@@ -29,6 +29,29 @@
#++
#
module Saml::Providers::Sections
- class ConfigurationFormComponent < SectionComponent
+ class FormComponent < SectionComponent
+ def initialize(provider, edit_state:, form_class:, heading:)
+ super(provider)
+
+ @edit_state = edit_state
+ @form_class = form_class
+ @heading = heading
+ end
+
+ def url
+ if provider.new_record?
+ saml_providers_path(state: @edit_state)
+ else
+ saml_provider_path(provider, state: @edit_state)
+ end
+ end
+
+ def form_method
+ if provider.new_record?
+ :post
+ else
+ :put
+ end
+ end
end
end
diff --git a/modules/auth_saml/app/components/saml/providers/sections/metadata_form_component.html.erb b/modules/auth_saml/app/components/saml/providers/sections/metadata_form_component.html.erb
index 09b26b4060e..d51dbe4ef8b 100644
--- a/modules/auth_saml/app/components/saml/providers/sections/metadata_form_component.html.erb
+++ b/modules/auth_saml/app/components/saml/providers/sections/metadata_form_component.html.erb
@@ -19,11 +19,11 @@
end
flex.with_row(mt: 2, hidden: !provider.has_metadata?, data: { 'show-when-checked-target': "effect" }) do
- render(Saml::Providers::MetadataUrlForm.new(form))
+ render(Saml::Providers::MetadataUrlForm.new(form, provider:))
end
flex.with_row(mt: 2, hidden: !provider.has_metadata?, data: { 'show-when-checked-target': "effect" }) do
- render(Saml::Providers::MetadataXmlForm.new(form))
+ render(Saml::Providers::MetadataXmlForm.new(form, provider:))
end
flex.with_row(mt: 4) do
diff --git a/modules/auth_saml/app/components/saml/providers/sections/name_form_component.html.erb b/modules/auth_saml/app/components/saml/providers/sections/name_form_component.html.erb
deleted file mode 100644
index b02055fa094..00000000000
--- a/modules/auth_saml/app/components/saml/providers/sections/name_form_component.html.erb
+++ /dev/null
@@ -1,17 +0,0 @@
-<%=
- primer_form_with(
- model: provider,
- url: saml_providers_path,
- method: :post,
- ) do |form|
- flex_layout do |flex|
- flex.with_row do
- render(Saml::Providers::NameInputForm.new(form))
- end
-
- flex.with_row(mt: 4) do
- render(Saml::Providers::SubmitOrCancelForm.new(form, provider:, state: :name))
- end
- end
- end
-%>
diff --git a/modules/auth_saml/app/components/saml/providers/sections/name_form_component.rb b/modules/auth_saml/app/components/saml/providers/sections/name_form_component.rb
deleted file mode 100644
index 1a5f6b98557..00000000000
--- a/modules/auth_saml/app/components/saml/providers/sections/name_form_component.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-# frozen_string_literal: true
-
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) 2012-2024 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 Saml::Providers::Sections
- class NameFormComponent < SectionComponent
- end
-end
diff --git a/modules/auth_saml/app/components/saml/providers/sections/request_attributes_form_component.html.erb b/modules/auth_saml/app/components/saml/providers/sections/request_attributes_form_component.html.erb
deleted file mode 100644
index 1149272abb5..00000000000
--- a/modules/auth_saml/app/components/saml/providers/sections/request_attributes_form_component.html.erb
+++ /dev/null
@@ -1,24 +0,0 @@
-<%=
- primer_form_with(
- model: provider,
- url: saml_provider_path(provider, state: :mapping),
- method: :put
- ) do |form|
- flex_layout do |flex|
- flex.with_row do
- render(Primer::Beta::Text.new(tag: :p, mb: 4, font_size: :small)) do
- t("saml.instructions.requested_attributes")
- end
- end
-
- flex.with_row do
- render(Saml::Providers::RequestAttributesForm.new(form, provider:))
- end
-
- flex.with_row(mt: 4) do
- render(Saml::Providers::SubmitOrCancelForm.new(form,
- provider:))
- end
- end
- end
-%>
diff --git a/modules/auth_saml/app/components/saml/providers/sections/request_attributes_form_component.rb b/modules/auth_saml/app/components/saml/providers/sections/request_attributes_form_component.rb
deleted file mode 100644
index 14a1ef01dd7..00000000000
--- a/modules/auth_saml/app/components/saml/providers/sections/request_attributes_form_component.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-# frozen_string_literal: true
-
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) 2012-2024 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 Saml::Providers::Sections
- class RequestAttributesFormComponent < SectionComponent
- end
-end
diff --git a/modules/auth_saml/app/components/saml/providers/sections/show_component.html.erb b/modules/auth_saml/app/components/saml/providers/sections/show_component.html.erb
index 1d0734ca694..40ad76cc1e1 100644
--- a/modules/auth_saml/app/components/saml/providers/sections/show_component.html.erb
+++ b/modules/auth_saml/app/components/saml/providers/sections/show_component.html.erb
@@ -13,7 +13,7 @@
end
end
- if provider.persisted?
+ if provider.persisted? && @view_mode == :show
grid.with_area(:action) do
flex_layout(justify_content: :flex_end) do |icons_container|
icons_container.with_column do
@@ -22,7 +22,7 @@
icon: :pencil,
tag: :a,
scheme: :invisible,
- href: edit_saml_provider_path(provider, edit_state: @edit_state),
+ href: edit_saml_provider_path(provider, edit_state: @target_state),
aria: { label: I18n.t(:label_edit) }
)
)
diff --git a/modules/auth_saml/app/components/saml/providers/sections/show_component.rb b/modules/auth_saml/app/components/saml/providers/sections/show_component.rb
index 7ec0b13904e..a630a78d535 100644
--- a/modules/auth_saml/app/components/saml/providers/sections/show_component.rb
+++ b/modules/auth_saml/app/components/saml/providers/sections/show_component.rb
@@ -30,10 +30,12 @@
#
module Saml::Providers::Sections
class ShowComponent < SectionComponent
- def initialize(provider, edit_state:, heading:, description:, label: nil, label_scheme: :attention)
+ def initialize(provider, view_mode:, target_state:,
+ heading:, description:, label: nil, label_scheme: :attention)
super(provider)
- @edit_state = edit_state
+ @target_state = target_state
+ @view_mode = view_mode
@heading = heading
@description = description
@label = label
diff --git a/modules/auth_saml/app/components/saml/providers/view_component.html.erb b/modules/auth_saml/app/components/saml/providers/view_component.html.erb
index ac6410c16f8..5c7e28f0e05 100644
--- a/modules/auth_saml/app/components/saml/providers/view_component.html.erb
+++ b/modules/auth_saml/app/components/saml/providers/view_component.html.erb
@@ -6,11 +6,17 @@
component.with_row(scheme: :default) do
if edit_state == :name
- render(Saml::Providers::Sections::NameFormComponent.new(provider))
+ render(Saml::Providers::Sections::FormComponent.new(
+ provider,
+ form_class: Saml::Providers::NameInputForm,
+ edit_state:,
+ heading: nil
+ ))
else
render(Saml::Providers::Sections::ShowComponent.new(
provider,
- edit_state: :name,
+ view_mode:,
+ target_state: :name,
heading: t("saml.providers.singular"),
description: t("saml.providers.section_texts.display_name")
))
@@ -27,7 +33,8 @@
else
render(Saml::Providers::Sections::ShowComponent.new(
provider,
- edit_state: :metadata,
+ target_state: :metadata,
+ view_mode:,
heading: t("saml.providers.label_metadata"),
description: t("saml.providers.section_texts.metadata"),
label: provider.has_metadata? ? t(:label_completed) : t(:label_not_configured),
@@ -42,11 +49,17 @@
component.with_row(scheme: :default) do
if edit_state == :configuration
- render(Saml::Providers::Sections::ConfigurationFormComponent.new(provider))
+ render(Saml::Providers::Sections::FormComponent.new(
+ provider,
+ form_class: Saml::Providers::ConfigurationForm,
+ edit_state:,
+ heading: t("saml.providers.section_texts.configuration_form")
+ ))
else
render(Saml::Providers::Sections::ShowComponent.new(
provider,
- edit_state: :configuration,
+ target_state: :configuration,
+ view_mode:,
heading: t("saml.providers.label_configuration_details"),
description: t("saml.providers.section_texts.configuration"),
label: (provider.persisted? && !provider.configured?) ? t(:label_incomplete) : nil,
@@ -56,11 +69,17 @@
component.with_row(scheme: :default) do
if edit_state == :encryption
- render(Saml::Providers::Sections::EncryptionFormComponent.new(provider))
+ render(Saml::Providers::Sections::FormComponent.new(
+ provider,
+ form_class: Saml::Providers::EncryptionForm,
+ edit_state:,
+ heading: t("saml.providers.section_texts.encryption_form")
+ ))
else
render(Saml::Providers::Sections::ShowComponent.new(
provider,
- edit_state: :configuration,
+ target_state: :configuration,
+ view_mode:,
heading: t("saml.providers.label_configuration_encryption"),
description: t("saml.providers.section_texts.encryption")
))
@@ -73,11 +92,17 @@
component.with_row(scheme: :default) do
if edit_state == :mapping
- render(Saml::Providers::Sections::MappingFormComponent.new(provider))
+ render(Saml::Providers::Sections::FormComponent.new(
+ provider,
+ form_class: Saml::Providers::MappingForm,
+ edit_state:,
+ heading: t("saml.instructions.mapping")
+ ))
else
render(Saml::Providers::Sections::ShowComponent.new(
provider,
- edit_state: :configuration,
+ target_state: :mapping,
+ view_mode:,
heading: t("saml.providers.label_mapping"),
description: t("saml.providers.section_texts.mapping")
))
@@ -85,11 +110,17 @@
end
component.with_row(scheme: :default) do
if edit_state == :requested_attributes
- render(Saml::Providers::Sections::RequestAttributesFormComponent.new(provider))
+ render(Saml::Providers::Sections::FormComponent.new(
+ provider,
+ form_class: Saml::Providers::RequestAttributesForm,
+ edit_state:,
+ heading: t("saml.instructions.requested_attributes")
+ ))
else
render(Saml::Providers::Sections::ShowComponent.new(
provider,
- edit_state: :configuration,
+ target_state: :configuration,
+ view_mode:,
heading: t("saml.providers.requested_attributes"),
description: t("saml.providers.section_texts.requested_attributes")
))
diff --git a/modules/auth_saml/app/components/saml/providers/view_component.rb b/modules/auth_saml/app/components/saml/providers/view_component.rb
index e5106a384d3..75ddf562dfd 100644
--- a/modules/auth_saml/app/components/saml/providers/view_component.rb
+++ b/modules/auth_saml/app/components/saml/providers/view_component.rb
@@ -32,7 +32,7 @@ module Saml::Providers
class ViewComponent < ApplicationComponent
include OpPrimer::ComponentHelpers
- options :edit_state
+ options :view_mode, :edit_state
alias_method :provider, :model
end
diff --git a/modules/auth_saml/app/components/saml/providers/sections/mapping_form_component.rb b/modules/auth_saml/app/forms/saml/providers/base_form.rb
similarity index 88%
rename from modules/auth_saml/app/components/saml/providers/sections/mapping_form_component.rb
rename to modules/auth_saml/app/forms/saml/providers/base_form.rb
index bcc2eb7ff3d..bea23db3abe 100644
--- a/modules/auth_saml/app/components/saml/providers/sections/mapping_form_component.rb
+++ b/modules/auth_saml/app/forms/saml/providers/base_form.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2024 the OpenProject GmbH
@@ -27,8 +25,14 @@
#
# See COPYRIGHT and LICENSE files for more details.
#++
-#
-module Saml::Providers::Sections
- class MappingFormComponent < SectionComponent
+
+module Saml
+ module Providers
+ class BaseForm < ApplicationForm
+ def initialize(provider:)
+ super()
+ @provider = provider
+ end
+ end
end
end
diff --git a/modules/auth_saml/app/forms/saml/providers/configuration_form.rb b/modules/auth_saml/app/forms/saml/providers/configuration_form.rb
index eeac93067e3..448028c4f92 100644
--- a/modules/auth_saml/app/forms/saml/providers/configuration_form.rb
+++ b/modules/auth_saml/app/forms/saml/providers/configuration_form.rb
@@ -28,7 +28,7 @@
module Saml
module Providers
- class ConfigurationForm < ApplicationForm
+ class ConfigurationForm < BaseForm
form do |f|
f.text_field(
name: :sp_entity_id,
@@ -77,11 +77,6 @@ module Saml
input_width: :large
)
end
-
- def initialize(provider:)
- super()
- @provider = provider
- end
end
end
end
diff --git a/modules/auth_saml/app/forms/saml/providers/encryption_form.rb b/modules/auth_saml/app/forms/saml/providers/encryption_form.rb
index 52d3507ccd5..2e99edb9b1d 100644
--- a/modules/auth_saml/app/forms/saml/providers/encryption_form.rb
+++ b/modules/auth_saml/app/forms/saml/providers/encryption_form.rb
@@ -28,7 +28,7 @@
module Saml
module Providers
- class EncryptionForm < ApplicationForm
+ class EncryptionForm < BaseForm
form do |f|
f.check_box(
name: :authn_requests_signed,
@@ -65,11 +65,6 @@ module Saml
input_width: :large
)
end
-
- def initialize(provider:)
- super()
- @provider = provider
- end
end
end
end
diff --git a/modules/auth_saml/app/forms/saml/providers/mapping_form.rb b/modules/auth_saml/app/forms/saml/providers/mapping_form.rb
index 833db7a51ed..999a6a164bf 100644
--- a/modules/auth_saml/app/forms/saml/providers/mapping_form.rb
+++ b/modules/auth_saml/app/forms/saml/providers/mapping_form.rb
@@ -28,7 +28,7 @@
module Saml
module Providers
- class MappingForm < ApplicationForm
+ class MappingForm < BaseForm
form do |f|
f.text_area(
name: :mapping_login,
@@ -71,11 +71,6 @@ module Saml
input_width: :large
)
end
-
- def initialize(provider:)
- super()
- @provider = provider
- end
end
end
end
diff --git a/modules/auth_saml/app/forms/saml/providers/metadata_checkbox_form.rb b/modules/auth_saml/app/forms/saml/providers/metadata_checkbox_form.rb
index 79a580d2ac0..7dc4448092f 100644
--- a/modules/auth_saml/app/forms/saml/providers/metadata_checkbox_form.rb
+++ b/modules/auth_saml/app/forms/saml/providers/metadata_checkbox_form.rb
@@ -28,7 +28,7 @@
module Saml
module Providers
- class MetadataCheckboxForm < ApplicationForm
+ class MetadataCheckboxForm < BaseForm
form do |f|
f.check_box(
name: :metadata_url,
@@ -37,15 +37,10 @@ module Saml
required: false,
input_width: :medium,
data: {
- 'show-when-checked-target': 'cause'
+ "show-when-checked-target": "cause"
}
)
end
-
- def initialize(provider:)
- super()
- @provider = provider
- end
end
end
end
diff --git a/modules/auth_saml/app/forms/saml/providers/metadata_url_form.rb b/modules/auth_saml/app/forms/saml/providers/metadata_url_form.rb
index 649c0cb0a06..9dbdbbc0beb 100644
--- a/modules/auth_saml/app/forms/saml/providers/metadata_url_form.rb
+++ b/modules/auth_saml/app/forms/saml/providers/metadata_url_form.rb
@@ -28,7 +28,7 @@
module Saml
module Providers
- class MetadataUrlForm < ApplicationForm
+ class MetadataUrlForm < BaseForm
form do |f|
f.text_field(
name: :metadata_url,
diff --git a/modules/auth_saml/app/forms/saml/providers/metadata_xml_form.rb b/modules/auth_saml/app/forms/saml/providers/metadata_xml_form.rb
index 86a2718d51d..670a4d5f088 100644
--- a/modules/auth_saml/app/forms/saml/providers/metadata_xml_form.rb
+++ b/modules/auth_saml/app/forms/saml/providers/metadata_xml_form.rb
@@ -28,7 +28,7 @@
module Saml
module Providers
- class MetadataXmlForm < ApplicationForm
+ class MetadataXmlForm < BaseForm
form do |f|
f.text_area(
name: :metadata_xml,
diff --git a/modules/auth_saml/app/forms/saml/providers/name_input_form.rb b/modules/auth_saml/app/forms/saml/providers/name_input_form.rb
index e4b8c68e42d..33e01879e72 100644
--- a/modules/auth_saml/app/forms/saml/providers/name_input_form.rb
+++ b/modules/auth_saml/app/forms/saml/providers/name_input_form.rb
@@ -28,7 +28,7 @@
module Saml
module Providers
- class NameInputForm < ApplicationForm
+ class NameInputForm < BaseForm
form do |f|
f.text_field(
name: :display_name,
diff --git a/modules/auth_saml/app/forms/saml/providers/request_attributes_form.rb b/modules/auth_saml/app/forms/saml/providers/request_attributes_form.rb
index b5c9b97f445..01882ff4c6c 100644
--- a/modules/auth_saml/app/forms/saml/providers/request_attributes_form.rb
+++ b/modules/auth_saml/app/forms/saml/providers/request_attributes_form.rb
@@ -28,7 +28,7 @@
module Saml
module Providers
- class RequestAttributesForm < ApplicationForm
+ class RequestAttributesForm < BaseForm
include Redmine::I18n
form do |f|
@@ -65,11 +65,6 @@ module Saml
f.separator unless attribute == :uid
end
end
-
- def initialize(provider:)
- super()
- @provider = provider
- end
end
end
end
diff --git a/modules/auth_saml/app/views/saml/providers/edit.html.erb b/modules/auth_saml/app/views/saml/providers/edit.html.erb
index 414c1d1d508..d4aee70f933 100644
--- a/modules/auth_saml/app/views/saml/providers/edit.html.erb
+++ b/modules/auth_saml/app/views/saml/providers/edit.html.erb
@@ -20,4 +20,4 @@
<% end %>
<% end %>
-<%= render(Saml::Providers::ViewComponent.new(@provider, edit_state: @edit_state)) %>
+<%= render(Saml::Providers::ViewComponent.new(@provider, view_mode: :edit, edit_state: @edit_state)) %>
diff --git a/modules/auth_saml/app/views/saml/providers/show.html.erb b/modules/auth_saml/app/views/saml/providers/show.html.erb
index d687831a72d..42d188b0f6b 100644
--- a/modules/auth_saml/app/views/saml/providers/show.html.erb
+++ b/modules/auth_saml/app/views/saml/providers/show.html.erb
@@ -30,7 +30,7 @@
<%=
render(Primer::Alpha::Layout.new(stacking_breakpoint: :md)) do |content|
content.with_main do
- render Saml::Providers::ViewComponent.new(@provider)
+ render Saml::Providers::ViewComponent.new(@provider, view_mode: :show)
end
content.with_sidebar(row_placement: :start, col_placement: :end) do