Advanced search added to debates
This commit is contained in:
@@ -3,6 +3,7 @@ class DebatesController < ApplicationController
|
||||
include FlagActions
|
||||
|
||||
before_action :parse_search_terms, only: :index
|
||||
before_action :parse_advanced_search_terms, only: :index
|
||||
before_action :parse_tag_filter, only: :index
|
||||
before_action :set_search_order, only: :index
|
||||
before_action :authenticate_user!, except: [:index, :show]
|
||||
|
||||
@@ -11,10 +11,12 @@
|
||||
|
||||
<div class="filters">
|
||||
<div class="small-12 medium-7 left">
|
||||
<% if @search_terms %>
|
||||
<% if @search_terms || @advanced_search_present %>
|
||||
<h2 class="margin-top">
|
||||
<%= page_entries_info @debates %>
|
||||
<%= t("debates.index.search_results", count: @debates.size, search_term: @search_terms) %>
|
||||
<% if !@advanced_search_present %>
|
||||
<%= t("debates.index.search_results", count: @debates.size, search_term: @search_terms) %>
|
||||
<% end %>
|
||||
</h2>
|
||||
<% elsif @tag_filter %>
|
||||
<h2 class="margin-top">
|
||||
@@ -30,6 +32,27 @@
|
||||
|
||||
<%= render 'shared/order_links', i18n_namespace: "debates.index" %>
|
||||
|
||||
<% if @tag_filter || @search_terms || @advanced_search_present %>
|
||||
<div class="small-12 medium-5 margin-top inline-block debates-order">
|
||||
<h6 class="inline-block">
|
||||
<%= t("debates.index.select_order") %>
|
||||
</h6>
|
||||
<%= render 'shared/order_selector', i18n_namespace: "debates.index" %>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="small-12 inline-block">
|
||||
<h2 class="inline-block">
|
||||
<%= t("debates.index.select_order_long") %>
|
||||
</h2>
|
||||
<%= render 'shared/order_selector', i18n_namespace: "debates.index" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="small-12 medium-12 advanced-search row">
|
||||
<%= render "shared/advanced_search",
|
||||
search_path: debates_path(page: 1) %>
|
||||
</div>
|
||||
|
||||
<div class="show-for-small-only">
|
||||
<%= link_to t("debates.index.start_debate"), new_debate_path, class: 'button radius expand' %>
|
||||
</div>
|
||||
|
||||
@@ -44,8 +44,7 @@
|
||||
|
||||
<div class="small-12 medium-12 advanced-search row">
|
||||
<%= render "shared/advanced_search",
|
||||
search_path: proposals_path(page: 1),
|
||||
i18n_namespace: "proposals.index.search_form" %>
|
||||
search_path: proposals_path(page: 1)%>
|
||||
</div>
|
||||
|
||||
<div class="show-for-small-only">
|
||||
|
||||
@@ -1,40 +1,39 @@
|
||||
<% # Params:
|
||||
#
|
||||
# i18n_namespace: for example "proposals.index.advanced_search"
|
||||
# search_path: for example proposals_path
|
||||
%>
|
||||
|
||||
<div class="small-12 medium-12 columns">
|
||||
<h4 class='advanced-search-title'><%= t("proposals.index.advanced_search.title") %></h4>
|
||||
<h4 class='advanced-search-title'><%= t("shared.advanced_search.title") %></h4>
|
||||
</div>
|
||||
|
||||
<%= form_tag search_path, method: :get do %>
|
||||
<div id='advanced-search'>
|
||||
|
||||
<div class="small-12 medium-12 advanced-search columns">
|
||||
<h5 class='search-option inline-block'><%= t("proposals.index.advanced_search.general") %></h5>
|
||||
<%= text_field_tag "search", @search_terms, placeholder: t("proposals.index.advanced_search.general") %>
|
||||
<h5 class='search-option inline-block'><%= t("shared.advanced_search.general") %></h5>
|
||||
<%= text_field_tag "search", @search_terms, placeholder: t("shared.advanced_search.general") %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-6 advanced-search columns">
|
||||
<h5 class='search-option inline-block'><%= t("proposals.index.advanced_search.author") %></h5>
|
||||
<%= text_field_tag "advanced_search[author]", @params_author, placeholder: t("proposals.index.advanced_search.author_placeholder") %>
|
||||
<h5 class='search-option inline-block'><%= t("shared.advanced_search.author") %></h5>
|
||||
<%= text_field_tag "advanced_search[author]", @params_author, placeholder: t("shared.advanced_search.author_placeholder") %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-6 advanced-search columns">
|
||||
<h5 class='search-option'><%= t("proposals.index.advanced_search.author_type") %></h5>
|
||||
<%= select_tag('advanced_search[author_type]', options_for_select([[t("proposals.index.advanced_search.author_type_1"), 1], [t("proposals.index.advanced_search.author_type_2"), 2],[t("proposals.index.advanced_search.author_type_3"), 3],[t("proposals.index.advanced_search.author_type_4"), 4],[t("proposals.index.advanced_search.author_type_5"), 5]], @params_author_type), include_blank: t("proposals.index.advanced_search.author_type_blank")) %>
|
||||
<h5 class='search-option'><%= t("shared.advanced_search.author_type") %></h5>
|
||||
<%= select_tag('advanced_search[author_type]', options_for_select([[t("shared.advanced_search.author_type_1"), 1], [t("shared.advanced_search.author_type_2"), 2],[t("shared.advanced_search.author_type_3"), 3],[t("shared.advanced_search.author_type_4"), 4],[t("shared.advanced_search.author_type_5"), 5]], @params_author_type), include_blank: t("shared.advanced_search.author_type_blank")) %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 advanced-search columns">
|
||||
<h5 class='search-option'><%= t("proposals.index.advanced_search.date") %></h5>
|
||||
<%= select_tag('advanced_search[date]', options_for_select([[t("proposals.index.advanced_search.date_1"), 1], [t("proposals.index.advanced_search.date_2"), 2], [t("proposals.index.advanced_search.date_3"), 3],[t("proposals.index.advanced_search.date_4"), 4], [t("proposals.index.advanced_search.date_5"), 5]], @params_date), include_blank: 'Elige una fecha') %>
|
||||
<h5 class='search-option'><%= t("shared.advanced_search.date") %></h5>
|
||||
<%= select_tag('advanced_search[date]', options_for_select([[t("shared.advanced_search.date_1"), 1], [t("shared.advanced_search.date_2"), 2], [t("shared.advanced_search.date_3"), 3],[t("shared.advanced_search.date_4"), 4], [t("shared.advanced_search.date_5"), 5]], @params_date), include_blank: 'Elige una fecha') %>
|
||||
<div class='customized-date inline-block'>
|
||||
<%= t("proposals.index.advanced_search.from") %>:
|
||||
<%= t("shared.advanced_search.from") %>:
|
||||
<div class='inline-block'>
|
||||
<%= date_field 'advanced_search', 'date_min', max:Date.today, value: @params_date_min %>
|
||||
</div>
|
||||
<%= t("proposals.index.advanced_search.to") %>:
|
||||
<%= t("shared.advanced_search.to") %>:
|
||||
<div class='inline-block'>
|
||||
<%= date_field 'advanced_search', 'date_max', max:Date.today, value: @params_date_max %>
|
||||
</div>
|
||||
@@ -43,7 +42,7 @@
|
||||
|
||||
|
||||
<div class="small-6 medium-3 offset advanced-search columns">
|
||||
<%= submit_tag t("proposals.index.advanced_search.search"), class: 'button postfix' %>
|
||||
<%= submit_tag t("shared.advanced_search.search"), class: 'button postfix' %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -180,28 +180,6 @@ en:
|
||||
search_results:
|
||||
one: " containing the term '%{search_term}'"
|
||||
other: " containing the term '%{search_term}'"
|
||||
advanced_search:
|
||||
title: 'Advanced search'
|
||||
general: 'With the text'
|
||||
general_placeholder: 'Write the text'
|
||||
author: 'By author name'
|
||||
author_placeholder: 'Write the author name'
|
||||
author_type: 'By author category'
|
||||
author_type_blank: 'Select a category'
|
||||
author_type_1: 'Public employee'
|
||||
author_type_2: 'Municipal Organization'
|
||||
author_type_3: 'General director'
|
||||
author_type_4: 'City councillor'
|
||||
author_type_5: 'Mayoress'
|
||||
date: 'By date'
|
||||
date_1: 'Last 24 hours'
|
||||
date_2: 'Last week'
|
||||
date_3: 'Last 30 days'
|
||||
date_4: 'Last year'
|
||||
date_5: 'Customized'
|
||||
from: 'From'
|
||||
to: 'To'
|
||||
search: 'Search'
|
||||
proposal:
|
||||
proposal: "Proposal"
|
||||
support: "Support"
|
||||
@@ -395,6 +373,28 @@ en:
|
||||
check: "Select"
|
||||
check_all: "All"
|
||||
check_none: "None"
|
||||
advanced_search:
|
||||
title: 'Advanced search'
|
||||
general: 'With the text'
|
||||
general_placeholder: 'Write the text'
|
||||
author: 'By author name'
|
||||
author_placeholder: 'Write the author name'
|
||||
author_type: 'By author category'
|
||||
author_type_blank: 'Select a category'
|
||||
author_type_1: 'Public employee'
|
||||
author_type_2: 'Municipal Organization'
|
||||
author_type_3: 'General director'
|
||||
author_type_4: 'City councillor'
|
||||
author_type_5: 'Mayoress'
|
||||
date: 'By date'
|
||||
date_1: 'Last 24 hours'
|
||||
date_2: 'Last week'
|
||||
date_3: 'Last 30 days'
|
||||
date_4: 'Last year'
|
||||
date_5: 'Customized'
|
||||
from: 'From'
|
||||
to: 'To'
|
||||
search: 'Search'
|
||||
users:
|
||||
show:
|
||||
filters:
|
||||
|
||||
@@ -180,28 +180,6 @@ es:
|
||||
search_results:
|
||||
one: " que contiene '%{search_term}'"
|
||||
other: " que contienen '%{search_term}'"
|
||||
advanced_search:
|
||||
title: 'Búsqueda avanzada'
|
||||
general: 'Con el texto'
|
||||
general_placeholder: 'Escribe el texto'
|
||||
author: 'Por nombre de autor'
|
||||
author_placeholder: 'Escribe el nombre del autor'
|
||||
author_type: 'Por categoría de autor'
|
||||
author_type_blank: 'Elige una categoría'
|
||||
author_type_1: 'Empleado público'
|
||||
author_type_2: 'Organización Municipal'
|
||||
author_type_3: 'Director general'
|
||||
author_type_4: 'Concejal'
|
||||
author_type_5: 'Alcaldesa'
|
||||
date: 'Por fecha'
|
||||
date_1: 'Últimas 24 horas'
|
||||
date_2: 'Última semana'
|
||||
date_3: 'Últimos 30 días'
|
||||
date_4: 'Último año'
|
||||
date_5: 'Personalizada'
|
||||
from: 'Desde'
|
||||
to: 'Hasta'
|
||||
search: 'Buscar'
|
||||
proposal:
|
||||
proposal: "Propuesta"
|
||||
support: "Apoyar"
|
||||
@@ -395,6 +373,28 @@ es:
|
||||
check: "Seleccionar"
|
||||
check_all: "Todos"
|
||||
check_none: "Ninguno"
|
||||
advanced_search:
|
||||
title: 'Búsqueda avanzada'
|
||||
general: 'Con el texto'
|
||||
general_placeholder: 'Escribe el texto'
|
||||
author: 'Por nombre de autor'
|
||||
author_placeholder: 'Escribe el nombre del autor'
|
||||
author_type: 'Por categoría de autor'
|
||||
author_type_blank: 'Elige una categoría'
|
||||
author_type_1: 'Empleado público'
|
||||
author_type_2: 'Organización Municipal'
|
||||
author_type_3: 'Director general'
|
||||
author_type_4: 'Concejal'
|
||||
author_type_5: 'Alcaldesa'
|
||||
date: 'Por fecha'
|
||||
date_1: 'Últimas 24 horas'
|
||||
date_2: 'Última semana'
|
||||
date_3: 'Últimos 30 días'
|
||||
date_4: 'Último año'
|
||||
date_5: 'Personalizada'
|
||||
from: 'Desde'
|
||||
to: 'Hasta'
|
||||
search: 'Buscar'
|
||||
users:
|
||||
show:
|
||||
filters:
|
||||
|
||||
Reference in New Issue
Block a user