How to customize Typus Admin for Rails to use a a special form?
I'm using the Typus Admin UI for a Ruby on Rails project and it's great. I was wondering if there's a way to customize it to do the followi开发者_JAVA技巧ng:
There is a database column named "account_type" which is an integer. Some non-technical admins use the Admin site and aren't aware of the integer to description mappings (e.g. 0 = START, 200 = READY, 400 = PENDING).
So I'd like to create a drop down box ( tag) whose values shows START, READY, PENDING. And when the form is submitted the "account_type" field is correctly changed to (0, 200, or 400).
Does anyone know if this is possible with Typus and how to do it?
The solution was documented here: https://github.com/fesplugas/typus/wiki/customization-user-interface
I learned that views for the admin can be overrided by creating directories with the model name in the app/views/admin . So to override views for a "Book" class you can
- Run "rails generate typus:views"
- create the directory app/views/admin/books
- copy files from app/views/admin/resources to the app/views/admin/books directory
- change files as needed (I changed the _form.html.erb)
精彩评论