After my recent ActiveScaffold post, I heard about several newer alternatives from Jaime Flournoy, Mike Gunderloy, and some more web surfing. I evaluated four plugins for admin UI, using the following methodology:
rails xxx_simple
cd xxx_simple/
./script/generate scaffold Task title:string notes:text complete:boolean
rake db:migrate
plus whatever annotations to the code the plugin needed. Then I ran a little script to generate 500 records:
500.times do |counter|
`curl -X POST -d "Another thing #{counter}More text with #{counter} thing" -H "Content-Type: application/xml" http://localhost:3000/tasks.xml`
end
They all support related models, but I only have screen shots from my simple test. I’ve listed them below with the ones I liked best at the top.
typus
Typus is the one I’m moving forward with. It has a clean interface and has nice configuration options. You can configure which columns are displayed and which are searched (with a nice UI touch of displaying the search criteria under the search box). It is actively maintained with quite a few contributors and a responsive google group. I really like how relationships are displayed (for which I don’t have a picture, sorry). The only drawback (for me) is that it has its own auth and I don’t really want to introduce a separate set of admin users for the project I am working on, and I’ll be looking into making a change to support my own auth. By default, it adds it’s own typus_users table, but this could be a plus for some.
script/plugin install git://github.com/fesplugas/typus.git
script/generate typus
rake db:migrate
./script/server
Now visit http://localhost:3000/admin and you will be prompted for your email address, from which it will automatically create the first admin user (pretty slick). The default UI looks like this:
I ran into just one glitch where Rails reported "A copy of ApplicationController has been removed from the module tree but is still active!" but it was easily fixed. The error didn't happen in my simple project, but did in my real app. Francesc Esplugas has looked into it and so far can't reproduce it.
admin_data
I really liked admin_data. The simplicity of the install was breath-taking:
ruby script/plugin install git://github.com/neerajdotname/admin_data.git
sudo gem install will_paginate
./script/server
that's it. Now visit http://localhost:3000/admin_data and you'll see the following interface:
I didn't try it, but I really like the admin_data approach to integrating with the application's authentication: Add the following lines of code in an initializer at ~/config/initializers/admin_data.rb
# authorization check to see if the data should be shown to the user
ADMIN_DATA_VIEW_AUTHORIZATION = Proc.new { |controller|
controller.send("admin_logged_in?") }
# authorization check to see if the user should be allowed to update the data
ADMIN_DATA_UPDATE_AUTHORIZATION = Proc.new { |controller| return false }
streamlined
Streamlined is nice, but not as pretty as ActiveScaffold. Not compatible with Rails 2.3. This and active_scaffold seem to be a little older than typus and admin_data and require you to modify your code similarly. I thought it nice that it provided its own admin layout. In my simple test I applied the series of steps and nested route as with active_scaffold.
class MyNiftyController < ApplicationController
layout 'streamlined'
acts_as_streamlined
...[anything else you want to do]
end
active_scaffold
See my previous post for details. This seems to be the grand-daddy of this genre of plugins and has a very active google group. I liked this plugin when I first tried it, but it hung when I applied it to my real app. Also, @jamieflournoy notes that he didn't like the UI for editing related models as much as he did Streamlined.