SimpleAdmin
SimpleAdmin provides builder for administrative dashboards, it's fit for Web / Mobile / API. Cloud or your own servers, depends on your choice and requirements.
All common admin dashboard tasks like content create / update / delete operations, charts, invite colleagues.
This is API Rack Application to connect your application with SimpleAdmin service.
Requirements
- Ruby ~> 2.3
Installation
Add SimpleAdmin to your application's Gemfile:
gem 'simpleadmin'
And then run:
bundle install
Configuration
Add the next line to your routes file to mount simpleadmin built-in routes:
# config/routes.rb
Rails.application.routes.draw do
mount Simpleadmin::Application, at: 'simpleadmin'
end
Create initializer, add your secret key and restart server
# config/initializers/simpleadmin.rb
ENV['SIMPLE_ADMIN_SECRET_KEY'] = 'SECRET_KEY'
Simpleadmin::Config.setup do |config|
config.database_credentials = {
adapter: :postgres,
database: 'demo_development'
}
# You can select what tables you want to use in the admin panel
config.allowed_tables = ['users', 'orders']
# Allow all tables
# config.allowed_tables = [:all]
config.on_create = lambda do |model_class, resource_params|
model_class.create(resource_params)
end
config.on_update = lambda do |model_class, resource_id, resource_params|
model_class.find(resource_id).update(resource_params)
end
config.on_destroy = lambda do |model_class, resource_id|
model_class.find(resource_id).destroy
end
end
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/getsimpleadmin/simpleadmin.
License
The gem is available as open source under the terms of the MIT License.