* app/helpers i18n * tidy key names * fix keys * delete ja.yml * fix spec * fix spec 2 * fix for PR * remove one key for PR * delete ja.yml
19 lines
544 B
Ruby
19 lines
544 B
Ruby
module ListingHelper
|
|
def select_options_for_categories
|
|
ListingCategory.select(:id, :name, :cost).map do |cl|
|
|
[I18n.t("helpers.listing_helper.option", cl_name: cl.name, count: 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
|