diff --git a/app/views/admin/geozones/_form.html.erb b/app/components/admin/geozones/form_component.html.erb similarity index 88% rename from app/views/admin/geozones/_form.html.erb rename to app/components/admin/geozones/form_component.html.erb index 97eaed50e..b36153e8a 100644 --- a/app/views/admin/geozones/_form.html.erb +++ b/app/components/admin/geozones/form_component.html.erb @@ -1,6 +1,6 @@ -<%= form_for [:admin, @geozone] do |f| %> +<%= form_for [:admin, geozone] do |f| %> - <%= render "shared/errors", resource: @geozone %> + <%= render "shared/errors", resource: geozone %>
<%= f.text_field :name %> diff --git a/app/components/admin/geozones/form_component.rb b/app/components/admin/geozones/form_component.rb new file mode 100644 index 000000000..9f3ace2ca --- /dev/null +++ b/app/components/admin/geozones/form_component.rb @@ -0,0 +1,7 @@ +class Admin::Geozones::FormComponent < ApplicationComponent + attr_reader :geozone + + def initialize(geozone) + @geozone = geozone + end +end diff --git a/app/views/admin/geozones/edit.html.erb b/app/views/admin/geozones/edit.html.erb index 107ef505d..500a03ddd 100644 --- a/app/views/admin/geozones/edit.html.erb +++ b/app/views/admin/geozones/edit.html.erb @@ -4,4 +4,4 @@

<%= t("admin.geozones.edit.editing") %>

-<%= render "form" %> +<%= render Admin::Geozones::FormComponent.new(@geozone) %> diff --git a/app/views/admin/geozones/new.html.erb b/app/views/admin/geozones/new.html.erb index d29c9eac0..b957f2cda 100644 --- a/app/views/admin/geozones/new.html.erb +++ b/app/views/admin/geozones/new.html.erb @@ -4,4 +4,4 @@

<%= t("admin.geozones.new.creating") %>

-<%= render "form" %> +<%= render Admin::Geozones::FormComponent.new(@geozone) %>