module EntriesHelper def alphabet_letters(language_code) return ("A".."Z").to_a if language_code.blank? case language_code.to_s when "ru" %w[ А Б В Г Д Е Ё Ж З И Й К Л М Н О П Р С Т У Ф Х Ц Ч Ш Щ Ъ Ы Ь Э Ю Я ] when "no" ("A".."Z").to_a + %w[Æ Ø Å] when "sv" ("A".."Z").to_a + %w[Å Ä Ö] when "fi" ("A".."Z").to_a + %w[Å Ä Ö] else ("A".."Z").to_a end end def entry_translation_for(entry, language_code) language_column = language_code.to_s return unless entry.has_attribute?(language_column) entry.public_send(language_column) end def format_entry_category(entry) entry.category.to_s.tr("_", " ").capitalize end def format_entry_status(entry) case entry.status when "requested" content_tag(:span, "Requested", class: "px-2 py-1 text-xs font-semibold rounded-full bg-yellow-100 text-yellow-800") when "approved" content_tag(:span, "Approved", class: "px-2 py-1 text-xs font-semibold rounded-full bg-blue-100 text-blue-800") when "active" content_tag(:span, "Active", class: "px-2 py-1 text-xs font-semibold rounded-full bg-green-100 text-green-800") end end end