Commit 863b2641 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Move filter action in the header

form_list search widget layout is like a search engine search form (text input and search button next to it)
parent 319412c5
......@@ -108,7 +108,7 @@
<value> <string encoding="cdata"><![CDATA[
CACHE MANIFEST\n
# generated on Mon, 11 Apr 2016 14:30:00 GMT\n
# generated on Tue, 12 Apr 2016 15:30:00 GMT\n
# XXX + fonts\n
# images/ajax-loader.gif\n
CACHE:\n
......@@ -357,7 +357,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>950.28770.51995.64546</string> </value>
<value> <string>950.30300.60307.22732</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -375,7 +375,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1460381405.36</float>
<float>1460470897.98</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -145,7 +145,8 @@
],
possible_right_button_list = [
['save_action', 'Save', 'check', 'submit'],
['submit_action', 'Proceed', 'check', 'submit']
['submit_action', 'Proceed', 'check', 'submit'],
['filter_action', 'Filter', 'filter', 'submit']
],
possible_sub_header_list = [
['tab_url', 'Tabs', 'eye'],
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>950.21606.28357.38656</string> </value>
<value> <string>950.21623.16836.44356</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1459950195.41</float>
<float>1460384843.33</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -48,9 +48,19 @@
return result;
});
})
.declareMethod("triggerSubmit", function () {
var argument_list = arguments;
return this.getDeclaredGadget('form_list')
.push(function (gadget) {
return gadget.triggerSubmit.apply(gadget, argument_list);
});
})
.declareMethod("render", function () {
var gadget = this,
header_dict = {page_title: 'Search'};
header_dict = {
page_title: 'Search',
filter_action: true
};
return gadget.getUrlParameter('history')
.push(function (result) {
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>950.28737.36313.33262</string> </value>
<value> <string>950.28941.57604.37137</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1460377090.92</float>
<float>1460389333.59</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -27,12 +27,7 @@
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("getUrlParameter", "getUrlParameter")
.allowPublicAcquisition("getListboxInfo", function () {
return this.getDeclaredGadget("erp5_form")
.push(function (form_gadget) {
return form_gadget.getListboxInfo();
});
})
.declareAcquiredMethod("renderEditorPanel", "renderEditorPanel")
/////////////////////////////////////////////////////////////////
// declared methods
......@@ -86,7 +81,8 @@
actions_url: all_gadget[3],
export_url: "",
page_title: all_gadget[5],
front_url: all_gadget[4]
front_url: all_gadget[4],
filter_action: true
})
]);
......@@ -94,6 +90,31 @@
})
.declareMethod('triggerSubmit', function () {
var gadget = this,
extended_search = '',
options = {};
return gadget.getDeclaredGadget("erp5_searchfield")
.push(function (search_gadget) {
return search_gadget.getContent();
})
.push(function (result) {
// Hardcoded field name
extended_search = result.search;
return gadget.getDeclaredGadget("erp5_form");
})
.push(function (form_gadget) {
return form_gadget.getListboxInfo();
})
.push(function (result) {
var url = "gadget_erp5_search_editor.html";
options.extended_search = extended_search;
options.begin_from = result.begin_from;
options.search_column_list = result.search_column_list;
return gadget.renderEditorPanel(url, options);
});
})
.declareService(function () {
var gadget = this;
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>950.28775.58471.1331</string> </value>
<value> <string>950.28943.57832.60535</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1460380526.47</float>
<float>1460389440.4</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -19,13 +19,13 @@
<div class="bottom">
<div class="ui-input-text ui-body-{{theme}} ui-input-has-icon ui-corner-all ui-shadow-inset ui-input-has-clear">
<input type="text" data-enhanced="true" value="{{widget_value}}" name="search" {{widget_status_attribute}} >
<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">
- Submit<input data-enhanced="true" type="submit" data-i18n="[value]header-submit" value="Submit" {{widget_status_attribute}} />
<div class="ui-btn ui-input-clear ui-input-btn ui-corner-all ui-icon-times ui-btn-icon-notext" data-i18n="[node]header-submit">
- Submit<input data-enhanced="true" class="clear_button" type="submit" data-i18n="[value]header-submit" value="Submit" {{widget_status_attribute}} />
</div>
</div>
<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 " >
<div class="ui-shadow-inset ui-btn ui-btn-inline ui-corner-all ui-btn-{{theme}} ui-btn-icon-notext ui-icon-search ui-override-theme " >
<div class="ui-input-btn">
<input class="filter_button" data-role="button" data-enhanced="true" type="submit" data-i18n="[value]" value=" ">
<input class="search_button" data-role="button" data-enhanced="true" type="submit" data-i18n="[value]" value=" ">
</div>
</div>
</div>
......
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>948.36261.46161.37597</string> </value>
<value> <string>950.28959.27081.52548</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1453137329.15</float>
<float>1460449490.1</float>
<string>UTC</string>
</tuple>
</state>
......
/*global window, rJS, RSVP, loopEventListener, Handlebars */
/*global window, rJS, RSVP, Handlebars, loopEventListener */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP, loopEventListener, Handlebars) {
(function (window, rJS, RSVP, Handlebars, loopEventListener) {
"use strict";
/////////////////////////////////////////////////////////////////
......@@ -34,8 +34,6 @@
// acquired method
//////////////////////////////////////////////
.declareAcquiredMethod("translateHtml", "translateHtml")
.declareAcquiredMethod("renderEditorPanel", "renderEditorPanel")
.declareAcquiredMethod("getListboxInfo", "getListboxInfo")
/////////////////////////////////////////////////////////////////
// declared methods
......@@ -82,27 +80,17 @@
})
.declareService(function () {
var gadget = this,
url,
options = {},
sort_button = gadget.props.element.querySelector(".filter_button");
clear_button = gadget.props.element.querySelector(".clear_button"),
search_input = gadget.props.element.querySelector("input");
return loopEventListener(
sort_button,
clear_button,
"click",
false,
function () {
return new RSVP.Queue()
.push(function () {
return gadget.getListboxInfo();
})
.push(function (result) {
url = "gadget_erp5_search_editor.html";
options.extended_search = gadget.props.extended_search;
options.begin_from = result.begin_from;
options.search_column_list = result.search_column_list;
return gadget.renderEditorPanel(url, options);
});
search_input.value = "";
search_input.focus();
}
);
});
}(window, rJS, RSVP, loopEventListener, Handlebars));
\ No newline at end of file
}(window, rJS, RSVP, Handlebars, loopEventListener));
\ No newline at end of file
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>948.36257.33692.30037</string> </value>
<value> <string>950.28962.48103.49971</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1453137078.14</float>
<float>1460390605.12</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -3,7 +3,7 @@
(function (self, caches, fetch) {
"use strict";
var CACHE_NAME = 'Mon, 11 Apr 2016 14:30:00 GMT',
var CACHE_NAME = 'Tue, 12 Apr 2016 15:30:00 GMT',
// Files required to make this app work offline
REQUIRED_FILES = [
'./',
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>950.28810.53400.136</string> </value>
<value> <string>950.28811.3104.65297</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1460381462.83</float>
<float>1460470891.69</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -53,13 +53,13 @@
<tr>
<td>waitForElementPresent</td>
<td>//input[@class='filter_button']</td>
<td>//button[text()='Filter']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//input[@class='filter_button']</td>
<td>//button[text()='Filter']</td>
<td></td>
</tr>
......@@ -182,7 +182,7 @@
<tr>
<td>click</td>
<td>//input[@class='filter_button']</td>
<td>//button[text()='Filter']</td>
<td></td>
</tr>
......@@ -253,7 +253,7 @@
<tr>
<td>click</td>
<td>//input[@class='filter_button']</td>
<td>//button[text()='Filter']</td>
<td></td>
</tr>
......
......@@ -53,13 +53,13 @@
<tr>
<td>waitForElementPresent</td>
<td>//input[@class='filter_button']</td>
<td>//button[text()='Filter']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//input[@class='filter_button']</td>
<td>//button[text()='Filter']</td>
<td></td>
</tr>
......@@ -142,7 +142,7 @@
<tr>
<td>click</td>
<td>//input[@class='filter_button']</td>
<td>//button[text()='Filter']</td>
<td></td>
</tr>
......@@ -238,7 +238,7 @@
<tr>
<td>click</td>
<td>//input[@class='filter_button']</td>
<td>//button[text()='Filter']</td>
<td></td>
</tr>
......
......@@ -54,13 +54,13 @@
<tr>
<td>waitForElementPresent</td>
<td>//input[@class='filter_button']</td>
<td>//button[text()='Filter']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//input[@class='filter_button']</td>
<td>//button[text()='Filter']</td>
<td></td>
</tr>
......@@ -157,7 +157,7 @@
<tr>
<td>click</td>
<td>//input[@class='filter_button']</td>
<td>//button[text()='Filter']</td>
<td></td>
</tr>
......@@ -236,7 +236,7 @@
<tr>
<td>click</td>
<td>//input[@class='filter_button']</td>
<td>//button[text()='Filter']</td>
<td></td>
</tr>
......
......@@ -53,13 +53,13 @@
<tr>
<td>waitForElementPresent</td>
<td>//input[@class='filter_button']</td>
<td>//button[text()='Filter']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//input[@class='filter_button']</td>
<td>//button[text()='Filter']</td>
<td></td>
</tr>
......@@ -86,7 +86,7 @@
<tr>
<td>click</td>
<td>//input[@class='filter_button']</td>
<td>//button[text()='Filter']</td>
<td></td>
</tr>
......@@ -201,14 +201,14 @@
<tr>
<td>waitForElementPresent</td>
<td>//input[@class='filter_button']</td>
<td>//button[text()='Filter']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//input[@class='filter_button']</td>
<td>//button[text()='Filter']</td>
<td></td>
</tr>
......
......@@ -53,13 +53,13 @@
<tr>
<td>waitForElementPresent</td>
<td>//input[@class='filter_button']</td>
<td>//button[text()='Filter']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//input[@class='filter_button']</td>
<td>//button[text()='Filter']</td>
<td></td>
</tr>
......@@ -281,14 +281,14 @@
<tr>
<td>waitForElementPresent</td>
<td>//input[@class='filter_button']</td>
<td>//button[text()='Filter']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//input[@class='filter_button']</td>
<td>//button[text()='Filter']</td>
<td></td>
</tr>
......
......@@ -53,13 +53,13 @@
<tr>
<td>waitForElementPresent</td>
<td>//input[@class='filter_button']</td>
<td>//button[text()='Filter']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//input[@class='filter_button']</td>
<td>//button[text()='Filter']</td>
<td></td>
</tr>
......@@ -182,14 +182,14 @@
<tr>
<td>waitForElementPresent</td>
<td>//input[@class='filter_button']</td>
<td>//button[text()='Filter']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//input[@class='filter_button']</td>
<td>//button[text()='Filter']</td>
<td></td>
</tr>
......
......@@ -42,7 +42,7 @@
</tr>
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='erp5_searchfield']//input[@value='header-submit' and @type='submit']</td>
<td>//div[@data-gadget-scope='erp5_searchfield']//input[@class='search_button' and @type='submit']</td>
<td></td>
</tr>
<tr>
......
......@@ -76,7 +76,7 @@
</tr>
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='erp5_searchfield']//input[@value='header-submit' and @type='submit']</td>
<td>//div[@data-gadget-scope='erp5_searchfield']//input[@class='search_button' and @type='submit']</td>
<td></td>
</tr>
<tr>
......
......@@ -90,13 +90,13 @@
<tr>
<td>waitForElementPresent</td>
<td>//a[@class="responsive ui-btn ui-icon-spinner ui-btn-icon-left ui-first-child ui-last-child ui-disabled ui-icon-spin"]</td>
<td>//button[@class="responsive ui-btn ui-icon-spinner ui-btn-icon-left ui-first-child ui-last-child ui-disabled ui-icon-spin"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementNotPresent</td>
<td>//a[@class="responsive ui-btn ui-icon-spinner ui-btn-icon-left ui-first-child ui-last-child ui-disabled ui-icon-spin"]</td>
<td>//button[@class="responsive ui-btn ui-icon-spinner ui-btn-icon-left ui-first-child ui-last-child ui-disabled ui-icon-spin"]</td>
<td></td>
</tr>
......
......@@ -32,7 +32,7 @@
</tr>
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='erp5_searchfield']//input[@value='header-submit' and @type='submit']</td>
<td>//div[@data-gadget-scope='erp5_searchfield']//input[@class='search_button' and @type='submit']</td>
<td></td>
</tr>
<tr>
......
......@@ -37,7 +37,7 @@
</tr>
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='erp5_searchfield']//input[@value='header-submit' and @type='submit']</td>
<td>//div[@data-gadget-scope='erp5_searchfield']//input[@class='search_button' and @type='submit']</td>
<td></td>
</tr>
......
......@@ -70,7 +70,7 @@
</tr>
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='erp5_searchfield']//input[@value='header-submit' and @type='submit']</td>
<td>//div[@data-gadget-scope='erp5_searchfield']//input[@class='search_button' and @type='submit']</td>
<td></td>
</tr>
<tr>
......
......@@ -37,7 +37,7 @@
</tr>
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='erp5_searchfield']//input[@value='header-submit' and @type='submit']</td>
<td>//div[@data-gadget-scope='erp5_searchfield']//input[@class='search_button' and @type='submit']</td>
<td></td>
</tr>
......
......@@ -37,7 +37,7 @@
</tr>
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='erp5_searchfield']//input[@value='header-submit' and @type='submit']</td>
<td>//div[@data-gadget-scope='erp5_searchfield']//input[@class='search_button' and @type='submit']</td>
<td></td>
</tr>
<tr>
......
......@@ -70,7 +70,7 @@
</tr>
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='erp5_searchfield']//input[@value='header-submit' and @type='submit']</td>
<td>//div[@data-gadget-scope='erp5_searchfield']//input[@class='search_button' and @type='submit']</td>
<td></td>
</tr>
......
......@@ -51,7 +51,7 @@
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='erp5_searchfield']//input[@value='header-submit' and @type='submit']</td>
<td>//div[@data-gadget-scope='erp5_searchfield']//input[@class='search_button' and @type='submit']</td>
<td></td>
</tr>
......@@ -92,13 +92,13 @@
<tr>
<td>waitForElementPresent</td>
<td>//a[@class="responsive ui-btn ui-icon-spinner ui-btn-icon-left ui-first-child ui-last-child ui-disabled ui-icon-spin"]</td>
<td>//button[@class="responsive ui-btn ui-icon-spinner ui-btn-icon-left ui-first-child ui-last-child ui-disabled ui-icon-spin"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementNotPresent</td>
<td>//a[@class="responsive ui-btn ui-icon-spinner ui-btn-icon-left ui-first-child ui-last-child ui-disabled ui-icon-spin"]</td>
<td>//button[@class="responsive ui-btn ui-icon-spinner ui-btn-icon-left ui-first-child ui-last-child ui-disabled ui-icon-spin"]</td>
<td></td>
</tr>
......
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