Remove unused tag filter

This filter was added in commit 4285ba4b, it was changed in commit
002d8688, and most of the code from the original commit has disappeared
without a trace (maybe due to a merge conflict?).

This filter could actually be useful if we started using it when users
click on a tag. Since we don't, I'm removing it. We might add it back if
we decide to actually use it.
This commit is contained in:
Javi Martín
2020-04-08 13:21:29 +02:00
parent 54c6b413ce
commit b483d50d30
8 changed files with 5 additions and 40 deletions

View File

@@ -10,7 +10,6 @@ module CommentableActions
@resources = @current_order == "recommendations" && current_user.present? ? @resources.recommendations(current_user) : @resources.for_render @resources = @current_order == "recommendations" && current_user.present? ? @resources.recommendations(current_user) : @resources.for_render
@resources = @resources.search(@search_terms) if @search_terms.present? @resources = @resources.search(@search_terms) if @search_terms.present?
@resources = @advanced_search_terms.present? ? @resources.filter(@advanced_search_terms) : @resources @resources = @advanced_search_terms.present? ? @resources.filter(@advanced_search_terms) : @resources
@resources = @resources.tagged_with(@tag_filter) if @tag_filter
@resources = @resources.page(params[:page]).send("sort_by_#{@current_order}") @resources = @resources.page(params[:page]).send("sort_by_#{@current_order}")
@@ -103,12 +102,6 @@ module CommentableActions
@categories = Tag.category.order(:name) @categories = Tag.category.order(:name)
end end
def parse_tag_filter
if params[:tag].present?
@tag_filter = params[:tag] if Tag.named(params[:tag]).exists?
end
end
def set_resource_votes(instance) def set_resource_votes(instance)
send("set_#{resource_name}_votes", instance) send("set_#{resource_name}_votes", instance)
end end

View File

@@ -4,7 +4,6 @@ class DebatesController < ApplicationController
include FlagActions include FlagActions
include Translatable include Translatable
before_action :parse_tag_filter, only: :index
before_action :authenticate_user!, except: [:index, :show, :map] before_action :authenticate_user!, except: [:index, :show, :map]
before_action :set_view, only: :index before_action :set_view, only: :index
before_action :debates_recommendations, only: :index, if: :current_user before_action :debates_recommendations, only: :index, if: :current_user

View File

@@ -3,7 +3,6 @@ class Legislation::ProposalsController < Legislation::BaseController
include FlagActions include FlagActions
include ImageAttributes include ImageAttributes
before_action :parse_tag_filter, only: :index
before_action :load_categories, only: [:index, :new, :create, :edit, :map, :summary] before_action :load_categories, only: [:index, :new, :create, :edit, :map, :summary]
before_action :load_geozones, only: [:edit, :map, :summary] before_action :load_geozones, only: [:edit, :map, :summary]

View File

@@ -5,7 +5,6 @@ class ProposalsController < ApplicationController
include ImageAttributes include ImageAttributes
include Translatable include Translatable
before_action :parse_tag_filter, only: :index
before_action :load_categories, only: [:index, :new, :create, :edit, :map, :summary] before_action :load_categories, only: [:index, :new, :create, :edit, :map, :summary]
before_action :load_geozones, only: [: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: [:index, :show, :map, :summary]
@@ -152,7 +151,7 @@ class ProposalsController < ApplicationController
end end
def load_featured def load_featured
return unless !@advanced_search_terms && @search_terms.blank? && @tag_filter.blank? && params[:retired].blank? && @current_order != "recommendations" return unless !@advanced_search_terms && @search_terms.blank? && params[:retired].blank? && @current_order != "recommendations"
if Setting["feature.featured_proposals"] if Setting["feature.featured_proposals"]
@featured_proposals = Proposal.not_archived.unsuccessful @featured_proposals = Proposal.not_archived.unsuccessful

View File

@@ -9,7 +9,7 @@
<% end %> <% end %>
<main> <main>
<% if @search_terms || @advanced_search_terms || @tag_filter %> <% if @search_terms || @advanced_search_terms %>
<div class="highlight no-margin-top padding margin-bottom"> <div class="highlight no-margin-top padding margin-bottom">
<div class="row"> <div class="row">
<div class="small-12 column"> <div class="small-12 column">
@@ -23,12 +23,6 @@
) %> ) %>
<% end %> <% end %>
</p> </p>
<% elsif @tag_filter %>
<h2><%= t("shared.search_results") %></h2>
<p>
<%= page_entries_info @debates %>
<%= t("debates.index.filter_topic", count: @debates.size, topic: @tag_filter) %>
</p>
<% end %> <% end %>
</div> </div>
</div> </div>
@@ -50,7 +44,7 @@
<%= render "shared/banner" %> <%= render "shared/banner" %>
<% end %> <% end %>
<% unless @tag_filter || @search_terms || !has_featured? %> <% unless @search_terms || !has_featured? %>
<%= render "featured_debates" %> <%= render "featured_debates" %>
<% end %> <% end %>
@@ -81,7 +75,7 @@
<% end %> <% end %>
<%= paginate @debates %> <%= paginate @debates %>
<% unless @search_terms || @advanced_search_terms || @tag_filter %> <% unless @search_terms || @advanced_search_terms %>
<div id="section_help" class="margin" data-magellan-target="section_help"> <div id="section_help" class="margin" data-magellan-target="section_help">
<p class="lead"> <p class="lead">
<strong><%= t("debates.index.section_footer.title") %></strong> <strong><%= t("debates.index.section_footer.title") %></strong>

View File

@@ -12,7 +12,6 @@
<% if [ <% if [
@search_terms, @search_terms,
@advanced_search_terms, @advanced_search_terms,
@tag_filter,
params[:retired].present?, params[:retired].present?,
params[:selected].present? params[:selected].present?
].any? %> ].any? %>
@@ -29,12 +28,6 @@
) %> ) %>
<% end %> <% end %>
<p> <p>
<% elsif @tag_filter %>
<h2><%= t("shared.search_results") %></h2>
<p>
<%= page_entries_info @proposals %>
<%= t("proposals.index.filter_topic", count: @proposals.size, topic: @tag_filter) %>
</p>
<% elsif params[:retired].present? %> <% elsif params[:retired].present? %>
<h2><%= t("proposals.index.retired_proposals") %></h2> <h2><%= t("proposals.index.retired_proposals") %></h2>
<% elsif params[:selected].present? %> <% elsif params[:selected].present? %>
@@ -112,7 +105,7 @@
<% end %> <% end %>
<%= paginate @proposals %> <%= paginate @proposals %>
<% unless @search_terms || @advanced_search_terms || @tag_filter %> <% unless @search_terms || @advanced_search_terms %>
<div id="section_help" class="margin" data-magellan-target="section_help"> <div id="section_help" class="margin" data-magellan-target="section_help">
<p class="lead"> <p class="lead">
<strong><%= t("proposals.index.section_footer.title") %></strong> <strong><%= t("proposals.index.section_footer.title") %></strong>

View File

@@ -95,9 +95,6 @@ en:
tags_placeholder: "Enter the tags you would like to use, separated by commas (',')" tags_placeholder: "Enter the tags you would like to use, separated by commas (',')"
index: index:
featured_debates: Featured featured_debates: Featured
filter_topic:
one: " with topic '%{topic}'"
other: " with topic '%{topic}'"
orders: orders:
confidence_score: highest rated confidence_score: highest rated
created_at: newest created_at: newest
@@ -351,9 +348,6 @@ en:
map_skip_checkbox: "This proposal doesn't have a concrete location or I'm not aware of it." map_skip_checkbox: "This proposal doesn't have a concrete location or I'm not aware of it."
index: index:
featured_proposals: Featured featured_proposals: Featured
filter_topic:
one: " with topic '%{topic}'"
other: " with topic '%{topic}'"
orders: orders:
confidence_score: highest rated confidence_score: highest rated
created_at: newest created_at: newest

View File

@@ -95,9 +95,6 @@ es:
tags_placeholder: "Escribe las etiquetas que desees separadas por coma (',')" tags_placeholder: "Escribe las etiquetas que desees separadas por coma (',')"
index: index:
featured_debates: Destacar featured_debates: Destacar
filter_topic:
one: " con el tema '%{topic}'"
other: " con el tema '%{topic}'"
orders: orders:
confidence_score: Mejor valorados confidence_score: Mejor valorados
created_at: Nuevos created_at: Nuevos
@@ -351,9 +348,6 @@ es:
map_skip_checkbox: "Esta propuesta no tiene una ubicación concreta o no la conozco." map_skip_checkbox: "Esta propuesta no tiene una ubicación concreta o no la conozco."
index: index:
featured_proposals: Destacadas featured_proposals: Destacadas
filter_topic:
one: " con el tema '%{topic}'"
other: " con el tema '%{topic}'"
orders: orders:
confidence_score: Más apoyadas confidence_score: Más apoyadas
created_at: Nuevas created_at: Nuevas