[xwiki-devs] [Discussion] Template provider action after create
vincent at massol.net
Mon Mar 28 10:47:17 UTC 2011
On Mar 24, 2011, at 7:28 PM, Luca Anca wrote:
> Hi devs,
> since I fail in all the ways to get a dashboard to be editable when
> editing it after creation from a template, I would like to know what you
> think of the next idea:
> We add a field to the TemplateProvider to specify what should be the
> action on creation from that template: "save & view", "save & edit", or
> Let me explain what first option would mean and then you'll figure out
> the other ones. When you have a template provider with "save and view"
> action on creation the following will happen:
> 1. click the add button
> 2. choose a template & fill in the page & space name
> 3. click create
> 4. the document is created and saved, and the user is being shown the
> document in view mode.
> The current implementation is "edit", which means that at point 4 in the
> list above no document is saved, the user is being shown the new
> document is edit mode, and until he hits save the document is not saved.
> I think it's a nice to have feature, since for other templates it might
> make sense that the document is, actually, created (and saved). Since a
> document created from a template already has content, it has meaning and
> ** The only major drawback** I see with this is that, looking at the
> create form, the user will not know what will happen when he clicks
> "Create", since it will vary according to his choice of template. We
> might fix this by adding this information under the template name in the
> list of templates in this form.
> What do you think about this? is it a nice feature to have?
+1 in general.
We could also imagine something more generic by having a textarea field in the TemplateProvider to allow scripting what happens after the user hits "create". Parameters would be injected as a variable in the script context.
Thus implementers of template providers can script the behavior they want.
We could provide default scripts for "edit" & "save & view" for example.
More information about the devs