diff --git a/app/models/custom_emoji_category.rb b/app/models/custom_emoji_category.rb index f480746517..dfcc156080 100644 --- a/app/models/custom_emoji_category.rb +++ b/app/models/custom_emoji_category.rb @@ -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 diff --git a/app/views/admin/custom_emojis/index.html.haml b/app/views/admin/custom_emojis/index.html.haml index 81b050a047..b9e11a17d1 100644 --- a/app/views/admin/custom_emojis/index.html.haml +++ b/app/views/admin/custom_emojis/index.html.haml @@ -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')