Move geozone form partial to a component

That way it'll be easier to refactor it.
This commit is contained in:
Javi Martín
2023-04-26 17:09:04 +02:00
parent 1462ae72a8
commit c6c09074df
4 changed files with 11 additions and 4 deletions

View File

@@ -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 %>
<div class="small-12 large-8 column">
<%= f.text_field :name %>

View File

@@ -0,0 +1,7 @@
class Admin::Geozones::FormComponent < ApplicationComponent
attr_reader :geozone
def initialize(geozone)
@geozone = geozone
end
end

View File

@@ -4,4 +4,4 @@
<h2><%= t("admin.geozones.edit.editing") %></h2>
</div>
<%= render "form" %>
<%= render Admin::Geozones::FormComponent.new(@geozone) %>

View File

@@ -4,4 +4,4 @@
<h2><%= t("admin.geozones.new.creating") %></h2>
</div>
<%= render "form" %>
<%= render Admin::Geozones::FormComponent.new(@geozone) %>