Order emoji categories (in admin interface) by name (#33630)

This commit is contained in:
Jonathan de Jong 2025-01-22 09:31:51 +01:00 committed by GitHub
parent 3dcf5e12b1
commit e380e803a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View File

@ -14,4 +14,6 @@ class CustomEmojiCategory < ApplicationRecord
has_many :emojis, class_name: 'CustomEmoji', foreign_key: 'category_id', inverse_of: :category, dependent: nil
validates :name, presence: true, uniqueness: true
scope :alphabetic, -> { order(name: :asc) }
end

View File

@ -72,7 +72,7 @@
.input.select.optional
.label_input
= f.select :category_id,
options_from_collection_for_select(CustomEmojiCategory.all, 'id', 'name'),
options_from_collection_for_select(CustomEmojiCategory.alphabetic.all, 'id', 'name'),
'aria-label': t('admin.custom_emojis.assign_category'),
class: 'select optional',
prompt: t('admin.custom_emojis.assign_category')