rails_admin.rb 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. # RailsAdmin config file. Generated on July 28, 2012 14:28
  2. # See github.com/sferik/rails_admin for more informations
  3. RailsAdmin.config do |config|
  4. # If your default_local is different from :en, uncomment the following 2 lines and set your default locale here:
  5. # require 'i18n'
  6. # I18n.default_locale = :de
  7. config.current_user_method { current_user } # auto-generated
  8. # If you want to track changes on your models:
  9. config.audit_with :history, User
  10. # Or with a PaperTrail: (you need to install it first)
  11. # config.audit_with :paper_trail, User
  12. # Set the admin name here (optional second array element will appear in a beautiful RailsAdmin red ©)
  13. config.main_app_name = ['Huginn', 'Admin']
  14. # or for a dynamic name:
  15. # config.main_app_name = Proc.new { |controller| [Rails.application.engine_name.titleize, controller.params['action'].titleize] }
  16. config.authenticate_with do
  17. authenticate_user!
  18. end
  19. config.authorize_with do
  20. redirect_to "/" unless warden.user.admin?
  21. end
  22. config.attr_accessible_role do
  23. if _current_user.admin?
  24. :admin
  25. else
  26. :default
  27. end
  28. end
  29. # ==> Global show view settings
  30. # Display empty fields in show views
  31. # config.compact_show_view = false
  32. # ==> Global list view settings
  33. # Number of default rows per-page:
  34. # config.default_items_per_page = 20
  35. # ==> Included models
  36. # Add all excluded models here:
  37. config.excluded_models = [Contact]
  38. # Add models here if you want to go 'whitelist mode':
  39. # config.included_models = [User]
  40. # Application wide tried label methods for models' instances
  41. # config.label_methods << :description # Default is [:name, :title]
  42. # ==> Global models configuration
  43. # config.models do
  44. # # Configuration here will affect all included models in all scopes, handle with care!
  45. #
  46. # list do
  47. # # Configuration here will affect all included models in list sections (same for show, export, edit, update, create)
  48. #
  49. # fields_of_type :date do
  50. # # Configuration here will affect all date fields, in the list section, for all included models. See README for a comprehensive type list.
  51. # end
  52. # end
  53. # end
  54. #
  55. # ==> Model specific configuration
  56. # Keep in mind that *all* configuration blocks are optional.
  57. # RailsAdmin will try his best to provide the best defaults for each section, for each field.
  58. # Try to override as few things as possible, in the most generic way. Try to avoid setting labels for models and attributes, use ActiveRecord I18n API instead.
  59. # Less code is better code!
  60. # config.model MyModel do
  61. # # Cross-section field configuration
  62. # object_label_method :name # Name of the method called for pretty printing an *instance* of ModelName
  63. # label 'My model' # Name of ModelName (smartly defaults to ActiveRecord's I18n API)
  64. # label_plural 'My models' # Same, plural
  65. # weight -1 # Navigation priority. Bigger is higher.
  66. # parent OtherModel # Set parent model for navigation. MyModel will be nested below. OtherModel will be on first position of the dropdown
  67. # navigation_label # Sets dropdown entry's name in navigation. Only for parents!
  68. # # Section specific configuration:
  69. # list do
  70. # filters [:id, :name] # Array of field names which filters should be shown by default in the table header
  71. # items_per_page 100 # Override default_items_per_page
  72. # sort_by :id # Sort column (default is primary key)
  73. # sort_reverse true # Sort direction (default is true for primary key, last created first)
  74. # # Here goes the fields configuration for the list view
  75. # end
  76. # end
  77. # Your model's configuration, to help you get started:
  78. # All fields marked as 'hidden' won't be shown anywhere in the rails_admin unless you mark them as visible. (visible(true))
  79. # config.model User do
  80. # # Found associations:
  81. # # Found columns:
  82. # configure :id, :integer
  83. # configure :email, :string
  84. # configure :password, :password # Hidden
  85. # configure :password_confirmation, :password # Hidden
  86. # configure :reset_password_token, :string # Hidden
  87. # configure :reset_password_sent_at, :datetime
  88. # configure :remember_created_at, :datetime
  89. # configure :sign_in_count, :integer
  90. # configure :current_sign_in_at, :datetime
  91. # configure :last_sign_in_at, :datetime
  92. # configure :current_sign_in_ip, :string
  93. # configure :last_sign_in_ip, :string
  94. # configure :created_at, :datetime
  95. # configure :updated_at, :datetime # # Sections:
  96. # list do; end
  97. # export do; end
  98. # show do; end
  99. # edit do; end
  100. # create do; end
  101. # update do; end
  102. # end
  103. end