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.
This commit is contained in:
Javi Martín
2023-03-06 17:15:15 +01:00
parent 2f8717aa52
commit b0b7d0f25b
8 changed files with 59 additions and 62 deletions

View File

@@ -68,11 +68,6 @@ module CommentableActions
end
end
def map
@resource = resource_model.new
@tag_cloud = tag_cloud
end
private
def track_event

View File

@@ -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

View File

@@ -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")

View File

@@ -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

View File

@@ -1 +0,0 @@
<%= render "shared/map", new_url_path: new_proposal_path %>

View File

@@ -1 +1,50 @@
<%= render "shared/map", new_url_path: new_proposal_path %>
<div class="row">
<div class="small-12 medium-9 column margin-top">
<h1><%= t("map.title") %></h1>
<div class="row">
<div class="small-12 medium-3 column">
<ul id="geozones" class="no-bullet">
<% @geozones.each do |geozone| %>
<li><%= link_to geozone.name, proposals_path(search: geozone.name) %></li>
<% end %>
</ul>
</div>
<div class="show-for-medium medium-9 column text-center">
<%= image_tag(image_path_for("map.jpg"), usemap: "#map") %>
</div>
<map name="map" id="html_map">
<% @geozones.each do |geozone| %>
<area shape="poly"
coords="<%= geozone.html_map_coordinates %>"
href="<%= polymorphic_path(@proposal, search: geozone.name) %>"
title="<%= geozone.name %>"
alt="<%= geozone.name %>">
<% end %>
</map>
</div>
<h2><%= t("map.proposal_for_district") %></h2>
<%= form_for(@proposal, url: new_proposal_path, method: :get) do |f| %>
<div class="small-12 medium-4">
<%= f.select :geozone_id, geozone_select_options, include_blank: t("geozones.none") %>
</div>
<div class="actions small-12">
<%= f.submit(class: "button radius", value: t("map.start_proposal")) %>
</div>
<% end %>
</div>
<div class="small-12 medium-3 column">
<aside class="sidebar">
<%= link_to t("map.start_proposal"),
new_proposal_path, class: "button radius expand" %>
<%= render "shared/tag_cloud", taggable: "Proposal" %>
</aside>
</div>
</div>

View File

@@ -1,50 +0,0 @@
<div class="row">
<div class="small-12 medium-9 column margin-top">
<h1><%= t("map.title") %></h1>
<div class="row">
<div class="small-12 medium-3 column">
<ul id="geozones" class="no-bullet">
<% @geozones.each do |geozone| %>
<li><%= link_to geozone.name, proposals_path(search: geozone.name) %></li>
<% end %>
</ul>
</div>
<div class="show-for-medium medium-9 column text-center">
<%= image_tag(image_path_for("map.jpg"), usemap: "#map") %>
</div>
<map name="map" id="html_map">
<% @geozones.each do |geozone| %>
<area shape="poly"
coords="<%= geozone.html_map_coordinates %>"
href="<%= polymorphic_path(@resource, search: geozone.name) %>"
title="<%= geozone.name %>"
alt="<%= geozone.name %>">
<% end %>
</map>
</div>
<h2><%= t("map.proposal_for_district") %></h2>
<%= form_for(@resource, url: new_url_path, method: :get) do |f| %>
<div class="small-12 medium-4">
<%= f.select :geozone_id, geozone_select_options, include_blank: t("geozones.none") %>
</div>
<div class="actions small-12">
<%= f.submit(class: "button radius", value: t("map.start_proposal")) %>
</div>
<% end %>
</div>
<div class="small-12 medium-3 column">
<aside class="sidebar">
<%= link_to t("map.start_proposal"),
new_proposal_path, class: "button radius expand" %>
<%= render "shared/tag_cloud", taggable: "Proposal" %>
</aside>
</div>
</div>

View File

@@ -21,7 +21,6 @@ namespace :legislation do
put :unflag
end
collection do
get :map
get :suggest
end
end