Hi,
Here are the concepts:
The customizing will completely done in the Controller. The view get a CrudForm which has a method to get all CrudFields which should be shown. A CrudField has a type (HIDDEN,INPUT_FIELD,DATE,TIME,DATE_TIME,COMBOBOX,CHECKBOX,RADIO_BUTTONS,MULTI_SELECT,READONLY,LINK,CUSTOM) and can provide custom html. So the view only must iterate over the field and render them depending on the type.
At the end the user must do only the following:
in routes
# CRUD
GET /admin controllers.Admin.listCrudController()
GET /admin/:table controllers.Admin.index(table: String)
GET /admin/:table/list controllers.Admin.list(table: String, p:Int ?= 0, s ?= "name", o ?= "asc", f ?= "")
GET /admin/:table/show/$id<[0-9]+> controllers.Admin.show(table: String, id: Long)
GET /admin/:table/edit/$id<[0-9]+> controllers.Admin.edit(table: String, id: Long)
POST /admin/:table/edit/$id<[0-9]+> controllers.Admin.update(table: String, id: Long)
GET /admin/:table/create controllers.Admin.create(table: String)
POST /admin/:table/create controllers.Admin.save(table: String)
POST /admin/:table/delete/$id<[0-9]+> controllers.Admin.delete(table: String, id: Long)
Write a Controller
public class Computers extends CRUD <Computer> {
public Computers() {
super(Computer.class);
}
}
If there are special need this can be done in the controller.
At the moment I didn't separate sample-code from plugin, because it's nasty to publish to repository and restart play completely (this can be done if the plugin becomes more stable).
I want to publish early to get feedback from the community and hopefully someone help with the views. Furthermore it would be good to know if this is from general interest.
Niels