Sha256: 1bb859de3dcf14789248655cfca097a636f876a6387d307603704ed955bd610c

Contents?: true

Size: 665 Bytes

Versions: 3

Compression:

Stored size: 665 Bytes

Contents

# frozen_string_literal: true

class SolidusAdmin::CustomersController < SolidusAdmin::BaseController
  before_action :load_order, only: [:show, :destroy]

  def show
    respond_to do |format|
      format.html do
        render component('orders/show/email').new(order: @order)
      end
    end
  end

  def destroy
    if @order.update(user: nil)
      flash[:success] = t('.success')
    else
      flash[:error] = t('.error')
    end

    redirect_to order_path(@order), status: :see_other
  end

  private

  def load_order
    @order = Spree::Order.find_by!(number: params[:order_id])
  end

  def authorization_subject
    @order || Spree::Order
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
solidus_admin-0.3.2 app/controllers/solidus_admin/customers_controller.rb
solidus_admin-0.3.1 app/controllers/solidus_admin/customers_controller.rb
solidus_admin-0.3.0 app/controllers/solidus_admin/customers_controller.rb