Commit 1fc0d30f authored by Romain Courteaud's avatar Romain Courteaud

Directly edit newly created document.

parent 959bb40e
......@@ -257,7 +257,16 @@
\n
.allowPublicAcquisition("whoWantToDisplayThis", function (param_list) {\n
// Hey, I want to display some URL\n
return this.aq_pleasePublishMyState({jio_key: param_list[0], view: this.props.default_view_reference});\n
var options = {\n
jio_key: param_list[0],\n
view: this.props.default_view_reference\n
};\n
if (param_list[1] !== undefined) {\n
if (param_list[1].editable !== undefined) {\n
options.editable = param_list[1].editable;\n
}\n
}\n
return this.aq_pleasePublishMyState(options);\n
})\n
.allowPublicAcquisition("whoWantToDisplayThisPage", function (param_list) {\n
// Hey, I want to display some URL\n
......
......@@ -137,6 +137,9 @@
.declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n
.declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n
.declareAcquiredMethod("renderPageHeader", "renderPageHeader")\n
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")\n
.declareAcquiredMethod("notifySubmitted", "notifySubmitted")\n
\n
\n
/////////////////////////////////////////////////////////////////\n
// declared methods\n
......@@ -151,6 +154,7 @@
\n
form_gadget.props.id = erp5_document._id;\n
form_gadget.props.view = options.view;\n
form_gadget.props.editable = options.editable;\n
form_gadget.props.action = erp5_document._embedded._view._actions.put;\n
form_gadget.props.form_id = erp5_document._embedded._view.form_id;\n
\n
......@@ -194,7 +198,10 @@
var form_gadget = this;\n
\n
function formSubmit() {\n
return form_gadget.getDeclaredGadget("erp5_form")\n
return form_gadget.notifySubmitting()\n
.push(function () {\n
return form_gadget.getDeclaredGadget("erp5_form");\n
})\n
.push(function (erp5_form) {\n
return erp5_form.getContent();\n
})\n
......@@ -228,10 +235,13 @@
// No redirection, stay on the same document\n
return form_gadget.whoWantToDisplayThisPage({name: "view"});\n
}\n
return form_gadget.whoWantToDisplayThis(new URI(location).segment(2));\n
return form_gadget.whoWantToDisplayThis(new URI(location).segment(2), {editable: form_gadget.props.editable});\n
})\n
.push(function (url) {\n
return form_gadget.pleaseRedirectMyHash(url);\n
return RSVP.all([\n
form_gadget.notifySubmitted(),\n
form_gadget.pleaseRedirectMyHash(url)\n
]);\n
});\n
}\n
\n
......@@ -381,7 +391,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>937.64201.40983.3993</string> </value>
<value> <string>937.65475.63762.40123</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -399,7 +409,7 @@
</tuple>
<state>
<tuple>
<float>1412251248.98</float>
<float>1412328524.22</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -133,7 +133,7 @@
.push(function () {\n
var new_content_action = options.erp5_document._links.action_object_new_content_action;\n
if (new_content_action !== undefined) {\n
new_content_action = gadget.whoWantToDisplayThisPage({name: new_content_action.name});\n
new_content_action = gadget.whoWantToDisplayThisPage({name: new_content_action.name, editable: true});\n
} else {\n
new_content_action = "";\n
}\n
......@@ -300,7 +300,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>937.64086.34377.7560</string> </value>
<value> <string>937.64343.1806.54016</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -318,7 +318,7 @@
</tuple>
<state>
<tuple>
<float>1412257173.84</float>
<float>1412327028.09</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -159,7 +159,7 @@
\n
new_content_action = options.erp5_document._links.action_object_new_content_action;\n
if (new_content_action !== undefined) {\n
new_content_action = form_gadget.whoWantToDisplayThisPage({name: new_content_action.name});\n
new_content_action = form_gadget.whoWantToDisplayThisPage({name: new_content_action.name, editable: true});\n
} else {\n
new_content_action = "";\n
}\n
......
......@@ -136,7 +136,7 @@
return this.getDeclaredGadget(\'fg\')\n
.push(function (g) {\n
return g.triggerSubmit();\n
})\n
});\n
})\n
.declareMethod("render", function (options) {\n
var gadget = this,\n
......@@ -172,6 +172,7 @@
sub_options.view = options.view;\n
sub_options.action_view = options.action_view;\n
sub_options.jio_key = options.jio_key;\n
sub_options.editable = options.editable;\n
\n
form_gadget = result;\n
return form_gadget.render(sub_options);\n
......@@ -325,7 +326,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>937.58335.7310.17476</string> </value>
<value> <string>937.65478.52910.50056</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -343,7 +344,7 @@
</tuple>
<state>
<tuple>
<float>1412239088.85</float>
<float>1412344031.82</float>
<string>GMT</string>
</tuple>
</state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment