Files
openfoodnetwork/app/controllers/admin/proxy_orders_controller.rb
Luis Ramos e52937c113 Use rubocop auto correct to add frozen string literal to all files
This is an unsafe auto corection, we will need to trust our build here
2021-06-17 23:07:26 +01:00

31 lines
782 B
Ruby

# frozen_string_literal: true
module Admin
class ProxyOrdersController < Admin::ResourceController
respond_to :json
def edit
@proxy_order.initialise_order! unless @proxy_order.order
redirect_to spree.edit_admin_order_path(@proxy_order.order)
end
def cancel
if @proxy_order.cancel
render_as_json @proxy_order
else
render json: { errors: [t('admin.proxy_orders.cancel.could_not_cancel_the_order')] },
status: :unprocessable_entity
end
end
def resume
if @proxy_order.resume
render_as_json @proxy_order
else
render json: { errors: [t('admin.proxy_orders.resume.could_not_resume_the_order')] },
status: :unprocessable_entity
end
end
end
end