From b0b7d0f25b54a2df07e56b668bdf7becf70ad303 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Mon, 6 Mar 2023 17:15:15 +0100 Subject: [PATCH] Remove unused legislation proposals map action The only view that linked to this action was never used and so it was deleted in commit 0bacd5baf. Since now the proposals controller is the only one place rendering the `shared/map` partial, we're moving it to the proposals views. --- .../concerns/commentable_actions.rb | 5 -- .../legislation/proposals_controller.rb | 6 +-- app/controllers/proposals_controller.rb | 5 ++ app/models/abilities/everyone.rb | 2 +- app/views/legislation/proposals/map.html.erb | 1 - app/views/proposals/map.html.erb | 51 ++++++++++++++++++- app/views/shared/_map.html.erb | 50 ------------------ config/routes/legislation.rb | 1 - 8 files changed, 59 insertions(+), 62 deletions(-) delete mode 100644 app/views/legislation/proposals/map.html.erb delete mode 100644 app/views/shared/_map.html.erb diff --git a/app/controllers/concerns/commentable_actions.rb b/app/controllers/concerns/commentable_actions.rb index dd8611366..1acb07778 100644 --- a/app/controllers/concerns/commentable_actions.rb +++ b/app/controllers/concerns/commentable_actions.rb @@ -68,11 +68,6 @@ module CommentableActions end end - def map - @resource = resource_model.new - @tag_cloud = tag_cloud - end - private def track_event diff --git a/app/controllers/legislation/proposals_controller.rb b/app/controllers/legislation/proposals_controller.rb index ce7e68e95..4d68ac201 100644 --- a/app/controllers/legislation/proposals_controller.rb +++ b/app/controllers/legislation/proposals_controller.rb @@ -3,10 +3,10 @@ class Legislation::ProposalsController < Legislation::BaseController include FlagActions include ImageAttributes - before_action :load_categories, only: [:new, :create, :edit, :map, :summary] - before_action :load_geozones, only: [:edit, :map, :summary] + before_action :load_categories, only: [:new, :create, :edit, :summary] + before_action :load_geozones, only: [:edit, :summary] - before_action :authenticate_user!, except: [:show, :map, :summary] + before_action :authenticate_user!, except: [:show, :summary] load_and_authorize_resource :process, class: "Legislation::Process" load_and_authorize_resource :proposal, class: "Legislation::Proposal", through: :process diff --git a/app/controllers/proposals_controller.rb b/app/controllers/proposals_controller.rb index 0f6ff5f60..23a186151 100644 --- a/app/controllers/proposals_controller.rb +++ b/app/controllers/proposals_controller.rb @@ -77,6 +77,11 @@ class ProposalsController < ApplicationController @tag_cloud = tag_cloud end + def map + @proposal = Proposal.new + @tag_cloud = tag_cloud + end + def disable_recommendations if current_user.update(recommended_proposals: false) redirect_to proposals_path, notice: t("proposals.index.recommendations.actions.success") diff --git a/app/models/abilities/everyone.rb b/app/models/abilities/everyone.rb index 216b101f1..7052c48d5 100644 --- a/app/models/abilities/everyone.rb +++ b/app/models/abilities/everyone.rb @@ -25,7 +25,7 @@ module Abilities id: Legislation::Process.past.published.where(result_publication_enabled: true).ids can [:read, :changes, :go_to_version], Legislation::DraftVersion can [:read], Legislation::Question - can [:read, :map, :share], Legislation::Proposal + can [:read, :share], Legislation::Proposal can [:search, :comments, :read, :create, :new_comment], Legislation::Annotation can [:read, :help], ::SDG::Goal diff --git a/app/views/legislation/proposals/map.html.erb b/app/views/legislation/proposals/map.html.erb deleted file mode 100644 index 10dbf795f..000000000 --- a/app/views/legislation/proposals/map.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render "shared/map", new_url_path: new_proposal_path %> diff --git a/app/views/proposals/map.html.erb b/app/views/proposals/map.html.erb index 10dbf795f..dde4a610f 100644 --- a/app/views/proposals/map.html.erb +++ b/app/views/proposals/map.html.erb @@ -1 +1,50 @@ -<%= render "shared/map", new_url_path: new_proposal_path %> +
+
+ +

<%= t("map.title") %>

+ +
+
+
    + <% @geozones.each do |geozone| %> +
  • <%= link_to geozone.name, proposals_path(search: geozone.name) %>
  • + <% end %> +
+
+ +
+ <%= image_tag(image_path_for("map.jpg"), usemap: "#map") %> +
+ + + <% @geozones.each do |geozone| %> + <%= geozone.name %> + <% end %> + +
+ +

<%= t("map.proposal_for_district") %>

+ + <%= form_for(@proposal, url: new_proposal_path, method: :get) do |f| %> +
+ <%= f.select :geozone_id, geozone_select_options, include_blank: t("geozones.none") %> +
+ +
+ <%= f.submit(class: "button radius", value: t("map.start_proposal")) %> +
+ <% end %> +
+ +
+ +
+
diff --git a/app/views/shared/_map.html.erb b/app/views/shared/_map.html.erb deleted file mode 100644 index 004508c77..000000000 --- a/app/views/shared/_map.html.erb +++ /dev/null @@ -1,50 +0,0 @@ -
-
- -

<%= t("map.title") %>

- -
-
-
    - <% @geozones.each do |geozone| %> -
  • <%= link_to geozone.name, proposals_path(search: geozone.name) %>
  • - <% end %> -
-
- -
- <%= image_tag(image_path_for("map.jpg"), usemap: "#map") %> -
- - - <% @geozones.each do |geozone| %> - <%= geozone.name %> - <% end %> - -
- -

<%= t("map.proposal_for_district") %>

- - <%= form_for(@resource, url: new_url_path, method: :get) do |f| %> -
- <%= f.select :geozone_id, geozone_select_options, include_blank: t("geozones.none") %> -
- -
- <%= f.submit(class: "button radius", value: t("map.start_proposal")) %> -
- <% end %> -
- -
- -
-
diff --git a/config/routes/legislation.rb b/config/routes/legislation.rb index 0a06ad511..4a18ef1cd 100644 --- a/config/routes/legislation.rb +++ b/config/routes/legislation.rb @@ -21,7 +21,6 @@ namespace :legislation do put :unflag end collection do - get :map get :suggest end end