Commit 04df0c44 authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_web_renderjs_ui: add draft support for filter editor which is used to make query

parent 7950d24e
...@@ -158,6 +158,13 @@ ...@@ -158,6 +158,13 @@
data-gadget-scope="panel"\n data-gadget-scope="panel"\n
data-gadget-sandbox="public"></div>\n data-gadget-sandbox="public"></div>\n
\n \n
<div data-gadget-url="gadget_erp5_filter_editor.html"\n
data-gadget-scope="filterEditor"\n
data-gadget-sandbox="public"></div>\n
\n
<div role="main" class="ui-content gadget-content"></div>\n <div role="main" class="ui-content gadget-content"></div>\n
</div>\n </div>\n
\n \n
...@@ -303,7 +310,7 @@ ...@@ -303,7 +310,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.54056.18010.56797</string> </value> <value> <string>945.18332.59164.9181</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -321,8 +328,8 @@ ...@@ -321,8 +328,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1442581000.11</float> <float>1440437597.42</float>
<string>GMT</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
...@@ -495,6 +495,9 @@ ...@@ -495,6 +495,9 @@
.allowPublicAcquisition(\'triggerPanel\', function () {\n .allowPublicAcquisition(\'triggerPanel\', function () {\n
return route(this, "panel", "toggle");\n return route(this, "panel", "toggle");\n
})\n })\n
.allowPublicAcquisition(\'triggerFilterEditor\', function () {\n
return route(this, "filterEditor", "toggle");\n
})\n
\n \n
.allowPublicAcquisition("jio_allDocs", function (param_list) {\n .allowPublicAcquisition("jio_allDocs", function (param_list) {\n
return callJioGadget(this, "allDocs", param_list);\n return callJioGadget(this, "allDocs", param_list);\n
...@@ -775,7 +778,7 @@ ...@@ -775,7 +778,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>romain</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
......
...@@ -214,7 +214,11 @@ ...@@ -214,7 +214,11 @@
\n \n
if (url_query) {\n if (url_query) {\n
//query_string = field_json.column_list.reduce(buildQueryString, \' AND (\').replace(new RegExp("OR " + \'$\'), \')\');\n //query_string = field_json.column_list.reduce(buildQueryString, \' AND (\').replace(new RegExp("OR " + \'$\'), \')\');\n
if (field_json.list_method_template === undefined) {\n
query_string = \' AND \' + url_query;\n query_string = \' AND \' + url_query;\n
} else {\n
query_string = url_query;\n
}\n
}\n }\n
\n \n
for (i = 0; i < field_json.column_list.length; i += 1) {\n for (i = 0; i < field_json.column_list.length; i += 1) {\n
...@@ -604,7 +608,7 @@ ...@@ -604,7 +608,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>946.44927.40202.16725</string> </value> <value> <string>945.18094.21629.29286</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -622,7 +626,7 @@ ...@@ -622,7 +626,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1445939419.71</float> <float>1440435604.51</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -171,7 +171,13 @@ ...@@ -171,7 +171,13 @@
});\n });\n
})\n })\n
.push(function (result) {\n .push(function (result) {\n
var sub_options = options.fg || {};\n var sub_options = options.fg;\n
if (sub_options === undefined) {\n
sub_options = {};\n
if(options.filterEditor) {\n
sub_options.erp5_searchfield = options.filterEditor;\n
}\n
}\n
sub_options.erp5_document = erp5_document;\n sub_options.erp5_document = erp5_document;\n
sub_options.form_definition = erp5_form;\n sub_options.form_definition = erp5_form;\n
sub_options.view = options.view;\n sub_options.view = options.view;\n
...@@ -317,7 +323,7 @@ ...@@ -317,7 +323,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>romain</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -331,7 +337,7 @@ ...@@ -331,7 +337,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>946.30055.63361.39150</string> </value> <value> <string>945.12418.34036.47547</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -349,8 +355,8 @@ ...@@ -349,8 +355,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1445267203.04</float> <float>1440083034.81</float>
<string>GMT</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
...@@ -120,24 +120,38 @@ ...@@ -120,24 +120,38 @@
<!-- custom script -->\n <!-- custom script -->\n
<script src="gadget_erp5_searchfield.js"></script>\n <script src="gadget_erp5_searchfield.js"></script>\n
\n \n
<!-- XXX widget-status is bad! -->\n
<script id="panel-template" type="text/x-handlebars-template">\n <script id="panel-template" type="text/x-handlebars-template">\n
<div class="center">\n <div class="field_container">\n
<div class="ui-field-contain">\n <div class="ui-field-contain">\n
<div class="ui-input-text ui-body-{{widget_theme}} ui-corner-all ui-shadow-inset ui-input-has-clear {{widget_status_class}}">\n <div class="css-compatability-helper">\n
<div class="ui-input-text ui-body-{{theme}} ui-input-has-icon ui-corner-all ui-shadow-inset ui-input-has-clear {{status_class}} {{css_class}}">\n
<form class="save_form document_form">\n
<input type="text" data-enhanced="true" value="{{widget_value}}" name="search" {{widget_status_attribute}} />\n <input type="text" data-enhanced="true" value="{{widget_value}}" name="search" {{widget_status_attribute}} />\n
<div class="ui-btn ui-input-clear ui-input-btn ui-corner-all ui-icon-search ui-btn-icon-notext" data-i18n="[node]header-submit">\n <div class="ui-btn ui-input-clear ui-input-btn ui-corner-all ui-icon-search ui-btn-icon-notext" data-i18n="[node]{{search_i18n}}">\n
Submit<input data-enhanced="true" type="submit" data-i18n="[value]header-submit" value="Submit" {{widget_status_attribute}} />\n {{search_i18n}}<input tabindex="-1" data-role="button" data-enhanced="true" type="submit" data-i18n="[value]{{search_i18n}}" value=" "/>\n
</div>\n
</form>\n
</div>\n
<div class="ui-shadow-inset ui-btn ui-btn-inline ui-corner-all ui-btn-{{theme}} ui-btn-icon-notext ui-icon-filter ui-override-theme " >\n
<form class="filter_form">\n
<div class="ui-input-btn">\n
<input data-role="button" data-enhanced="true" type="submit" data-i18n="[value]" value=" ">\n
</div>\n
\n
</form>\n
</div>\n </div>\n
</div>\n </div>\n
<a href="#" data-i18n="filter" class="ui-btn ui-btn-{{widget_theme}} ui-btn-icon-notext ui-icon-filter ui-override-theme ui-disabled">Filters</a>\n
</div>\n </div>\n
</div>\n </div>\n
</script>\n </script>\n
\n
\n
\n
\n
\n \n
</head>\n </head>\n
<body>\n <body>\n
<div class="save_form document_form"></div>\n <div class="container"></div>\n
</body>\n </body>\n
</html> </html>
...@@ -262,7 +276,7 @@ ...@@ -262,7 +276,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>romain</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -276,7 +290,7 @@ ...@@ -276,7 +290,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.50880.23560.7150</string> </value> <value> <string>945.13789.16491.47428</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -294,8 +308,8 @@ ...@@ -294,8 +308,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1442998364.27</float> <float>1440168925.51</float>
<string>GMT</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
...@@ -135,7 +135,9 @@ ...@@ -135,7 +135,9 @@
// acquired method\n // acquired method\n
//////////////////////////////////////////////\n //////////////////////////////////////////////\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n .declareAcquiredMethod("translateHtml", "translateHtml")\n
\n .declareAcquiredMethod("pleasePublishMyState", "pleasePublishMyState")\n
.declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash")\n
.declareAcquiredMethod("triggerFilterEditor", "triggerFilterEditor")\n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
// declared methods\n // declared methods\n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
...@@ -161,7 +163,7 @@ ...@@ -161,7 +163,7 @@
}));\n }));\n
})\n })\n
.push(function (my_translated_html) {\n .push(function (my_translated_html) {\n
search_gadget.props.element.querySelector("div").innerHTML =\n search_gadget.props.element.querySelector(".container").innerHTML =\n
my_translated_html;\n my_translated_html;\n
return search_gadget;\n return search_gadget;\n
});\n });\n
...@@ -173,6 +175,42 @@ ...@@ -173,6 +175,42 @@
\n \n
result[input.getAttribute(\'name\')] = input.value;\n result[input.getAttribute(\'name\')] = input.value;\n
return result;\n return result;\n
})\n
\n
.declareService(function () {\n
var gadget = this;\n
\n
function filterSubmit(evt) {\n
return gadget.triggerFilterEditor();\n
}\n
\n
function formSubmit(evt) {\n
return new RSVP.Queue()\n
.push(function () {\n
return gadget.getContent();\n
})\n
.push(function (data) {\n
return gadget.pleasePublishMyState({\n
"extended_search": data.search\n
});\n
})\n
.push(function (url) {\n
return gadget.pleaseRedirectMyHash(url);\n
});\n
}\n
// Listen to form submit\n
loopEventListener(\n
gadget.props.element.querySelector(\'.save_form\'),\n
\'submit\',\n
false,\n
formSubmit\n
);\n
loopEventListener(\n
gadget.props.element.querySelector(\'.filter_form\'),\n
\'submit\',\n
false,\n
filterSubmit\n
);\n
});\n });\n
\n \n
}(window, rJS, RSVP, loopEventListener, Handlebars));</string> </value> }(window, rJS, RSVP, loopEventListener, Handlebars));</string> </value>
...@@ -310,7 +348,7 @@ ...@@ -310,7 +348,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.61050.10650.48093</string> </value> <value> <string>945.13775.30295.64870</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -328,8 +366,8 @@ ...@@ -328,8 +366,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1445265843.55</float> <float>1440164409.77</float>
<string>GMT</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
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