Skip to content

mandriver/simple_admin

SimpleAdmin

Build Status Code Climate codecov Inline docs

A framework for creating admin dashboards in an instant. Try the demo. Try the demo.

Getting started

Add SimpleAdmin to your Gemfile and run bundle:

simple_admin

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

Devise integration

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

Dependencies

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.

Contributing

  1. Fork it ( https://github.com/evil-raccoon/simple_admin/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Copyright

Released under MIT License.

Copyright © 2017 Dmitriy Strukov.

About

A Rails Engine for admin dashboard

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages