CRUD html_map_coordinates geozone attribute
This commit is contained in:
@@ -33,15 +33,10 @@ class Admin::GeozonesController < Admin::BaseController
|
||||
end
|
||||
|
||||
def destroy
|
||||
# Check that in none of the other associated models talbes a record exists
|
||||
# Check that in none of the other associated models tables a record exists
|
||||
# referencing this geozone
|
||||
safe_to_destroy = true
|
||||
|
||||
# safe_to_destroy &= Proposal.where(geozone: @geozone).empty?
|
||||
# safe_to_destroy &= Debate.where(geozone: @geozone).empty?
|
||||
# safe_to_destroy &= SpendingProposal.where(geozone: @geozone).empty?
|
||||
# safe_to_destroy &= User.where(geozone: @geozone).empty?
|
||||
|
||||
Geozone.reflect_on_all_associations.each do |association|
|
||||
attached_model = association.klass
|
||||
safe_to_destroy &= attached_model.where(geozone: @geozone).empty?
|
||||
@@ -58,6 +53,6 @@ class Admin::GeozonesController < Admin::BaseController
|
||||
private
|
||||
|
||||
def geozone_params
|
||||
params.require(:geozone).permit(:name, :external_code, :census_code)
|
||||
params.require(:geozone).permit(:name, :external_code, :census_code, :html_map_coordinates)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,15 +3,19 @@
|
||||
<%= render 'errors' %>
|
||||
|
||||
<div clas="row">
|
||||
<div class="small-12 medium-6 large-6 column">
|
||||
<div class="small-12 medium-6 large-4 column">
|
||||
<%= f.label :name, t("admin.geozones.geozone.name") %>
|
||||
<%= f.text_field :name, label: false %>
|
||||
</div>
|
||||
<div class="small-12 medium-3 large-3 column">
|
||||
<div class="small-12 medium-6 large-4 column">
|
||||
<%= f.label :html_map_coordinates, t("admin.geozones.geozone.coordinates") %>
|
||||
<%= f.text_field :html_map_coordinates, label: false %>
|
||||
</div>
|
||||
<div class="small-12 medium-6 large-2 column">
|
||||
<%= f.label :external_code, t("admin.geozones.geozone.external_code") %>
|
||||
<%= f.text_field :external_code, label: false %>
|
||||
</div>
|
||||
<div class="small-12 medium-3 large-3 column">
|
||||
<div class="small-12 medium-6 large-2 column">
|
||||
<%= f.label :census_code, t("admin.geozones.geozone.census_code") %>
|
||||
<%= f.text_field :census_code, label: false %>
|
||||
</div>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<th><%= t("admin.geozones.geozone.name") %></th>
|
||||
<th><%= t("admin.geozones.geozone.external_code") %></th>
|
||||
<th><%= t("admin.geozones.geozone.census_code") %></th>
|
||||
<th><%= t("admin.geozones.geozone.coordinates") %></th>
|
||||
<th colspan="2"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -19,6 +20,7 @@
|
||||
<td><%= geozone.name %></td>
|
||||
<td><%= geozone.external_code %></td>
|
||||
<td><%= geozone.census_code %></td>
|
||||
<td><%= geozone.html_map_coordinates %></td>
|
||||
<td>
|
||||
<%= link_to t("admin.geozones.index.edit"), edit_admin_geozone_path(geozone), class: 'edit-banner button hollow' %>
|
||||
</td>
|
||||
|
||||
@@ -278,6 +278,7 @@ en:
|
||||
name: Name
|
||||
external_code: External code
|
||||
census_code: Census code
|
||||
coordinates: Coordinates
|
||||
errors:
|
||||
form:
|
||||
error:
|
||||
|
||||
@@ -276,6 +276,7 @@ es:
|
||||
name: Nombre
|
||||
external_code: Código externo
|
||||
census_code: Código del censo
|
||||
coordinates: Coordenadas
|
||||
errors:
|
||||
form:
|
||||
error:
|
||||
|
||||
Reference in New Issue
Block a user