Merge branch 'rails-admin'

This commit is contained in:
Andrew Brown 2018-10-21 20:56:21 -05:00
commit 3ff6293bd0
4 changed files with 90 additions and 1 deletions

View File

@ -72,6 +72,9 @@ gem 'delayed_job_active_record'
# Exports
gem 'csv'
# Admin
gem 'rails_admin', '~> 1.3'
# Tech debt & hacks
gem 'binding_of_caller' # see has_changelog.rb

View File

@ -177,6 +177,8 @@ GEM
ffi (1.9.25)
filesize (0.1.1)
flamegraph (0.9.5)
font-awesome-rails (4.7.0.4)
railties (>= 3.2, < 6.0)
formatador (0.2.5)
friendly_id (5.2.4)
activerecord (>= 4.0.0)
@ -200,6 +202,9 @@ GEM
guard-rubocop (1.3.0)
guard (~> 2.0)
rubocop (~> 0.20)
haml (5.0.4)
temple (>= 0.8.0)
tilt
hashdiff (0.3.7)
html-pipeline (2.8.0)
activesupport (>= 2)
@ -212,6 +217,12 @@ GEM
nokogiri (>= 1.6)
jaro_winkler (1.4.0)
jmespath (1.4.0)
jquery-rails (4.3.3)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jquery-ui-rails (6.0.1)
railties (>= 3.2.16)
json (1.8.6)
kaminari (1.1.1)
activesupport (>= 4.1.0)
@ -263,6 +274,7 @@ GEM
multipart-post (2.0.0)
mustache (1.0.5)
nenv (0.3.0)
nested_form (0.3.2)
newrelic_rpm (5.2.0.345)
nio4r (2.3.1)
nokogiri (1.8.4)
@ -305,6 +317,9 @@ GEM
rack (2.0.5)
rack-mini-profiler (1.0.0)
rack (>= 1.2.0)
rack-pjax (1.0.0)
nokogiri (~> 1.5)
rack (>= 1.1)
rack-test (1.0.0)
rack (>= 1.0, < 3)
rack-timeout (0.5.1)
@ -338,6 +353,19 @@ GEM
rails_12factor (0.0.3)
rails_serve_static_assets
rails_stdout_logging
rails_admin (1.4.2)
builder (~> 3.1)
coffee-rails (~> 4.0)
font-awesome-rails (>= 3.0, < 5)
haml (>= 4.0, < 6)
jquery-rails (>= 3.0, < 5)
jquery-ui-rails (>= 5.0, < 7)
kaminari (>= 0.14, < 2.0)
nested_form (~> 0.3)
rack-pjax (>= 0.7)
rails (>= 4.0, < 6)
remotipart (~> 1.3)
sass-rails (>= 4.0, < 6)
rails_serve_static_assets (0.0.5)
rails_stdout_logging (0.0.5)
railties (5.2.0)
@ -354,6 +382,7 @@ GEM
ffi (>= 0.5.0, < 2)
redcarpet (3.4.0)
ref (2.0.0)
remotipart (1.4.2)
responders (2.4.0)
actionpack (>= 4.2.0, < 5.3)
railties (>= 4.2.0, < 5.3)
@ -444,6 +473,7 @@ GEM
stripe_event (2.1.1)
activesupport (>= 3.1)
stripe (>= 2.8, < 4.0)
temple (0.8.0)
terrapin (0.6.0)
climate_control (>= 0.0.3, < 1.0)
therubyracer (0.12.3)
@ -547,6 +577,7 @@ DEPENDENCIES
rails-perftest
rails-ujs
rails_12factor
rails_admin (~> 1.3)
redcarpet
rmagick
rspec-prof

View File

@ -0,0 +1,54 @@
RailsAdmin.config do |config|
### Popular gems integration
## == Devise ==
# config.authenticate_with do
# warden.authenticate! scope: :user
# end
# config.current_user_method(&:current_user)
## == Cancan ==
# config.authorize_with :cancan
## == Pundit ==
# config.authorize_with :pundit
## == PaperTrail ==
# config.audit_with :paper_trail, 'User', 'PaperTrail::Version' # PaperTrail >= 3.0.0
### More at https://github.com/sferik/rails_admin/wiki/Base-configuration
## == Gravatar integration ==
## To disable Gravatar integration in Navigation Bar set to false
# config.show_gravatar = true
config.actions do
dashboard # mandatory
index # mandatory
new
export
bulk_delete
show
edit
delete
show_in_app
## With an audit adapter, you can add:
# history_index
# history_show
end
config.authorize_with do
redirect_to main_app.root_path unless user_signed_in? && current_user.site_administrator?
end
config.included_models = ["User"]
# Todo whitelist the fields we want to show for each model
# config.model 'User' do
# list do
# field :name
# field :created_at
# end
# end
end

View File

@ -163,13 +163,14 @@ Rails.application.routes.draw do
end
get 'search/', to: 'search#results'
scope 'admin' do
scope 'admin_stats' do
get '/', to: 'admin#dashboard', as: :admin_dashboard
get '/content_type/:type', to: 'admin#content_type', as: :admin_content_type
get '/attributes', to: 'admin#attributes', as: :admin_attributes
get '/masquerade/:user_id', to: 'admin#masquerade', as: :masquerade
end
mount RailsAdmin::Engine => '/admin', as: 'rails_admin'
scope 'export' do
get '/', to: 'export#index', as: :notebook_export