diff --git a/app/controllers/admin/geozones_controller.rb b/app/controllers/admin/geozones_controller.rb index 6b755e5f3..a8648f287 100644 --- a/app/controllers/admin/geozones_controller.rb +++ b/app/controllers/admin/geozones_controller.rb @@ -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 diff --git a/app/views/admin/geozones/_form.html.erb b/app/views/admin/geozones/_form.html.erb index 323a6fbb1..e92b98c0b 100644 --- a/app/views/admin/geozones/_form.html.erb +++ b/app/views/admin/geozones/_form.html.erb @@ -3,15 +3,19 @@ <%= render 'errors' %>
-
+
<%= f.label :name, t("admin.geozones.geozone.name") %> <%= f.text_field :name, label: false %>
-
+
+ <%= f.label :html_map_coordinates, t("admin.geozones.geozone.coordinates") %> + <%= f.text_field :html_map_coordinates, label: false %> +
+
<%= f.label :external_code, t("admin.geozones.geozone.external_code") %> <%= f.text_field :external_code, label: false %>
-
+
<%= f.label :census_code, t("admin.geozones.geozone.census_code") %> <%= f.text_field :census_code, label: false %>
diff --git a/app/views/admin/geozones/index.html.erb b/app/views/admin/geozones/index.html.erb index 69d9334d5..5a524e46e 100644 --- a/app/views/admin/geozones/index.html.erb +++ b/app/views/admin/geozones/index.html.erb @@ -9,6 +9,7 @@ <%= t("admin.geozones.geozone.name") %> <%= t("admin.geozones.geozone.external_code") %> <%= t("admin.geozones.geozone.census_code") %> + <%= t("admin.geozones.geozone.coordinates") %> @@ -19,6 +20,7 @@ <%= geozone.name %> <%= geozone.external_code %> <%= geozone.census_code %> + <%= geozone.html_map_coordinates %> <%= link_to t("admin.geozones.index.edit"), edit_admin_geozone_path(geozone), class: 'edit-banner button hollow' %> diff --git a/config/locales/admin.en.yml b/config/locales/admin.en.yml index 2187c458c..370a06ccc 100755 --- a/config/locales/admin.en.yml +++ b/config/locales/admin.en.yml @@ -278,6 +278,7 @@ en: name: Name external_code: External code census_code: Census code + coordinates: Coordinates errors: form: error: diff --git a/config/locales/admin.es.yml b/config/locales/admin.es.yml index 7ba79aad3..8819905d8 100644 --- a/config/locales/admin.es.yml +++ b/config/locales/admin.es.yml @@ -276,6 +276,7 @@ es: name: Nombre external_code: Código externo census_code: Código del censo + coordinates: Coordenadas errors: form: error: