Guest User

Untitled

a guest
Jul 30th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. how to create more tabs en Active_admin with rails 3?
  2. ├── app
  3. │   ├── controllers
  4. │   │   ├── admin
  5. │   │   │   ├── base_controller.rb
  6. │   │   │   ├── locations_controller.rb
  7. │   │   │   ├── users_controller.rb
  8. │   │   │   └── resource_controller.rb
  9. │   │   ├── application_controller.rb
  10. │   │   ├── locations_controller.rb
  11. │   │   │   users_controller.rb
  12.  
  13. # The AdminController is the parent class that makes sure all administrator actions
  14. # require a logged-in User with an admin Role.
  15. class Admin::BaseController < ApplicationController
  16.  
  17. layout 'admin'
  18.  
  19. # Replace this with your own authentication / authorization stuff
  20. before_filter :http_authentication
  21. # Example when using Devise gem
  22. # before_filter :authenticate_admin!
  23.  
  24. # Add controller names you want to include as tab. Eg.
  25. # @@tabs = %w(messages) # if you created a Admin::MessagesController using the admin_scaffold generator.
  26. cattr_accessor :tabs
  27. @@tabs = %w(locations)
  28.  
  29. # GET /admin/
  30. def index
  31.  
  32. end
  33.  
  34. private
  35.  
  36. ADMIN_USERNAME = 'admin'
  37. ADMIN_PASSWORD = 'admin'
  38.  
  39. def http_authentication
  40. authenticate_or_request_with_http_basic do |username, password|
  41. username == ADMIN_USERNAME && password == ADMIN_PASSWORD
  42. end
  43. end
  44.  
  45. end
Add Comment
Please, Sign In to add comment