diff --git a/app/components/budgets/investments/form_component.html.erb b/app/components/budgets/investments/form_component.html.erb
index a7e6e2d21..e560a8112 100644
--- a/app/components/budgets/investments/form_component.html.erb
+++ b/app/components/budgets/investments/form_component.html.erb
@@ -44,12 +44,7 @@
<%= render Documents::NestedComponent.new(f) %>
<% end %>
- <%= render MapLocations::FormFieldsComponent.new(
- f,
- map_location: map_location,
- label: t("budgets.investments.form.map_location"),
- help: t("budgets.investments.form.map_location_instructions")
- ) %>
+ <%= render MapLocations::FormFieldsComponent.new(f, map_location: map_location) %>
<%= f.text_field :location %>
diff --git a/app/components/map_locations/form_fields_component.rb b/app/components/map_locations/form_fields_component.rb
index d4235b3e5..585eff0b6 100644
--- a/app/components/map_locations/form_fields_component.rb
+++ b/app/components/map_locations/form_fields_component.rb
@@ -1,15 +1,23 @@
class MapLocations::FormFieldsComponent < ApplicationComponent
- attr_reader :form, :map_location, :label, :help
+ attr_reader :form, :map_location
use_helpers :render_map
- def initialize(form, map_location:, label:, help:)
+ def initialize(form, map_location:)
@form = form
@map_location = map_location
- @label = label
- @help = help
end
def render?
feature?(:map)
end
+
+ private
+
+ def label
+ t("proposals.form.map_location")
+ end
+
+ def help
+ t("proposals.form.map_location_instructions")
+ end
end
diff --git a/app/components/proposals/form_component.html.erb b/app/components/proposals/form_component.html.erb
index 6e7fed36c..d3d6a4f1a 100644
--- a/app/components/proposals/form_component.html.erb
+++ b/app/components/proposals/form_component.html.erb
@@ -52,12 +52,7 @@
<% end %>
- <%= render MapLocations::FormFieldsComponent.new(
- f,
- map_location: proposal.map_location || MapLocation.new,
- label: t("proposals.form.map_location"),
- help: t("proposals.form.map_location_instructions")
- ) %>
+ <%= render MapLocations::FormFieldsComponent.new(f, map_location: map_location) %>
<%= f.label :tag_list, t("proposals.form.tags_label") %>
diff --git a/config/locales/en/budgets.yml b/config/locales/en/budgets.yml
index 384b55030..b6320ce64 100644
--- a/config/locales/en/budgets.yml
+++ b/config/locales/en/budgets.yml
@@ -80,8 +80,6 @@ en:
tags_instructions: "Tag this proposal. You can choose from proposed categories or add your own"
tags_label: Tags
tags_placeholder: "Enter the tags you would like to use, separated by commas (',')"
- map_location: "Map location"
- map_location_instructions: "Navigate the map to the location and place the marker."
index:
title: Participatory budgeting
unfeasible: Unfeasible investment projects
diff --git a/config/locales/es/budgets.yml b/config/locales/es/budgets.yml
index 53c5a4b35..489752b81 100644
--- a/config/locales/es/budgets.yml
+++ b/config/locales/es/budgets.yml
@@ -80,8 +80,6 @@ es:
tags_instructions: "Etiqueta este proyecto. Puedes elegir entre las categorías propuestas o introducir las que desees"
tags_label: Etiquetas
tags_placeholder: "Escribe las etiquetas que desees separadas por coma (',')"
- map_location: "Ubicación en el mapa"
- map_location_instructions: "Navega por el mapa hasta la ubicación y coloca el marcador."
index:
title: Presupuestos participativos
unfeasible: Proyectos de gasto no viables
diff --git a/spec/components/map_locations/form_fields_component_spec.rb b/spec/components/map_locations/form_fields_component_spec.rb
index d81508877..34c17d277 100644
--- a/spec/components/map_locations/form_fields_component_spec.rb
+++ b/spec/components/map_locations/form_fields_component_spec.rb
@@ -4,11 +4,7 @@ describe MapLocations::FormFieldsComponent do
let(:proposal) { Proposal.new }
let(:map_location) { MapLocation.new }
let(:form) { ConsulFormBuilder.new(:proposal, proposal, ApplicationController.new.view_context, {}) }
- let(:label) { "Map location" }
- let(:help) { "Add a marker" }
- let(:component) do
- MapLocations::FormFieldsComponent.new(form, map_location: map_location, label: label, help: help)
- end
+ let(:component) { MapLocations::FormFieldsComponent.new(form, map_location: map_location) }
it "is rendered when the map feature is enabled" do
Setting["feature.map"] = true