A framework for creating admin dashboards in an instant. Try the demo. Try the demo.
Add SimpleAdmin to your Gemfile and run bundle:
gem 'simple_admin', git: 'https://github.com/evil-raccoon/simple_admin.git'
The following generators will create rolify initializer and core migrations.
rails generate simple_admin:install
rails generate simple_admin:migration
rails db:migrate
Restart your server, and visit http://localhost:3000/users/sign_in for authentication.
Default admin credentials:
login: admin@example.com
password: example
Simple Admin also supports devise gem, it's can simply integrated with the following code.
# config/routes.rb
Rails.application.routes.draw do
devise_for :users, class_name: 'SimpleAdmin::User'
end
# app/models/simple_admin/user.rb
module SimpleAdmin
class User < Base
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
...
end
end
Remove current_user and authenticate_user! methods with raise NotImplemented
error and keep the following.
# app/controllers/simple_admin/admin/application_controller.rb
module SimpleAdmin
module Admin
class ApplicationController < ActionController::Base
layout 'simple_admin'
before_action :authenticate_user!
private
def current_ability
SimpleAdmin::Ability.new(current_user)
end
end
end
end
We try to minimize the use of third-party libraries, but Simple Admin built with the following open source projects:
Tool | Description |
---|---|
Kaminari | Paginator for Ruby webapps |
Rolify | Role management library with resource scoping |
CanCanCan | The authorization Gem for Ruby on Rails. |
- Fork it ( https://github.com/evil-raccoon/simple_admin/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Released under MIT License.
Copyright © 2017 Dmitriy Strukov.