forked from OpenNeo/impress
Add is:pb back to item search
This commit is contained in:
parent
4d722dd5c5
commit
d12b21896c
2 changed files with 20 additions and 0 deletions
|
@ -65,6 +65,16 @@ class Item < ActiveRecord::Base
|
|||
condition = i[:rarity_index].in(Item::NCRarities).or(i[:is_manually_nc])
|
||||
where(condition.not)
|
||||
}
|
||||
scope :is_pb, -> {
|
||||
Item.joins(:translations).where('locale = ?', 'en').
|
||||
where('description LIKE ?',
|
||||
'%' + Item.sanitize_sql_like(PAINTBRUSH_SET_DESCRIPTION) + '%')
|
||||
}
|
||||
scope :is_not_pb, -> {
|
||||
Item.joins(:translations).where('locale = ?', 'en').
|
||||
where('description NOT LIKE ?',
|
||||
'%' + Item.sanitize_sql_like(PAINTBRUSH_SET_DESCRIPTION) + '%')
|
||||
}
|
||||
|
||||
def closeted?
|
||||
@owned || @wanted
|
||||
|
|
|
@ -44,6 +44,8 @@ class Item
|
|||
filters << (is_positive ? Filter.is_nc : Filter.is_not_nc)
|
||||
when 'np'
|
||||
filters << (is_positive ? Filter.is_np : Filter.is_not_np)
|
||||
when 'pb'
|
||||
filters << (is_positive ? Filter.is_pb : Filter.is_not_pb)
|
||||
else
|
||||
message = I18n.translate('items.search.errors.not_found.label',
|
||||
:label => "is:#{value}")
|
||||
|
@ -114,6 +116,14 @@ class Item
|
|||
def self.is_not_np
|
||||
self.new Item.is_nc, '-is:np'
|
||||
end
|
||||
|
||||
def self.is_pb
|
||||
self.new Item.is_pb, 'is:pb'
|
||||
end
|
||||
|
||||
def self.is_not_pb
|
||||
self.new Item.is_not_pb, '-is:pb'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue