Move geozone form partial to a component
That way it'll be easier to refactor it.
This commit is contained in:
@@ -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 %>
|
||||
7
app/components/admin/geozones/form_component.rb
Normal file
7
app/components/admin/geozones/form_component.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
class Admin::Geozones::FormComponent < ApplicationComponent
|
||||
attr_reader :geozone
|
||||
|
||||
def initialize(geozone)
|
||||
@geozone = geozone
|
||||
end
|
||||
end
|
||||
@@ -4,4 +4,4 @@
|
||||
<h2><%= t("admin.geozones.edit.editing") %></h2>
|
||||
</div>
|
||||
|
||||
<%= render "form" %>
|
||||
<%= render Admin::Geozones::FormComponent.new(@geozone) %>
|
||||
|
||||
@@ -4,4 +4,4 @@
|
||||
<h2><%= t("admin.geozones.new.creating") %></h2>
|
||||
</div>
|
||||
|
||||
<%= render "form" %>
|
||||
<%= render Admin::Geozones::FormComponent.new(@geozone) %>
|
||||
|
||||
Reference in New Issue
Block a user