SlashAdmin

Gem Version CircleCI

A modern and fully customizable admin, just the rails way. Embedded admin user and authentication system, devise is not needded.

❤️ Demo repository 🚀 Live running

User admin

Password admin@admin

Motivation:

  • Provide to Ruby On Rails the admin it deserves without DSL or obscure logic.
  • Provide an easy to use and modern experience to final users.

I tried to take the best from two greats existing gem:

Design inspired from the awesome metronic admin theme:

Screenshots

Login

Image of Login screen

Dashboard

Image of Dashboard

List

Image of List

Edit / Create

Image of Create / Edit

Installation

Add this line to your application's Gemfile:

gem 'slash_admin'

Then execute:

$ bundle install

Or install it yourself as:

$ gem install slash_admin

Gemfile

gem 'carrierwave'

Then:

$ rails g slash_admin:install
$ rails slash_admin:install:migrations
$ rails db:migrate

config/initializers/mime_types.rb

Mime::Type.register "application/xls", :xls

If your apps uses Sprockets 4+, you'll need to add SlashAdmin assets to your manifest.js file. To do this, add these two lines to the file:

app/assets/config/manifest.js

//= link slash_admin/application.css
//= link slash_admin/application.js

config/routes.rb

Rails.application.routes.draw do
  mount SlashAdmin::Engine => "/"
end

Mounted as '/' but prefixed in the gem and in routes definition of models admin. See the full example above.

Rails.application.routes.draw do
  mount SlashAdmin::Engine => "/"

  namespace :slash_admin, path: "/admin" do
    scope module: 'models' do
      resources :pages # assume Page model
    end
  end
end

Important

If you are using friendly_id gem, you have to add routes: :default like so:

friendly_id :title, use: :history, routes: :default

Example of create admin in seed.rb in your app:

SlashAdmin::Admin.create!(
  username:               'admin',
  email:                  '[email protected]',
  password:               'admin@admin',
  password_confirmation:  'admin@admin'
)

Documentation

Read the docs

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/nicovak/slash_admin. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the slash_admin project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.