tags/index: don't show aliases when search matches primary tag.
When searching e.g. "*mask*", don't show "surgical_mask <- medical_mask" because "*mask*" already matches the primary tag.
This commit is contained in:
@@ -3,4 +3,12 @@ module TagsHelper
|
||||
return nil if tag.blank?
|
||||
"tag-type-#{tag.category}"
|
||||
end
|
||||
|
||||
def tag_alias_for_pattern(tag, pattern)
|
||||
return nil if pattern.blank?
|
||||
|
||||
tag.consequent_aliases.find do |tag_alias|
|
||||
!tag.name.ilike?(pattern) && tag_alias.antecedent_name.ilike?(pattern)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user