This commit is contained in:
Toks
2015-08-26 11:26:40 -04:00
parent 92c68db37a
commit c316274008
2 changed files with 15 additions and 0 deletions

View File

@@ -692,6 +692,12 @@ class Tag < ActiveRecord::Base
q = q.joins("LEFT JOIN wiki_pages ON tags.name = wiki_pages.title").where("wiki_pages.title IS NULL")
end
if params[:has_artist] == "yes"
q = q.joins("INNER JOIN artists ON tags.name = artists.name").where("artists.is_active = true")
elsif params[:has_artist] == "no"
q = q.joins("LEFT JOIN artists ON tags.name = artists.name").where("artists.name IS NULL OR artists.is_active = false")
end
params[:order] ||= params.delete(:sort)
case params[:order]
when "name"

View File

@@ -47,6 +47,15 @@
</td>
</tr>
<tr>
<th><label for="search_has_artist">Has an Artist Entry</label></th>
<td>
<div class="input">
<%= select "search", "has_artist", ["yes", "no"], :selected => params[:search][:has_artist], :include_blank => true %>
</div>
</td>
</tr>
<tr>
<td><%= submit_tag "Search" %><td>
</tr>