The code powering m.abunchtell.com https://m.abunchtell.com
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.
 
 
 
 

37 lines
974 B

  1. # frozen_string_literal: true
  2. module Admin
  3. class AccountActionsController < BaseController
  4. before_action :set_account
  5. def new
  6. @account_action = Admin::AccountAction.new(type: params[:type], report_id: params[:report_id], send_email_notification: true)
  7. @warning_presets = AccountWarningPreset.all
  8. end
  9. def create
  10. account_action = Admin::AccountAction.new(resource_params)
  11. account_action.target_account = @account
  12. account_action.current_account = current_account
  13. account_action.save!
  14. if account_action.with_report?
  15. redirect_to admin_reports_path
  16. else
  17. redirect_to admin_account_path(@account.id)
  18. end
  19. end
  20. private
  21. def set_account
  22. @account = Account.find(params[:account_id])
  23. end
  24. def resource_params
  25. params.require(:admin_account_action).permit(:type, :report_id, :warning_preset_id, :text, :send_email_notification)
  26. end
  27. end
  28. end