Remove duplicate i18n text to remove marker

We had two different keys with the same text and were passing it as a
parameter. Since the text is the same in any case, we don't need a
parameter for it.

Note we are using the `proposals` i18n key instead of creating a new one
in a `shared` namespace one because creating a new key would mean that
we'd lose the already existing translations in Crowdin.
This commit is contained in:
Javi Martín
2023-03-07 19:36:52 +01:00
parent c667582c98
commit e75211125a
6 changed files with 7 additions and 8 deletions

View File

@@ -55,7 +55,6 @@
map_location: investment.map_location || MapLocation.new, map_location: investment.map_location || MapLocation.new,
label: t("budgets.investments.form.map_location"), label: t("budgets.investments.form.map_location"),
help: t("budgets.investments.form.map_location_instructions"), help: t("budgets.investments.form.map_location_instructions"),
remove_marker_label: t("budgets.investments.form.map_remove_marker"),
i18n_namespace: "budgets.investments" %> i18n_namespace: "budgets.investments" %>
</div> </div>
<% end %> <% end %>

View File

@@ -61,7 +61,6 @@
map_location: proposal.map_location || MapLocation.new, map_location: proposal.map_location || MapLocation.new,
label: t("proposals.form.map_location"), label: t("proposals.form.map_location"),
help: t("proposals.form.map_location_instructions"), help: t("proposals.form.map_location_instructions"),
remove_marker_label: t("proposals.form.map_remove_marker"),
i18n_namespace: "proposals" %> i18n_namespace: "proposals" %>
</div> </div>
<% end %> <% end %>

View File

@@ -1,9 +1,8 @@
class Shared::MapLocationComponent < ApplicationComponent class Shared::MapLocationComponent < ApplicationComponent
attr_reader :remove_marker_label, :investments_coordinates, :form attr_reader :investments_coordinates, :form
def initialize(map_location, remove_marker_label: nil, investments_coordinates: nil, form: nil) def initialize(map_location, investments_coordinates: nil, form: nil)
@map_location = map_location @map_location = map_location
@remove_marker_label = remove_marker_label
@investments_coordinates = investments_coordinates @investments_coordinates = investments_coordinates
@form = form @form = form
end end
@@ -30,6 +29,10 @@ class Shared::MapLocationComponent < ApplicationComponent
map_location.zoom.presence || Setting["map.zoom"] map_location.zoom.presence || Setting["map.zoom"]
end end
def remove_marker_label
t("proposals.form.map_remove_marker")
end
def remove_marker_link_id def remove_marker_link_id
"remove-marker-link-#{dom_id(map_location)}" "remove-marker-link-#{dom_id(map_location)}"
end end

View File

@@ -2,7 +2,7 @@
<p class="help-text" id="tag-list-help-text"><%= help %></p> <p class="help-text" id="tag-list-help-text"><%= help %></p>
<%= form.fields_for :map_location, map_location do |m_l_fields| %> <%= form.fields_for :map_location, map_location do |m_l_fields| %>
<%= render_map(map_location, remove_marker_label: remove_marker_label, form: m_l_fields) %> <%= render_map(map_location, form: m_l_fields) %>
<%= m_l_fields.hidden_field :latitude %> <%= m_l_fields.hidden_field :latitude %>
<%= m_l_fields.hidden_field :longitude %> <%= m_l_fields.hidden_field :longitude %>

View File

@@ -82,7 +82,6 @@ en:
tags_placeholder: "Enter the tags you would like to use, separated by commas (',')" tags_placeholder: "Enter the tags you would like to use, separated by commas (',')"
map_location: "Map location" map_location: "Map location"
map_location_instructions: "Navigate the map to the location and place the marker." map_location_instructions: "Navigate the map to the location and place the marker."
map_remove_marker: "Remove map marker"
index: index:
title: Participatory budgeting title: Participatory budgeting
unfeasible: Unfeasible investment projects unfeasible: Unfeasible investment projects

View File

@@ -82,7 +82,6 @@ es:
tags_placeholder: "Escribe las etiquetas que desees separadas por coma (',')" tags_placeholder: "Escribe las etiquetas que desees separadas por coma (',')"
map_location: "Ubicación en el mapa" map_location: "Ubicación en el mapa"
map_location_instructions: "Navega por el mapa hasta la ubicación y coloca el marcador." map_location_instructions: "Navega por el mapa hasta la ubicación y coloca el marcador."
map_remove_marker: "Eliminar el marcador"
index: index:
title: Presupuestos participativos title: Presupuestos participativos
unfeasible: Proyectos de gasto no viables unfeasible: Proyectos de gasto no viables