Best rails admin panel!
-
Add
gem 'rademade_admin'
to Gemfile -
Update
config/initializers/assets.rb
with line:
config.assets.precompile += %w(rademade_admin.css rademade_admin.js)
-
Mount rails engine at routing.rb
mount RademadeAdmin::Engine => '/admin'
-
Create
User
model and other needed models
class User < ActiveRecord::Base
include RademadeAdmin::UserModule
has_secure_password
validates :password, length: { minimum: 8 }, allow_nil: true
def self.get_by_email(email)
where(email: email).first
end
alias valid_password? authenticate
def to_s
email
end
end
- Add rademade_admin initializer
initializers/rademade_admin.rb
RademadeAdmin.configure do |config|
config.admin_class = User
end
- Create admin controller. Example
app/controllers/rademade_admin/users_controller.rb
class RademadeAdmin::UsersController < RademadeAdmin::ModelController
# You can leave controller absolutely empty!
options do
list do
email
end
form do
first_name
email
password :hint => 'Or leave it empty'
end
end
end
- Add
admin_resources
torouters.rb
namespace :rademade_admin, :path => 'admin' do
admin_resources :users
end
-
Install assets with bower
rake rademade_admin:bower:install
-
Start rails
rails s
Good luck :)
options do
model 'ModelName'
# Fixed table head if need
fixed_thead true
# Navigation menu settings
parent_menu 'ModelName'
# Setting for list data (index action)
# list :attr, :attr_other
list do
end
# Settings for form
# form :attr, :attr_other
form do
attr :boolean #Other :text, :file, :editor
end
labels do
attr 'Label for attribute'
end
end