moves search by author name to full text searches

This commit is contained in:
rgarcia
2016-01-16 22:10:17 +01:00
parent 44769d96f4
commit 82f9a656ad
7 changed files with 24 additions and 69 deletions

View File

@@ -2,7 +2,6 @@ module Filterable
extend ActiveSupport::Concern
included do
scope :by_author, -> (username) { where(users: { username: username }).joins(:author) }
scope :by_official_level, -> (official_level) { where(users: { official_level: official_level }).joins(:author) }
scope :by_date_range, -> (date_range) { where(created_at: date_range) }
end
@@ -21,7 +20,7 @@ module Filterable
def allowed_filter?(filter, value)
return if value.blank?
['author', 'official_level', 'date_range'].include?(filter)
['official_level', 'date_range'].include?(filter)
end
end

View File

@@ -68,6 +68,7 @@ class Proposal < ActiveRecord::Base
description => 'D'
}
tag_list.each{ |tag| values[tag] = 'D' }
values[author.username] = 'D'
values
end

View File

@@ -13,12 +13,6 @@
placeholder: t("shared.advanced_search.general_placeholder") %>
</div>
<div class="small-12 medium-6 advanced-search columns">
<h5 class='search-option inline-block'><%= t("shared.advanced_search.author") %></h5>
<%= text_field_tag "advanced_search[author]", params[:advanced_search].try(:[], :author),
placeholder: t("shared.advanced_search.author_placeholder") %>
</div>
<div class="small-12 medium-6 advanced-search columns">
<h5 class='search-option'><%= t("shared.advanced_search.author_type") %></h5>
<%= select_tag('advanced_search[official_level]', official_level_search_options,