* Change models and related files * Update controllers and specs * More renaming * Seek and destroy, I mean search and replace * Round up the stragglers * Ground control to Major Travis... * More fixes * PR feedback * Various fixes * Rename view * Fix list query builder * Unify request specs * Fix some API spec errors * Fix remaining API specs * Make spec conform to API * Fix leftover problems * Fix JS tests * Fix column name in select * Fix API specs * Fix search specs * Paging Mr. Travis
19 lines
527 B
Ruby
19 lines
527 B
Ruby
module ListingHelper
|
|
def select_options_for_categories
|
|
ListingCategory.select(:id, :name, :cost).map do |cl|
|
|
["#{cl.name} (#{cl.cost} #{'Credit'.pluralize(cl.cost)})", cl.id]
|
|
end
|
|
end
|
|
|
|
def categories_for_display
|
|
ListingCategory.pluck(:slug, :name).map do |slug, name|
|
|
{ slug: slug, name: name }
|
|
end
|
|
end
|
|
|
|
def categories_available
|
|
ListingCategory.all.each_with_object({}) do |cat, h|
|
|
h[cat.slug] = cat.attributes.slice("cost", "name", "rules")
|
|
end.deep_symbolize_keys
|
|
end
|
|
end
|