Lotus Admin
Provides a simple, Bootstrap 3 Material Design UI to administer your web app.
Usage
Install and subclass any controllers, models, or views as needed.
Installation
Add this line to your application's Gemfile and then mount the engine in your application.
Requirements
- Ruby 2.6
- Rails 6
Setup
Manually configure ranack to use simple form, before rails boots.
# config/application.rb
require_relative 'boot'
ENV['RANSACK_FORM_BUILDER'] = '::SimpleForm::FormBuilder'
require 'rails/all'
# Gemfile
gem 'lotus_admin', '~> 1.0'
And then execute:
$ bundle
Add to your routes
# config/routes.rb
LotusAdmin.router.install(self, at: 'admin')
Seed an administrator account, optional.
$> rake lotus_admin:seed
You can now login at http://localhost:3000/admin.
Theme Customization
There are many partials and SCSS variables that can be overwritten to customize the theme without writing a lot of custom markup.
To get started, provide any SCSS variables in a file at app/assets/stylesheets/lotus_admin/_variables.scss
.
There are two assets that can be overwritten as needed to inject dependencies and custom functionality.
app/assets/stylesheets/lotus_admin/customizations.scss
app/assets/javascripts/lotus_admin/customizations.js
Feel free to install any 3rd party libraries for front end work in these and customize!
Configuration
You may configure the engine by providing an initializer:
# conifg/initializers/lotus_admin.rb
LotusAdmin.configure do |config|
# set the default sender address for the included mailer
config.action_mailer_default_sender_address = "<value from wherever, credentials, secrets, etc>"
# use a custom user class, ideally subclassing from LotusAdmin::User, even if using a different table
config.user_class_name = "MyUser"
# perhaps add more custom resources
config.routes do
resources :cats, only: :show
resources :dogs
end
end
Custom User Class
You can choose to use a table pre-existing (with some columns added) or make use of the default schema when adding to your project for the first time.
If wanting to use a custom class and table name, but with the provided migration, just simply add the gem and then provide the initializer configuration before running migrations. You'll need to also define the model.
Otherwise if the table already exists, it won't be touched.
Contributing
Contribution directions go here.
Testing
$> bundle exec rspec spec
You can run the included test rails app as well:
$> cd spec/dummy && rails s
License
The gem is available as open source under the terms of the MIT License.