Closed tomibennett closed 10 years ago
This isn't implemented at the moment although I have an idea how it should be done. But I can't promise you when exactly it will be delivered, let's keep this issue open for now.
right thx I'll find a way so
You can add additional route callback in app.js
for the editview's post route, that's the quickest way.
Or maybe there a way to use hooks (beforeSave, afterSave, ...) or something?
The so called hooks
are just route callbacks. That's the way you plug in functionality without touching the rest of the code.
On a first thought you should have one additional callback before r.editview.post
and after it. In fact something similar was implemented in one of the early versions of express-admin. In these callbacks you have req.params
which holds all your post'ed data and in res.locals
you have everything that is passed all the way down to the r.render.admin
callback.
Somewhere in custom.json
there will be an property to point to some file.js
containing your pre/post hooks. On start up they will be plugged into the appropriate places. That's the way it was implemented back then.
Hi, take a look at the latest release here: https://github.com/simov/express-admin/releases/tag/1.1.9
Currently the available event hooks are: preSave
and postSave
I also added an example of setting up a _createdat and _updatedat fields here: https://github.com/simov/express-admin-examples/blob/master/examples/custom/events/events.js
I'm also planning to make a screencast about extending/overriding the admin with custom stuff, but for now just take a look at the documentation: http://simov.github.io/express-admin-site/#events the important bit is to use node-inspector
and a breakpoint to see what's needed in your case.
If you have any questions don't hesitate to ask.
Hi guys, thanks for your app.
I would know if it's possible, somehow, to run a script at object's creation to fill a column.
Thx