Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to add a new tab in spree admin panel?

I created a controller under Spree::Admin module and also I have mentioned in

routes.rb

match '/admin/new_tab => 'spree/admin/new_controller#index'

but this is working in front end.

How can I move this page to admin panel with new tab?

like image 553
sasikkumar Avatar asked Dec 03 '25 06:12

sasikkumar


1 Answers

To make this controller work only if admin is signed in (like the other controllers in Admin namespace), it should inherit from Admin::BaseController. To make the new tab, you should probably create Deface, something like this:

Deface::Override.new(:virtual_path => "spree/layouts/admin",
    :name => "admin_content_admin_tab_parser",
    :insert_bottom => "[data-hook='admin_tabs']",
    :text => "<%= tab :new_tab,  :url => 'admin/new_tab', :icon => 'icon-th-large' %>",
    :disabled => false)
like image 181
Marek Lipka Avatar answered Dec 05 '25 20:12

Marek Lipka