Class: SolidusAdmin::RefundReasonsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- BaseController
- SolidusAdmin::RefundReasonsController
- Includes:
- ControllerHelpers::Search
- Defined in:
- app/controllers/solidus_admin/refund_reasons_controller.rb
Instance Method Summary collapse
Methods included from ComponentsHelper
Instance Method Details
#create ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'app/controllers/solidus_admin/refund_reasons_controller.rb', line 27 def create @refund_reason = Spree::RefundReason.new(refund_reason_params) if @refund_reason.save respond_to do |format| flash[:notice] = t('.success') format.html do redirect_to solidus_admin.refund_reasons_path, status: :see_other end format.turbo_stream do render turbo_stream: '<turbo-stream action="refresh" />' end end else set_index_page respond_to do |format| format.html do page_component = component('refund_reasons/new').new(page: @page, refund_reason: @refund_reason) render page_component, status: :unprocessable_entity end end end end |
#destroy ⇒ Object
87 88 89 90 91 92 93 94 |
# File 'app/controllers/solidus_admin/refund_reasons_controller.rb', line 87 def destroy @refund_reason = Spree::RefundReason.find_by!(id: params[:id]) Spree::RefundReason.transaction { @refund_reason.destroy } flash[:notice] = t('.success') redirect_back_or_to refund_reasons_path, status: :see_other end |
#edit ⇒ Object
54 55 56 57 58 59 60 |
# File 'app/controllers/solidus_admin/refund_reasons_controller.rb', line 54 def edit set_index_page respond_to do |format| format.html { render component('refund_reasons/edit').new(page: @page, refund_reason: @refund_reason) } end end |
#index ⇒ Object
9 10 11 12 13 14 15 |
# File 'app/controllers/solidus_admin/refund_reasons_controller.rb', line 9 def index set_index_page respond_to do |format| format.html { render component('refund_reasons/index').new(page: @page) } end end |
#new ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/solidus_admin/refund_reasons_controller.rb', line 17 def new @refund_reason = Spree::RefundReason.new set_index_page respond_to do |format| format.html { render component('refund_reasons/new').new(page: @page, refund_reason: @refund_reason) } end end |
#update ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'app/controllers/solidus_admin/refund_reasons_controller.rb', line 62 def update if @refund_reason.update(refund_reason_params) respond_to do |format| flash[:notice] = t('.success') format.html do redirect_to solidus_admin.refund_reasons_path, status: :see_other end format.turbo_stream do render turbo_stream: '<turbo-stream action="refresh" />' end end else set_index_page respond_to do |format| format.html do page_component = component('refund_reasons/edit').new(page: @page, refund_reason: @refund_reason) render page_component, status: :unprocessable_entity end end end end |