From d4bd9060d61e7ed6d59c5e48c3ce398fc42eaf56 Mon Sep 17 00:00:00 2001 From: KMY Date: Tue, 17 Oct 2023 15:30:46 +0900 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E8=A6=8F=E4=BD=9C=E6=88=90=E7=94=BB?= =?UTF-8?q?=E9=9D=A2=E3=81=AB=E9=A0=85=E7=9B=AE=E8=BF=BD=E5=8A=A0=E3=80=81?= =?UTF-8?q?=E7=B7=A8=E9=9B=86=E7=94=BB=E9=9D=A2=E3=81=AB=E7=94=BB=E5=83=8F?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=80=81=E6=97=A7=E3=83=86=E3=82=AD=E3=82=B9?= =?UTF-8?q?=E3=83=88=E3=83=9C=E3=83=83=E3=82=AF=E3=82=B9=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin/custom_emojis_controller.rb | 4 ++-- app/models/form/custom_emoji_batch.rb | 5 ++--- app/views/admin/custom_emojis/edit.html.haml | 3 +++ app/views/admin/custom_emojis/index.html.haml | 6 ------ app/views/admin/custom_emojis/new.html.haml | 10 ++++++++++ 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/app/controllers/admin/custom_emojis_controller.rb b/app/controllers/admin/custom_emojis_controller.rb index 68979ad1219c3d..f0b55ce0649f47 100644 --- a/app/controllers/admin/custom_emojis_controller.rb +++ b/app/controllers/admin/custom_emojis_controller.rb @@ -67,7 +67,7 @@ def set_custom_emoji end def resource_params - params.require(:custom_emoji).permit(:shortcode, :image, :visible_in_picker) + params.require(:custom_emoji).permit(:shortcode, :image, :visible_in_picker, :aliases_raw, :license) end def update_params @@ -101,7 +101,7 @@ def action_from_button end def form_custom_emoji_batch_params - params.require(:form_custom_emoji_batch).permit(:action, :category_id, :category_name, :aliases_raw, custom_emoji_ids: []) + params.require(:form_custom_emoji_batch).permit(:action, :category_id, :category_name, custom_emoji_ids: []) end end end diff --git a/app/models/form/custom_emoji_batch.rb b/app/models/form/custom_emoji_batch.rb index 8d646c17cecb26..c63996e06950b2 100644 --- a/app/models/form/custom_emoji_batch.rb +++ b/app/models/form/custom_emoji_batch.rb @@ -6,7 +6,7 @@ class Form::CustomEmojiBatch include AccountableConcern attr_accessor :custom_emoji_ids, :action, :current_account, - :category_id, :category_name, :aliases_raw, :visible_in_picker + :category_id, :category_name, :visible_in_picker def save case action @@ -43,8 +43,7 @@ def update! end custom_emojis.each do |custom_emoji| - new_aliases_raw = (aliases_raw.presence || custom_emoji.aliases_raw) - custom_emoji.update(category_id: category&.id, aliases_raw: new_aliases_raw) + custom_emoji.update(category_id: category&.id) log_action :update, custom_emoji end end diff --git a/app/views/admin/custom_emojis/edit.html.haml b/app/views/admin/custom_emojis/edit.html.haml index c909c1f4f42201..cde13d12e54243 100644 --- a/app/views/admin/custom_emojis/edit.html.haml +++ b/app/views/admin/custom_emojis/edit.html.haml @@ -6,6 +6,9 @@ - CustomEmojiFilter::KEYS.each do |key| = hidden_field_tag key, params[key] if params[key].present? + .fields-group + = custom_emoji_tag(@custom_emoji) + %h4= t('admin.custom_emojis.shortcode') .fields-group diff --git a/app/views/admin/custom_emojis/index.html.haml b/app/views/admin/custom_emojis/index.html.haml index d103ab444548a4..8b4e93ac3594ff 100644 --- a/app/views/admin/custom_emojis/index.html.haml +++ b/app/views/admin/custom_emojis/index.html.haml @@ -75,12 +75,6 @@ .label_input = f.text_field :category_name, class: 'string optional', placeholder: t('admin.custom_emojis.create_new_category'), 'aria-label': t('admin.custom_emojis.create_new_category') - .fields-row - .fields-group.fields-row__column - .input.string.optional - .label_input - = f.text_field :aliases_raw, class: 'string optional', placeholder: 'Alias names', 'aria-label': 'Alias names' - .batch-table__body - if @custom_emojis.empty? = nothing_here 'nothing-here--under-tabs' diff --git a/app/views/admin/custom_emojis/new.html.haml b/app/views/admin/custom_emojis/new.html.haml index 95996dec86164d..e1261e7f50080c 100644 --- a/app/views/admin/custom_emojis/new.html.haml +++ b/app/views/admin/custom_emojis/new.html.haml @@ -6,8 +6,18 @@ .fields-group = f.input :shortcode, wrapper: :with_label, label: t('admin.custom_emojis.shortcode'), hint: t('admin.custom_emojis.shortcode_hint') + .fields-group = f.input :image, wrapper: :with_label, input_html: { accept: CustomEmoji::IMAGE_MIME_TYPES.join(' ') }, hint: t('admin.custom_emojis.image_hint', size: number_to_human_size(CustomEmoji::LIMIT)) + .fields-group + = f.input :visible_in_picker, as: :boolean, wrapper: :with_label, label: t('admin.custom_emojis.visible_in_picker') + + .fields-group + = f.input :aliases_raw, wrapper: :with_label, kmyblue: true, label: t('admin.custom_emojis.aliases'), hint: t('admin.custom_emojis.aliases_hint') + + .fields-group + = f.input :license, wrapper: :with_label, kmyblue: true, label: t('admin.custom_emojis.license'), hint: t('admin.custom_emojis.license_hint') + .actions = f.button :button, t('admin.custom_emojis.upload'), type: :submit