Commit 35fbec53 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Search Editor: add an empty search parameter by default

parent 71f70c7a
......@@ -162,6 +162,21 @@
for (i = 0; i < query_list.length; i += 1) {
promise_list.push(createFilterItemTemplate(gadget, "auto", query_list[i]));
}
} else if (gadget.state.search_column_list.length > 0) {
// No search query was provided
// Add an empty search parameter for the first searchable column
promise_list.push(
createFilterItemTemplate(
gadget,
"auto",
new SimpleQuery({
key: gadget.state.search_column_list[0][1],
operator: "",
type: "simple",
value: ''
})
)
);
}
return RSVP.all(promise_list);
})
......@@ -178,9 +193,17 @@
}
container.appendChild(div);
return gadget.focusOnLastInput();
});
})
.declareJob('focusOnLastInput', function () {
var input_list = this.element.querySelectorAll('input');
if (input_list.length) {
input_list[input_list.length - 1].focus();
}
})
.declareMethod('render', function (options) {
return this.changeState({
search_column_list: options.search_column_list,
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>955.38135.49149.41489</string> </value>
<value> <string>963.33713.16839.14114</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1480342558.79</float>
<float>1510929709.6</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -50,7 +50,6 @@
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/triggle_filter_and" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/add_new_filter_section" />
<tal:block tal:define="filter_section_configuration python: {'key': 'id', 'value': '0', 'index': 0}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/set_filter_section" />
</tal:block>
......
......@@ -53,7 +53,29 @@
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/triggle_filter_and" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/add_new_filter_section" />
<tr>
<td colspan="3"><b>Check that a default filter section is displayed</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_search_editor.html')]//div[@class='filter_item_container']/div[1]</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_search_editor.html')]//div[@class='filter_item_container']/div[1]//select</td>
<td>id</td>
</tr>
<tr>
<td>verifyValue</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_search_editor.html')]//div[@class='filter_item_container']/div[1]//input</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b></b></td>
</tr>
<tal:block tal:define="filter_section_configuration python: {'key': 'id', 'value': '0', 'index': 0}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/set_filter_section" />
</tal:block>
......
......@@ -54,7 +54,6 @@
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/triggle_filter_and" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/add_new_filter_section" />
<tal:block tal:define="filter_section_configuration python: {'key': 'id', 'value': '0', 'index': 0}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/set_filter_section" />
</tal:block>
......
......@@ -50,7 +50,6 @@
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/triggle_filter_and" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/change_filter_to_or" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/add_new_filter_section" />
<tal:block tal:define="filter_section_configuration python: {'key': 'id', 'value': '0', 'index': 0}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/set_filter_section" />
</tal:block>
......
......@@ -54,7 +54,6 @@
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/triggle_filter_and" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/change_filter_to_or" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/add_new_filter_section" />
<tal:block tal:define="filter_section_configuration python: {'key': 'id', 'value': '0', 'index': 0}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/set_filter_section" />
</tal:block>
......
......@@ -52,7 +52,6 @@
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/triggle_filter_and" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/add_new_filter_section" />
<tal:block tal:define="filter_section_configuration python: {'key': 'id', 'value': '0', 'index': 0}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/set_filter_section" />
</tal:block>
......
......@@ -13,7 +13,6 @@
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/create_translation_data" />
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/wo/#/foo_bar_module</td>
......@@ -46,48 +45,43 @@
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/add_new_filter_section" />
<tr>
<td>waitForElementPresent</td>
<td>//div[@class="filter_item_container"]/div[1]//select[1]</td>
<td></td>
</tr>
<tr>
<td>verifySelectOptions</td>
<td>//div[@class="filter_item_container"]/div[1]//select[1]</td>
<td>ID,biaoti,soushuowenben</td>
</tr>
<tr>
<td>verifySelectOptions</td>
<td>//div[@class="filter_item_container"]/div[1]//select[2]</td>
<td>baohang</td>
<td>wangquanfuhe,guanjianchi</td>
</tr>
<tr>
<td>select</td>
<td>//div[@class="filter_item_container"]/div[1]//select[1]</td>
<td>index=1</td>
<td>index=2</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//option[@data-i18n='Exact Match']</td>
<td>//option[@data-i18n='Contain']</td>
<td></td>
</tr>
<tr>
<td>verifySelectOptions</td>
<td>//div[@class="filter_item_container"]/div[1]//select[2]</td>
<td>wangquanfuhe,guanjianchi</td>
<td>baohang</td>
</tr>
......
......@@ -68,8 +68,6 @@
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/add_new_filter_section" />
<tr>
<td>waitForElementPresent</td>
<td>//div[@class="filter_item_container"]/div[1]//select</td>
......
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