Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused tag filter #3966

Merged
merged 1 commit into from
Apr 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 0 additions & 7 deletions app/controllers/concerns/commentable_actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ def index
@resources = @current_order == "recommendations" && current_user.present? ? @resources.recommendations(current_user) : @resources.for_render
@resources = @resources.search(@search_terms) if @search_terms.present?
@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}")

Expand Down Expand Up @@ -103,12 +102,6 @@ def load_categories
@categories = Tag.category.order(:name)
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)
send("set_#{resource_name}_votes", instance)
end
Expand Down
1 change: 0 additions & 1 deletion app/controllers/debates_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ class DebatesController < ApplicationController
include FlagActions
include Translatable

before_action :parse_tag_filter, only: :index
before_action :authenticate_user!, except: [:index, :show, :map]
before_action :set_view, only: :index
before_action :debates_recommendations, only: :index, if: :current_user
Expand Down
1 change: 0 additions & 1 deletion app/controllers/legislation/proposals_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ class Legislation::ProposalsController < Legislation::BaseController
include FlagActions
include ImageAttributes

before_action :parse_tag_filter, only: :index
before_action :load_categories, only: [:index, :new, :create, :edit, :map, :summary]
before_action :load_geozones, only: [:edit, :map, :summary]

Expand Down
3 changes: 1 addition & 2 deletions app/controllers/proposals_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ class ProposalsController < ApplicationController
include ImageAttributes
include Translatable

before_action :parse_tag_filter, only: :index
before_action :load_categories, only: [:index, :new, :create, :edit, :map, :summary]
before_action :load_geozones, only: [:edit, :map, :summary]
before_action :authenticate_user!, except: [:index, :show, :map, :summary]
Expand Down Expand Up @@ -152,7 +151,7 @@ def load_selected
end

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"
javierm marked this conversation as resolved.
Show resolved Hide resolved

if Setting["feature.featured_proposals"]
@featured_proposals = Proposal.not_archived.unsuccessful
Expand Down
12 changes: 3 additions & 9 deletions app/views/debates/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<% end %>

<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="row">
<div class="small-12 column">
Expand All @@ -23,12 +23,6 @@
) %>
<% end %>
</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 %>
</div>
</div>
Expand All @@ -50,7 +44,7 @@
<%= render "shared/banner" %>
<% end %>

<% unless @tag_filter || @search_terms || !has_featured? %>
<% unless @search_terms || !has_featured? %>
<%= render "featured_debates" %>
<% end %>

Expand Down Expand Up @@ -81,7 +75,7 @@
<% end %>
<%= 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">
<p class="lead">
<strong><%= t("debates.index.section_footer.title") %></strong>
Expand Down
9 changes: 1 addition & 8 deletions app/views/proposals/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<% if [
@search_terms,
@advanced_search_terms,
@tag_filter,
params[:retired].present?,
params[:selected].present?
].any? %>
Expand All @@ -29,12 +28,6 @@
) %>
<% end %>
<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? %>
<h2><%= t("proposals.index.retired_proposals") %></h2>
<% elsif params[:selected].present? %>
Expand Down Expand Up @@ -112,7 +105,7 @@
<% end %>
<%= 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">
<p class="lead">
<strong><%= t("proposals.index.section_footer.title") %></strong>
Expand Down
6 changes: 0 additions & 6 deletions config/locales/en/general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ en:
tags_placeholder: "Enter the tags you would like to use, separated by commas (',')"
index:
featured_debates: Featured
filter_topic:
one: " with topic '%{topic}'"
other: " with topic '%{topic}'"
orders:
confidence_score: highest rated
created_at: newest
Expand Down Expand Up @@ -351,9 +348,6 @@ en:
map_skip_checkbox: "This proposal doesn't have a concrete location or I'm not aware of it."
index:
featured_proposals: Featured
filter_topic:
one: " with topic '%{topic}'"
other: " with topic '%{topic}'"
orders:
confidence_score: highest rated
created_at: newest
Expand Down
6 changes: 0 additions & 6 deletions config/locales/es/general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ es:
tags_placeholder: "Escribe las etiquetas que desees separadas por coma (',')"
index:
featured_debates: Destacar
filter_topic:
one: " con el tema '%{topic}'"
other: " con el tema '%{topic}'"
orders:
confidence_score: Mejor valorados
created_at: Nuevos
Expand Down Expand Up @@ -351,9 +348,6 @@ es:
map_skip_checkbox: "Esta propuesta no tiene una ubicación concreta o no la conozco."
index:
featured_proposals: Destacadas
filter_topic:
one: " con el tema '%{topic}'"
other: " con el tema '%{topic}'"
orders:
confidence_score: Más apoyadas
created_at: Nuevas
Expand Down