Remove duplication rendering map location fields

We're going to move the partial to a component, and this makes it
easier.
This commit is contained in:
Javi Martín
2025-11-16 23:53:26 +01:00
parent 0ec7c65b9b
commit 2d85bd5351
3 changed files with 21 additions and 25 deletions

View File

@@ -44,15 +44,11 @@
<%= render Documents::NestedComponent.new(f) %> <%= render Documents::NestedComponent.new(f) %>
<% end %> <% end %>
<% if feature?(:map) %>
<div>
<%= render "map_locations/form_fields", <%= render "map_locations/form_fields",
form: f, form: f,
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") %>
</div>
<% end %>
<div> <div>
<%= f.text_field :location %> <%= f.text_field :location %>

View File

@@ -52,15 +52,11 @@
</div> </div>
<% end %> <% end %>
<% if feature?(:map) %>
<div>
<%= render "map_locations/form_fields", <%= render "map_locations/form_fields",
form: f, form: f,
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") %>
</div>
<% end %>
<div> <div>
<%= f.label :tag_list, t("proposals.form.tags_label") %> <%= f.label :tag_list, t("proposals.form.tags_label") %>

View File

@@ -1,3 +1,5 @@
<% if feature?(:map) %>
<div>
<%= form.label :map_location, label %> <%= form.label :map_location, label %>
<p class="help-text" id="tag-list-help-text"><%= help %></p> <p class="help-text" id="tag-list-help-text"><%= help %></p>
@@ -8,3 +10,5 @@
<%= m_l_fields.hidden_field :longitude %> <%= m_l_fields.hidden_field :longitude %>
<%= m_l_fields.hidden_field :zoom %> <%= m_l_fields.hidden_field :zoom %>
<% end %> <% end %>
</div>
<% end %>