Remove unused legislation proposals index action

The `legislation_proposals#index` action was never used because it used
the same URL as `legislation_processes#proposals`.

In commit 702bfec24 we removed the view, but we forgot to remove the
controller action, the route, and some partials which were rendered from
the index view.
This commit is contained in:
Javi Martín
2021-09-28 18:45:31 +02:00
parent 5b70c3d89c
commit 0bacd5baf3
9 changed files with 3 additions and 98 deletions

View File

@@ -3,16 +3,15 @@ class Legislation::ProposalsController < Legislation::BaseController
include FlagActions
include ImageAttributes
before_action :load_categories, only: [:index, :new, :create, :edit, :map, :summary]
before_action :load_categories, only: [:new, :create, :edit, :map, :summary]
before_action :load_geozones, only: [:edit, :map, :summary]
before_action :authenticate_user!, except: [:index, :show, :map, :summary]
before_action :authenticate_user!, except: [:show, :map, :summary]
load_and_authorize_resource :process, class: "Legislation::Process"
load_and_authorize_resource :proposal, class: "Legislation::Proposal", through: :process
invisible_captcha only: [:create, :update], honeypot: :subtitle
has_orders %w[confidence_score created_at], only: :index
has_orders %w[most_voted newest oldest], only: :show
helper_method :resource_model, :resource_name
@@ -38,11 +37,6 @@ class Legislation::ProposalsController < Legislation::BaseController
end
end
def index_customization
load_successful_proposals
load_featured unless @proposal_successful_exists
end
def vote
@proposal.register_vote(current_user, params[:value])
legislation_proposal_votes(@proposal)
@@ -65,8 +59,4 @@ class Legislation::ProposalsController < Legislation::BaseController
def resource_name
"proposal"
end
def load_successful_proposals
@proposal_successful_exists = Legislation::Proposal.successful.exists?
end
end

View File

@@ -88,7 +88,6 @@ module Abilities
can :vote_featured, Proposal
can :vote, Legislation::Proposal
can :vote_featured, Legislation::Proposal
can :create, Legislation::Answer
can :create, Budget::Investment, budget: { phase: "accepting" }

View File

@@ -1,27 +0,0 @@
<div id="<%= dom_id(proposal) %>" class="proposal-featured clear">
<div class="small-12 medium-9 column">
<h3><%= link_to proposal.title, proposal %></h3>
<div class="info">
<% if proposal.author.hidden? || proposal.author.erased? %>
<%= t("proposals.show.author_deleted") %>
<% else %>
<%= proposal.author.name %>
<% end %>
&nbsp;&bull;&nbsp;
<% if proposal.author.display_official_position_badge? %>
<span class="label round level-<%= proposal.author.official_level %>">
<%= proposal.author.official_position %>
</span>
&nbsp;&bull;&nbsp;
<% end %>
<strong><%= t("proposals.proposal.votes", count: proposal.total_votes) %></strong>
</div>
</div>
<div id="<%= dom_id(proposal) %>_votes" class="small-12 medium-3 column">
<%= render "featured_votes", proposal: proposal %>
</div>
</div>

View File

@@ -1,43 +0,0 @@
<div class="supports text-center">
<div class="in-favor">
<% if voted_for?(@featured_proposals_votes, proposal) %>
<div class="supported">
<%= t("proposals.proposal.already_supported") %>
</div>
<% else %>
<%= link_to vote_featured_proposal_path(proposal, value: "yes"),
class: "button button-support small expanded",
title: t("proposals.proposal.support_title"), method: "post", remote: true do %>
<%= t("proposals.proposal.support") %>
<% end %>
<% end %>
</div>
<% if user_signed_in? && current_user.organization? %>
<div class="participation-not-allowed" style="display:none" aria-hidden="false">
<p>
<%= t("votes.organizations") %>
</p>
</div>
<% elsif user_signed_in? && !proposal.votable_by?(current_user) %>
<div class="participation-not-allowed" style="display:none" aria-hidden="false">
<p>
<%= sanitize(t("votes.verified_only", verify_account: link_to_verify_account)) %>
</p>
</div>
<% elsif !user_signed_in? %>
<%= render "shared/login_to_vote" %>
<% end %>
<% if voted_for?(@featured_proposals_votes, proposal) %>
<% if setting["twitter_handle"] %>
<div class="share-supported">
<%= render "shared/social_share",
title: proposal.title,
url: proposal_url(proposal),
description: proposal.summary,
mobile: proposal.title %>
</div>
<% end %>
<% end %>
</div>

View File

@@ -1,6 +0,0 @@
<div class="sidebar-divider"></div>
<h2 class="sidebar-title"><%= t("shared.tags_cloud.districts") %></h2>
<br>
<%= link_to map_proposals_path, id: "map", title: t("shared.tags_cloud.districts_list") do %>
<%= image_tag(image_path_for("map.jpg", alt: t("shared.tags_cloud.districts_list"))) %>
<% end %>

View File

@@ -1,6 +0,0 @@
<div class="sidebar-divider"></div>
<h2 class="sidebar-title"><%= t("proposals.index.top") %></h2>
<p>
<%= link_to t("proposals.index.top_link_proposals"), summary_proposals_path, class: "small" %><br>
</p>

View File

@@ -376,7 +376,6 @@ en:
select_order_long: "You are viewing proposals according to:"
start_proposal: Create a proposal
title: Proposals
top: Top weekly
top_link_proposals: The most supported proposals by category
section_header:
icon_alt: Proposals icon

View File

@@ -376,7 +376,6 @@ es:
select_order_long: "Estas viendo las propuestas"
start_proposal: Crea una propuesta
title: Propuestas ciudadanas
top: Top semanal
top_link_proposals: Propuestas más apoyadas por categoría
section_header:
icon_alt: Icono de Propuestas

View File

@@ -14,7 +14,7 @@ namespace :legislation do
resources :answers, only: [:create]
end
resources :proposals do
resources :proposals, except: [:index] do
member do
post :vote
put :flag