Commit abb66a5f authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_web_renderjs_ui: remove the way to clean input after submit since it's not correct

parent e1e39679
...@@ -341,87 +341,6 @@ ...@@ -341,87 +341,6 @@
return data;\n return data;\n
});\n });\n
})\n })\n
.declareMethod("refresh", function (options) {\n
var form_gadget = this,\n
j,\n
i,\n
index = 0,\n
erp5_document = options.erp5_document,\n
form_definition = options.form_definition,\n
rendered_form = erp5_document._embedded._view,\n
group_list = form_definition.group_list,\n
refresh_queue = new RSVP.Queue(),\n
suboption_dict = {},\n
suboptions,\n
renderered_field,\n
field,\n
refresh_list = this.props.refresh_list;\n
delete options.erp5_document;\n
delete options.form_definition;\n
\n
form_gadget.state_parameter_dict = options.form_gadget || {};\n
// XXX Hardcoded for searchfield - remove later!\n
if (form_definition.extended_search) {\n
suboption_dict.extended_search = form_definition.extended_search;\n
}\n
\n
function refresh_gadget(options, gadget_index) {\n
if (form_gadget.props.gadget_list[gadget_index].refresh !== undefined) {\n
refresh_queue.push(function () {\n
return form_gadget.props.gadget_list[gadget_index].refresh(options);\n
});\n
}\n
}\n
for (i = 0; i < group_list.length; i += 1) {\n
for (j = 0; j < group_list[i][1].length; j += 1) {\n
field = group_list[i][1][j];\n
if (rendered_form.hasOwnProperty(field[0])) {\n
if (refresh_list[index]) {\n
renderered_field = rendered_form[field[0]];\n
suboptions = options[renderered_field.key] || suboption_dict;\n
suboptions.field_json = renderered_field;\n
refresh_gadget(suboptions, index);\n
}\n
index += 1;\n
}\n
}\n
}\n
return refresh_queue;\n
})\n
.declareMethod("checkRefresh", function () {\n
var form_gadget = this,\n
k,\n
field_gadget,\n
count = form_gadget.props.gadget_list.length,\n
result = false,\n
refresh_list = [],\n
queue = new RSVP.Queue();\n
function extendData(needToRefresh) {\n
result = result || needToRefresh;\n
refresh_list[refresh_list.length] = needToRefresh;\n
}\n
function dontNeedToRefresh() {\n
return false;\n
}\n
for (k = 0; k < count; k += 1) {\n
field_gadget = form_gadget.props.gadget_list[k];\n
// XXX Hack until better defined\n
if (field_gadget.checkRefresh !== undefined) {\n
queue\n
.push(field_gadget.checkRefresh.bind(field_gadget));\n
} else {\n
queue\n
.push(dontNeedToRefresh);\n
}\n
queue.push(extendData);\n
}\n
return queue\n
.push(function () {\n
form_gadget.props.refresh_list = refresh_list;\n
return result;\n
});\n
\n
})\n
.declareMethod("checkValidity", function () {\n .declareMethod("checkValidity", function () {\n
var form_gadget = this,\n var form_gadget = this,\n
k,\n k,\n
...@@ -587,7 +506,7 @@ ...@@ -587,7 +506,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>943.18921.17173.42154</string> </value> <value> <string>943.19028.41746.46353</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -605,7 +524,7 @@ ...@@ -605,7 +524,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1432701398.16</float> <float>1433215002.43</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -135,7 +135,6 @@ ...@@ -135,7 +135,6 @@
.declareAcquiredMethod("renderPageHeader", "renderPageHeader")\n .declareAcquiredMethod("renderPageHeader", "renderPageHeader")\n
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")\n .declareAcquiredMethod("notifySubmitting", "notifySubmitting")\n
.declareAcquiredMethod("notifySubmitted", "notifySubmitted")\n .declareAcquiredMethod("notifySubmitted", "notifySubmitted")\n
.declareAcquiredMethod("pleaseRefreshFields", "pleaseRefreshFields")\n
\n \n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
// declared methods\n // declared methods\n
...@@ -194,18 +193,6 @@ ...@@ -194,18 +193,6 @@
});\n });\n
});\n });\n
})\n })\n
.declareMethod(\'refresh\', function (options) {\n
return this.getDeclaredGadget("erp5_form")\n
.push(function (erp5_form) {\n
var form_options = options.erp5_form || {};\n
\n
form_options.erp5_document = options.erp5_document;\n
form_options.form_definition = options.form_definition;\n
form_options.view = options.view;\n
\n
return erp5_form.refresh(form_options);\n
});\n
})\n
\n \n
\n \n
.declareService(function () {\n .declareService(function () {\n
...@@ -215,20 +202,13 @@ ...@@ -215,20 +202,13 @@
var form_gadget = this;\n var form_gadget = this;\n
\n \n
function formSubmit() {\n function formSubmit() {\n
var erp5_form,\n var erp5_form;\n
validity,\n
need_to_refresh;\n
return form_gadget.getDeclaredGadget("erp5_form")\n return form_gadget.getDeclaredGadget("erp5_form")\n
.push(function (gadget) {\n .push(function (gadget) {\n
erp5_form = gadget;\n erp5_form = gadget;\n
return RSVP.all([\n return erp5_form.checkValidity();\n
erp5_form.checkValidity(),\n
erp5_form.checkRefresh()\n
]);\n
})\n })\n
.push(function (result) {\n .push(function (validity) {\n
validity = result[0];\n
need_to_refresh = result[1];\n
if (validity) {\n if (validity) {\n
return erp5_form.getContent()\n return erp5_form.getContent()\n
.push(function (data) {\n .push(function (data) {\n
...@@ -245,11 +225,6 @@ ...@@ -245,11 +225,6 @@
})\n })\n
]);\n ]);\n
})\n })\n
.push(function () {\n
if (need_to_refresh) {\n
return form_gadget.pleaseRefreshFields();\n
}\n
})\n
.push(form_gadget.notifySubmitted.bind(form_gadget));\n .push(form_gadget.notifySubmitted.bind(form_gadget));\n
}\n }\n
});\n });\n
...@@ -399,7 +374,7 @@ ...@@ -399,7 +374,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>942.56412.30506.44083</string> </value> <value> <string>943.1808.36899.34116</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -417,7 +392,7 @@ ...@@ -417,7 +392,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1431046040.15</float> <float>1433215251.09</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -128,29 +128,7 @@ ...@@ -128,29 +128,7 @@
// Acquired methods\n // Acquired methods\n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")\n .declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")\n
.allowPublicAcquisition("pleaseRefreshFields", function () {\n \n
var gadget = this,\n
options = this.props.options,\n
erp5_document,\n
form_gadget = this.props.form_gadget;\n
return gadget.jio_getAttachment({"_id": options.jio_key, "_attachment": options.view})\n
.push(function (result) {\n
var uri = new URI(result.data._embedded._view._links.form_definition.href);\n
erp5_document = result.data;\n
return gadget.jio_getAttachment({"_id": uri.segment(2), "_attachment": "view"});\n
})\n
.push(function (result) {\n
var new_options;\n
new_options = options.fg || {};\n
new_options.erp5_document = erp5_document;\n
new_options.form_definition = result.data;\n
new_options.view = options.view;\n
new_options.action_view = options.action_view;\n
new_options.jio_key = options.jio_key;\n
new_options.editable = options.editable;\n
return form_gadget.refresh(new_options);\n
});\n
})\n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
// declared methods\n // declared methods\n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
...@@ -166,7 +144,7 @@ ...@@ -166,7 +144,7 @@
erp5_document,\n erp5_document,\n
erp5_form,\n erp5_form,\n
form_gadget;\n form_gadget;\n
gadget.props.options = options;\n \n
return gadget.jio_getAttachment({"_id": options.jio_key, "_attachment": options.view})\n return gadget.jio_getAttachment({"_id": options.jio_key, "_attachment": options.view})\n
.push(function (result) {\n .push(function (result) {\n
var uri = new URI(result.data._embedded._view._links.form_definition.href);\n var uri = new URI(result.data._embedded._view._links.form_definition.href);\n
...@@ -195,7 +173,7 @@ ...@@ -195,7 +173,7 @@
sub_options.action_view = options.action_view;\n sub_options.action_view = options.action_view;\n
sub_options.jio_key = options.jio_key;\n sub_options.jio_key = options.jio_key;\n
sub_options.editable = options.editable;\n sub_options.editable = options.editable;\n
gadget.props.form_gadget = result;\n \n
form_gadget = result;\n form_gadget = result;\n
return form_gadget.render(sub_options);\n return form_gadget.render(sub_options);\n
})\n })\n
...@@ -348,7 +326,7 @@ ...@@ -348,7 +326,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>942.55908.31920.60569</string> </value> <value> <string>943.5835.57925.8345</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -366,7 +344,7 @@ ...@@ -366,7 +344,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1431045870.59</float> <float>1433215427.98</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -322,7 +322,6 @@ promiseEventListener */\n ...@@ -322,7 +322,6 @@ promiseEventListener */\n
// show "new" tag, clicking it will remove it and reset the field!\n // show "new" tag, clicking it will remove it and reset the field!\n
// XXX Not active - reset should be handled by a generic reset method!\n // XXX Not active - reset should be handled by a generic reset method!\n
if (no_results && field_json.allow_creation) {\n if (no_results && field_json.allow_creation) {\n
props.need_to_refresh = true;\n
return new RSVP.Queue()\n return new RSVP.Queue()\n
.push(function () {\n .push(function () {\n
props.wrapper.appendChild(createNewTag(my_gadget));\n props.wrapper.appendChild(createNewTag(my_gadget));\n
...@@ -350,7 +349,6 @@ promiseEventListener */\n ...@@ -350,7 +349,6 @@ promiseEventListener */\n
return setRelationJump(my_gadget, undefined);\n return setRelationJump(my_gadget, undefined);\n
});\n });\n
}\n }\n
props.need_to_refresh = false;\n
// default autocomplete\n // default autocomplete\n
return new RSVP.Queue()\n return new RSVP.Queue()\n
.push(function () {\n .push(function () {\n
...@@ -399,7 +397,6 @@ promiseEventListener */\n ...@@ -399,7 +397,6 @@ promiseEventListener */\n
// Init local properties\n // Init local properties\n
.ready(function (my_gadget) {\n .ready(function (my_gadget) {\n
my_gadget.property_dict = {};\n my_gadget.property_dict = {};\n
my_gadget.property_dict.need_to_refresh = false;\n
})\n })\n
\n \n
.ready(function (my_gadget) {\n .ready(function (my_gadget) {\n
...@@ -476,20 +473,6 @@ promiseEventListener */\n ...@@ -476,20 +473,6 @@ promiseEventListener */\n
}\n }\n
return result;\n return result;\n
})\n })\n
.declareMethod(\'refresh\', function (options) {\n
var wrapper = this.property_dict.wrapper,\n
tag_list;\n
tag_list = wrapper.querySelector(".ui-tag-list");\n
if (tag_list !== null) {\n
tag_list.parentNode.removeChild(tag_list);\n
}\n
return this.render(options);\n
})\n
.declareMethod(\'checkRefresh\', function () {\n
var tmp = this.property_dict.need_to_refresh;\n
this.property_dict.need_to_refresh = false;\n
return tmp;\n
})\n
.declareMethod(\'checkValidity\', function () {\n .declareMethod(\'checkValidity\', function () {\n
var result;\n var result;\n
result = (this.element.querySelector(\'input\').checkValidity()) &&\n result = (this.element.querySelector(\'input\').checkValidity()) &&\n
...@@ -624,7 +607,7 @@ promiseEventListener */\n ...@@ -624,7 +607,7 @@ promiseEventListener */\n
- keyboard speed test\n - keyboard speed test\n
- add generic text and translations\n - add generic text and translations\n
- do multiRelationfield\n - do multiRelationfield\n
- ok find way to digest response of erp5? submit should clean input\n - find way to digest response of erp5? submit should clean input\n
- add column_list parameter to pass more than title = "John Smith", render?\n - add column_list parameter to pass more than title = "John Smith", render?\n
\n \n
\n \n
...@@ -767,7 +750,7 @@ promiseEventListener */\n ...@@ -767,7 +750,7 @@ promiseEventListener */\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>943.11588.15892.23876</string> </value> <value> <string>943.18921.17173.42154</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -785,7 +768,7 @@ promiseEventListener */\n ...@@ -785,7 +768,7 @@ promiseEventListener */\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1432255062.93</float> <float>1433215555.91</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