Commit 696602e1 authored by Romain Courteaud's avatar Romain Courteaud

WIP [erp5_web_renderjs_ui] Prototype update dialog support

update_method has to be send
parent 913edbfb
...@@ -35,7 +35,8 @@ ...@@ -35,7 +35,8 @@
data-gadget-scope="erp5_form" data-gadget-scope="erp5_form"
data-gadget-sandbox="public"> data-gadget-sandbox="public">
</div> </div>
<input class="dialogconfirm" data-theme="b" data-inline="true" type="submit" data-i18n="[value]Proceed" value="Proceed" data-icon="check" /> <input name="action_confirm" class="dialogconfirm" data-theme="b" data-inline="true" type="submit" data-i18n="[value]Proceed" value="Proceed" data-icon="check" />
<button name="action_update" type="submit" data-i18n="Update">Update</button>
<a class="dialogcancel" data-i18n="Cancel">Cancel</a> <a class="dialogcancel" data-i18n="Cancel">Cancel</a>
</form> </form>
</body> </body>
......
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>962.14191.38290.31931</string> </value> <value> <string>965.626.11255.31692</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1506093694.63</float> <float>1516722470.92</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
return [obj]; return [obj];
} }
function submitDialog(gadget) { function submitDialog(gadget, submit_action_id, is_update_method) {
var form_gadget = gadget, var form_gadget = gadget,
action = form_gadget.state.erp5_document._embedded._view._actions.put, action = form_gadget.state.erp5_document._embedded._view._actions.put,
form_id = form_gadget.state.erp5_document._embedded._view.form_id, form_id = form_gadget.state.erp5_document._embedded._view.form_id,
...@@ -30,7 +30,10 @@ ...@@ -30,7 +30,10 @@
data[form_id.key] = form_id['default']; data[form_id.key] = form_id['default'];
// XXX Hardcoded // XXX Hardcoded
data.dialog_id = form_id['default']; data.dialog_id = form_id['default'];
data.dialog_method = action.action; data.dialog_method = form_gadget.state.form_definition[submit_action_id];
if (is_update_method) {
data.update_method = data.dialog_method;
}
//XXX hack for redirect, difined in form //XXX hack for redirect, difined in form
redirect_to_parent = content_dict.field_your_redirect_to_parent; redirect_to_parent = content_dict.field_your_redirect_to_parent;
for (key in content_dict) { for (key in content_dict) {
...@@ -383,8 +386,14 @@ ...@@ -383,8 +386,14 @@
}) })
.onEvent('submit', function () { .onEvent('submit', function () {
return submitDialog(this); return submitDialog(this, "action");
}, false, true); }, false, true)
.onEvent('click', function (evt) {
if (evt.target.name === "action_update") {
evt.preventDefault();
return submitDialog(this, "update_action", true);
}
}, false, false);
}(window, rJS, RSVP, URI, calculatePageTitle, Blob, URL, document, jIO)); }(window, rJS, RSVP, URI, calculatePageTitle, Blob, URL, document, jIO));
\ No newline at end of file
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>965.670.53338.41130</string> </value> <value> <string>965.684.47475.20787</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1516725149.52</float> <float>1516801577.56</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </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