Add wiki search option for whether other names are present
This commit is contained in:
@@ -63,6 +63,12 @@ class WikiPage < ActiveRecord::Base
|
||||
q = q.where("creator_id = (select _.id from users _ where lower(_.name) = ?)", params[:creator_name].tr(" ", "_").mb_chars.downcase)
|
||||
end
|
||||
|
||||
if params[:other_names_present] == "yes"
|
||||
q = q.where("other_names is not null and other_names != ''")
|
||||
elsif params[:other_names_present] == "no"
|
||||
q = q.where("other_names is null or other_names = ''")
|
||||
end
|
||||
|
||||
params[:order] ||= params.delete(:sort)
|
||||
if params[:order] == "time" || params[:order] == "Date"
|
||||
q = q.order("updated_at desc")
|
||||
|
||||
@@ -6,6 +6,11 @@
|
||||
<%= search_field "body_matches", :label => "Body" %>
|
||||
<%= search_field "other_names_match", :label => "Other names" %>
|
||||
|
||||
<div class="input">
|
||||
<label for="search_other_names_present">Other names present?</label>
|
||||
<%= select "search", "other_names_present", ["yes", "no"], :include_blank => true %>
|
||||
</div>
|
||||
|
||||
<div class="input">
|
||||
<label for="search_order">Order</label>
|
||||
<%= select "search", "order", ["Name", "Date"] %>
|
||||
|
||||
Reference in New Issue
Block a user