Add: カスタム絵文字の専用編集画面/Fix: リモートの絵文字をローカルにコピー時、ライセンス情報が消失する問題 (#133)
* Add: カスタム絵文字の専用編集画面 * 新規作成画面に項目追加、編集画面に画像表示、旧テキストボックス削除 * Fix: カスタム絵文字のコピー処理で、コピーされていないプロパティがあった
This commit is contained in:
parent
72d18cb16d
commit
4735d23c21
10 changed files with 115 additions and 14 deletions
|
@ -2,6 +2,8 @@
|
|||
|
||||
module Admin
|
||||
class CustomEmojisController < BaseController
|
||||
before_action :set_custom_emoji, only: [:edit, :update]
|
||||
|
||||
def index
|
||||
authorize :custom_emoji, :index?
|
||||
|
||||
|
@ -15,6 +17,10 @@ module Admin
|
|||
@custom_emoji = CustomEmoji.new
|
||||
end
|
||||
|
||||
def edit
|
||||
authorize :custom_emoji, :create?
|
||||
end
|
||||
|
||||
def create
|
||||
authorize :custom_emoji, :create?
|
||||
|
||||
|
@ -28,6 +34,19 @@ module Admin
|
|||
end
|
||||
end
|
||||
|
||||
def update
|
||||
authorize :custom_emoji, :create?
|
||||
|
||||
@custom_emoji.assign_attributes(update_params)
|
||||
|
||||
if @custom_emoji.save
|
||||
log_action :create, @custom_emoji
|
||||
redirect_to admin_custom_emojis_path(filter_params), notice: I18n.t('admin.custom_emojis.updated_msg')
|
||||
else
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
def batch
|
||||
authorize :custom_emoji, :index?
|
||||
|
||||
|
@ -43,8 +62,16 @@ module Admin
|
|||
|
||||
private
|
||||
|
||||
def set_custom_emoji
|
||||
@custom_emoji = CustomEmoji.find(params[:id])
|
||||
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
|
||||
params.require(:custom_emoji).permit(:visible_in_picker, :aliases_raw, :license)
|
||||
end
|
||||
|
||||
def filtered_custom_emojis
|
||||
|
@ -74,7 +101,7 @@ module Admin
|
|||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue