You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
756 B

  1. # frozen_string_literal: true
  2. module Admin
  3. class CustomEmojisController < BaseController
  4. def index
  5. @custom_emojis = CustomEmoji.where(domain: nil)
  6. end
  7. def new
  8. @custom_emoji = CustomEmoji.new
  9. end
  10. def create
  11. @custom_emoji = CustomEmoji.new(resource_params)
  12. if @custom_emoji.save
  13. redirect_to admin_custom_emojis_path, notice: I18n.t('admin.custom_emojis.created_msg')
  14. else
  15. render :new
  16. end
  17. end
  18. def destroy
  19. CustomEmoji.find(params[:id]).destroy
  20. redirect_to admin_custom_emojis_path, notice: I18n.t('admin.custom_emojis.destroyed_msg')
  21. end
  22. private
  23. def resource_params
  24. params.require(:custom_emoji).permit(:shortcode, :image)
  25. end
  26. end
  27. end