Create an app, in the routes namespace the solidus engine e.g.
mount Spree::Core::Engine, :at => '/solidus'
Then generate a new controller (inheriting) and action for a new admin page:
rails g controller spree/admin/mything index
This should inherit admin capabilities:
class Spree::Admin::ModelsController < Spree::Admin::BaseController
Add a route for it, then a tab item for it in the config e.g.
config.menu_items << config.class::MenuItem.new([:models], 'icon-name', url: '/admin/models')
Navigate to the new route, then try clicking on the other tabs. You'll see these routes are no longer namespaced by /solidus and will break.
The other tab items should have namespaced routes like /solidus/admin/products.
The other tab items aren't namespaced so the result is: /admin/products.
Solidus 2.0.0
I think this is down to the way the tab items are set as fixed URLs in:
backend_configuration.rb ?
I was unable to reproduce this bug.
I made everything work by adding the code like so:
config/routes.rb:
```Rails.application.routes.draw do
mount Spree::Core::Engine, :at => '/solidus'
Spree::Core::Engine.routes.draw do
namespace :admin do
get 'models/index'
end
end
end
`spree/admin/models_controller.rb`:
class Spree::Admin::ModelsController < Spree::Admin::BaseController
def index
end
end
Configuration for the additional menu item:
config.menu_items << config.class::MenuItem.new([:models], 'icon-name', url: :admin_models_index_path)
```
And everything pretty much worked like expected. @digitalWestie could you try this configuration and see if you still get the unexpected behavior?
Closing, the solution seems to be here and there has not been any activity for a while.
Most helpful comment
I was unable to reproduce this bug.
I made everything work by adding the code like so:
config/routes.rb:```Rails.application.routes.draw do
mount Spree::Core::Engine, :at => '/solidus'
Spree::Core::Engine.routes.draw do
namespace :admin do
get 'models/index'
end
end
end
class Spree::Admin::ModelsController < Spree::Admin::BaseController
def index
end
end
config.menu_items << config.class::MenuItem.new([:models], 'icon-name', url: :admin_models_index_path)
```
And everything pretty much worked like expected. @digitalWestie could you try this configuration and see if you still get the unexpected behavior?