forked from OpenNeo/impress
Simplify standard_species_search_links helper
The `build_on_pet_types` helper used to be reused on the items page, to generate the list of species to display. We don't use it anymore, so simplify and remove!
This commit is contained in:
parent
e67830642c
commit
6312253b82
1 changed files with 3 additions and 11 deletions
|
@ -31,11 +31,12 @@ module ItemsHelper
|
|||
end
|
||||
|
||||
def standard_species_search_links
|
||||
build_on_pet_types(Species.alphabetical) do |pet_type|
|
||||
all_species = Species.alphabetical.map(&:id)
|
||||
PetType.random_basic_per_species(all_species).map do |pet_type|
|
||||
image = pet_type_image(pet_type, :happy, :zoom)
|
||||
query = "species:#{pet_type.species.name}"
|
||||
link_to(image, items_path(:q => query))
|
||||
end
|
||||
end.join.html_safe
|
||||
end
|
||||
|
||||
def closet_list_verb(owned)
|
||||
|
@ -219,15 +220,6 @@ module ItemsHelper
|
|||
|
||||
private
|
||||
|
||||
def build_on_pet_types(species, special_color=nil, &block)
|
||||
species_ids = species.map(&:id)
|
||||
pet_types = special_color ?
|
||||
PetType.where(:color_id => special_color.id, :species_id => species_ids).
|
||||
order(:species_id) :
|
||||
PetType.random_basic_per_species(species.map(&:id))
|
||||
pet_types.map(&block).join.html_safe
|
||||
end
|
||||
|
||||
def pet_type_image(pet_type, emotion, size)
|
||||
src = pet_type_image_url(pet_type, emotion:, size:)
|
||||
human_name = pet_type.species.name.humanize
|
||||
|
|
Loading…
Reference in a new issue