app/controllers/spree/admin/orders_controller.rb in spree_backend-3.1.14 vs app/controllers/spree/admin/orders_controller.rb in spree_backend-3.2.0.rc1
- old
+ new
@@ -39,11 +39,11 @@
# lazy loading other models here (via includes) may result in an invalid query
# e.g. SELECT DISTINCT DISTINCT "spree_orders".id, "spree_orders"."created_at" AS alias_0 FROM "spree_orders"
# see https://github.com/spree/spree/pull/3919
@orders = @search.result(distinct: true).
page(params[:page]).
- per(params[:per_page] || Spree::Config[:orders_per_page])
+ per(params[:per_page] || Spree::Config[:admin_orders_per_page])
# Restore dates
params[:q][:created_at_gt] = created_at_gt
params[:q][:created_at_lt] = created_at_lt
end
@@ -83,45 +83,45 @@
end
def cancel
@order.canceled_by(try_spree_current_user)
flash[:success] = Spree.t(:order_canceled)
- redirect_to :back
+ redirect_back fallback_location: spree.edit_admin_order_url(@order)
end
def resume
@order.resume!
flash[:success] = Spree.t(:order_resumed)
- redirect_to :back
+ redirect_back fallback_location: spree.edit_admin_order_url(@order)
end
def approve
@order.approved_by(try_spree_current_user)
flash[:success] = Spree.t(:order_approved)
- redirect_to :back
+ redirect_back fallback_location: spree.edit_admin_order_url(@order)
end
def resend
OrderMailer.confirm_email(@order.id, true).deliver_later
flash[:success] = Spree.t(:order_email_resent)
- redirect_to :back
+ redirect_back fallback_location: spree.edit_admin_order_url(@order)
end
def open_adjustments
adjustments = @order.all_adjustments.closed
adjustments.update_all(state: 'open')
flash[:success] = Spree.t(:all_adjustments_opened)
- respond_with(@order) { |format| format.html { redirect_to :back } }
+ respond_with(@order) { |format| format.html { redirect_back fallback_location: spree.admin_order_adjustments_url(@order) } }
end
def close_adjustments
adjustments = @order.all_adjustments.open
adjustments.update_all(state: 'closed')
flash[:success] = Spree.t(:all_adjustments_closed)
- respond_with(@order) { |format| format.html { redirect_to :back } }
+ respond_with(@order) { |format| format.html { redirect_back fallback_location: spree.admin_order_adjustments_url(@order) } }
end
private
def order_params
params[:created_by_id] = try_spree_current_user.try(:id)