12
Active Admin Create your admin interface the easy way Nestor Walker

Active Admin: Create Your Admin Interface the Easy Way

Embed Size (px)

DESCRIPTION

Software developer Nestor Walker walks us through creating admin interfaces the easy way.

Citation preview

Page 1: Active Admin: Create Your Admin Interface the Easy Way

Active AdminCreate your admin interface the easy way

Nestor Walker

Page 2: Active Admin: Create Your Admin Interface the Easy Way

Install● Add to your Gemfile:

● For Rails >= 3.1 Active Admin is also dependant on sass-rails and a beta version of meta_search:

● After updating the Bundle, run the active admin install generator.

● Migrate your db and start the server

● Now visit http://localhost:3000/admin● Log in with [email protected] / password

● You now have an admin interface.

Page 3: Active Admin: Create Your Admin Interface the Easy Way
Page 4: Active Admin: Create Your Admin Interface the Easy Way

ModelsActive admin will set up your models with the following generator:

This creates a file in app/admin/my_model_name.rb

Page 5: Active Admin: Create Your Admin Interface the Easy Way

Models

● Index ColumnsBy default Active Admin will create a table view of the model with a column

for each field. This can also be customized.

Page 6: Active Admin: Create Your Admin Interface the Easy Way

Models● Filters

Active Admin out of the box has the ability to filter by string, date_range, numeric, select, and check_boxes. By default it will create filters with all the models fields using the appropriate selection type.

Page 7: Active Admin: Create Your Admin Interface the Easy Way

Models

Page 8: Active Admin: Create Your Admin Interface the Easy Way

Active Admin uses Formtastic to give you complete control over your data entry.

Forms

Page 9: Active Admin: Create Your Admin Interface the Easy Way

FormsThe form can also be put into a partial.

app/views/admin/users/_form.html.erb

Page 10: Active Admin: Create Your Admin Interface the Easy Way

FormsWith the partial:

Page 11: Active Admin: Create Your Admin Interface the Easy Way

DashboardThe dashboard can be customized in a way similar to the index pages.

A partial can also be used inside a section with:render 'new_users' # => this will render/app/views/admin/dashboard/_new_users.html.erb

Page 12: Active Admin: Create Your Admin Interface the Easy Way