Skip to content

Commit

Permalink
Add the /admin/orders/:number route
Browse files Browse the repository at this point in the history
Very handy when switching from an order on the storefront to
the /admin bu just prepending "/admin" to the path.
  • Loading branch information
elia committed Jan 27, 2023
1 parent a1e3d38 commit f6017ef
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions backend/app/controllers/spree/admin/orders_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ class OrdersController < Spree::Admin::BaseController
rescue_from Spree::Order::InsufficientStock, with: :insufficient_stock_error
respond_to :html

def show
redirect_to action: :edit
end

def index
params[:q] ||= {}
params[:q][:completed_at_not_null] ||= '1' if Spree::Config[:show_only_complete_orders_by_default]
Expand Down
2 changes: 1 addition & 1 deletion backend/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

delete '/product_properties/:id', to: "product_properties#destroy", as: :product_property

resources :orders, except: [:show] do
resources :orders do
member do
get :cart
put :advance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,13 @@
end
end

describe "#show" do
it "redirects to :edit" do
get :show, params: { id: order.number }
expect(response).to redirect_to(spree.edit_admin_order_path(order.number))
end
end

describe '#advance' do
subject do
put :advance, params: { id: order.number }
Expand Down

0 comments on commit f6017ef

Please sign in to comment.