Extract methods to get map location in form components
This way changing them will be easier.
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
|
||||
<%= render "map_locations/form_fields",
|
||||
form: f,
|
||||
map_location: investment.map_location || MapLocation.new,
|
||||
map_location: map_location,
|
||||
label: t("budgets.investments.form.map_location"),
|
||||
help: t("budgets.investments.form.map_location_instructions") %>
|
||||
|
||||
|
||||
@@ -19,4 +19,8 @@ class Budgets::Investments::FormComponent < ApplicationComponent
|
||||
def categories
|
||||
Tag.category.order(:name)
|
||||
end
|
||||
|
||||
def map_location
|
||||
investment.map_location || MapLocation.new
|
||||
end
|
||||
end
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
<%= render "map_locations/form_fields",
|
||||
form: f,
|
||||
map_location: proposal.map_location || MapLocation.new,
|
||||
map_location: map_location,
|
||||
label: t("proposals.form.map_location"),
|
||||
help: t("proposals.form.map_location_instructions") %>
|
||||
|
||||
|
||||
@@ -15,4 +15,8 @@ class Proposals::FormComponent < ApplicationComponent
|
||||
def categories
|
||||
Tag.category.order(:name)
|
||||
end
|
||||
|
||||
def map_location
|
||||
proposal.map_location || MapLocation.new
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user