Administrate is a new open-source library that helps you create beautiful admin dashboards in Rails apps.
thoughtbot builds applications for all kinds of clients. No matter what field our clients are in, one of the most common needs is an admin dashboard - a window into the data behind the application.
In those situations, we historically turned to the excellent Ruby gems Active Admin and RailsAdmin to provide off-the-shelf admin dashboards and save us the hassle of writing boilerplate code.
However, as we used these tools we kept running into problems.
Usually, the off-the-shelf dashboards that these tools generate are too generalized to be useful to site admins. If a client needs a workflow for reviewing and approving new posts, or wants to add a button for sending reminders to their users, it can often take hundreds of lines of configuration code to get dashboards working the way we want.
Usually the configuration is written in a DSL ( domain-specific language ), which developers must learn and keep up with as it changes. This reduces the time-savings benefits of the gems and makes the resulting dashboards difficult to maintain in the long run.
At the same time, the generated admin dashboards are often unintuitive to use. Some dashboards include bar graphs that look cool but don’t show useful information. Other dashboards have trouble displaying large amounts of data on a page, and resort to navigation interactions that are unintuitive and frustrating.There’s a better way
Administrate is based on three guiding principles that make it easy to leave our clients with clean, maintainable code:No DSLs. Let developers override defaults in a conventional way - with common Rails controllers and views. Break up the library into core components and plugins, so each component stays small and easy to maintain.
Administrate lets developers write Rails code they’re already familiar with. Let’s look at some common features for an Admin dashboard:Need to set up OAuth for the site admins? Customize the authentication method in your application controller. Want to embed a map on the page to display location data? Generate a new field type , then edit a partial using your favorite templating language. Want a button for resetting a user’s password? Edit a partial to add a link to the page, and add a custom controller action to send the email
All of these features are implemented in the same way that they would be in a non-admin application. Using conventional tools, we can more easily adapt dashboards to our clients’ specific needs while keeping their maintenance burden low down the road.
Off-the-shelf admin dashboards are great on a new project. They get you up and running immediately, and they help non-technical stakeholders get comfortable with the system being built. Next time you use an admin dashboard on a project, make sure it’ll be able to grow with your app instead of holding it back.