What I'm looking for is the ability to quickly (DRY!) Generate forms for these models, but in a less controlled way than using CRUD forms / models; for example, being able to use crud tags without complete crud controllers / routes or by strongly configuring them.
Let me explain an example.
I have model A than links (ManyToOne) for two models, B and C
class public A extends Model { public String name; @ManyToOne public A a; @ManyToOne public B b; }
I would like to write the following routes:
/A/{id}/B/ somecontroller /A/{id}/C/ some(other?)controller
or even better:
/A/{id}/{submodel}/ somecontroller
And in the corresponding html view you can do something like:
<div>object.name</div> #{form action:@save(object.b._key()), enctype:'multipart/form-data'} #{crud.form object.b /} <p class="crudButtons"> <input type="submit" name="_save" value="&{'crud.save', type.modelName}" /> <input type="submit" name="_saveAndContinue" value="&{'crud.saveAndContinue', type.modelName}" /> </p> #{/form}
Where the "object" is not an instance of "b" or "c", but "a", and I can tell #{crud.form /} which model it should display (in this case, "b")
Is there a way to achieve something like this?
The issue can be resolved either:
- is there a simple tag
#{form MODEL} #{/form} ?!
or, being able to somehow customize more CRUD, for example.
- Is there a way to change the main crud module and override only the methods you need (without copying all this!)?
I am afraid that I will not be able to achieve this goal by simply redefining the CRUD controller model, maybe I'm wrong, but besides reading the CRUD code (which I do) the official document is a bit limited by what methods can be redefined and how ...
Related: how to create an html form for a model in playframework
I also found this google mail flow which seems to go into the-crud direction setting. I was hoping for more turnkey solutions for such a typical need ...