Commit 56f06627 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Frontpage links to the latest search of the modules

parent 5412e7d5
......@@ -102,7 +102,7 @@
<value> <string encoding="cdata"><![CDATA[
CACHE MANIFEST\n
# generated on 12 Nov 2015 10:44:00 +0000\n
# generated on 12 Nov 2015 16:31:00 +0000\n
# XXX + fonts\n
# images/ajax-loader.gif\n
CACHE:\n
......@@ -334,7 +334,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>947.3415.22622.22289</string> </value>
<value> <string>947.3675.43345.17766</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -352,7 +352,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1447321457.28</float>
<float>1447342304.46</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -195,7 +195,7 @@
return search_gadget.getContent();\n
})\n
.push(function (data) {\n
return gadget.redirect({command: \'change\', options: {extended_search: data.search, begin_from: undefined}});\n
return gadget.redirect({command: \'store_and_change\', options: {extended_search: data.search, begin_from: undefined}});\n
});\n
}\n
// Listen to form submit\n
......@@ -342,7 +342,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>946.44927.40202.16725</string> </value>
<value> <string>947.821.64587.50432</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -360,7 +360,7 @@
</tuple>
<state>
<tuple>
<float>1445939450.54</float>
<float>1447166009.61</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -157,7 +157,7 @@
i;\n
for (i = 0; i < result.data.rows.length; i += 1) {\n
result_list.push(RSVP.all([\n
gadget.getUrlFor({command: \'display\', options: {jio_key: result.data.rows[i].id}}),\n
gadget.getUrlFor({command: \'display_stored_state\', options: {jio_key: result.data.rows[i].id}}),\n
result.data.rows[i].value.title || result.data.rows[i].id,\n
result.data.rows[i].value.business_application_title\n
]));\n
......@@ -373,7 +373,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>946.44927.40202.16725</string> </value>
<value> <string>947.821.64587.50432</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -391,7 +391,7 @@
</tuple>
<state>
<tuple>
<float>1446803705.01</float>
<float>1447323452.37</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -130,6 +130,7 @@
<body>\n
<div data-gadget-url="gadget_jio.html" data-gadget-scope="jio_selection"></div>\n
<div data-gadget-url="gadget_jio.html" data-gadget-scope="jio_navigation_history"></div>\n
<div data-gadget-url="gadget_jio.html" data-gadget-scope="jio_document_state"></div>\n
</body>\n
</html>\n
......@@ -269,7 +270,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>946.44927.40202.16725</string> </value>
<value> <string>947.821.64587.50432</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -287,7 +288,7 @@
</tuple>
<state>
<tuple>
<float>1446821965.62</float>
<float>1447168631.99</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -126,7 +126,9 @@
PREFIX_COMMAND = "!",\n
// PREFIX_ERROR = "?",\n
COMMAND_DISPLAY_STATE = "display",\n
COMMAND_DISPLAY_STORED_STATE = "display_stored_state",\n
COMMAND_CHANGE_STATE = "change",\n
COMMAND_STORE_AND_CHANGE_STATE = "store_and_change",\n
COMMAND_INDEX_STATE = "index",\n
COMMAND_SELECTION_PREVIOUS = "selection_previous",\n
COMMAND_SELECTION_NEXT = "selection_next",\n
......@@ -135,7 +137,9 @@
REDIRECT_TIMEOUT = 5000,\n
VALID_URL_COMMAND_DICT = {};\n
VALID_URL_COMMAND_DICT[COMMAND_DISPLAY_STATE] = null;\n
VALID_URL_COMMAND_DICT[COMMAND_DISPLAY_STORED_STATE] = null;\n
VALID_URL_COMMAND_DICT[COMMAND_CHANGE_STATE] = null;\n
VALID_URL_COMMAND_DICT[COMMAND_STORE_AND_CHANGE_STATE] = null;\n
VALID_URL_COMMAND_DICT[COMMAND_INDEX_STATE] = null;\n
VALID_URL_COMMAND_DICT[COMMAND_SELECTION_PREVIOUS] = null;\n
VALID_URL_COMMAND_DICT[COMMAND_SELECTION_NEXT] = null;\n
......@@ -300,9 +304,34 @@
return addNavigationHistoryAndDisplay(gadget, jio_key, next_options);\n
}\n
\n
function execChangeCommand(previous_options, next_options) {\n
var key,\n
jio_key;\n
function execDisplayStoredStateCommand(gadget, next_options) {\n
// console.warn(command_options);\n
var jio_key = next_options.jio_key,\n
queue;\n
delete next_options.jio_key;\n
\n
if (jio_key) {\n
queue = gadget.props.jio_state_gadget.get(jio_key)\n
.push(function (options) {\n
next_options = options;\n
}, function (error) {\n
if ((error instanceof jIO.util.jIOError) &&\n
(error.status_code === 404)) {\n
return;\n
}\n
throw error;\n
});\n
} else {\n
queue = new RSVP.Queue();\n
}\n
return queue\n
.push(function () {\n
return addNavigationHistoryAndDisplay(gadget, jio_key, next_options);\n
});\n
}\n
\n
function calculateChangeOptions(previous_options, next_options) {\n
var key;\n
for (key in previous_options) {\n
if (previous_options.hasOwnProperty(key)) {\n
if (!next_options.hasOwnProperty(key)) {\n
......@@ -317,12 +346,44 @@
}\n
}\n
}\n
jio_key = next_options.jio_key;\n
delete next_options.jio_key;\n
return next_options;\n
}\n
\n
function execChangeCommand(previous_options, next_options) {\n
var options,\n
jio_key;\n
options = calculateChangeOptions(previous_options, next_options);\n
\n
jio_key = options.jio_key;\n
delete options.jio_key;\n
return synchronousChangeState(\n
getDisplayUrlFor(jio_key, next_options)\n
getDisplayUrlFor(jio_key, options)\n
);\n
}\n
\n
function execStoreAndChangeCommand(gadget, previous_options, next_options) {\n
var options,\n
jio_key,\n
queue;\n
options = calculateChangeOptions(previous_options, next_options);\n
\n
jio_key = options.jio_key;\n
delete options.jio_key;\n
\n
if (jio_key) {\n
queue = gadget.props.jio_state_gadget.put(jio_key, options);\n
} else {\n
queue = new RSVP.Queue();\n
}\n
\n
\n
return queue\n
.push(function () {\n
return synchronousChangeState(\n
getDisplayUrlFor(jio_key, options)\n
);\n
});\n
}\n
\n
function execIndexCommand(gadget, previous_options, next_options) {\n
var jio_key = next_options.jio_key,\n
......@@ -598,12 +659,18 @@
if (command_options.path === COMMAND_DISPLAY_STATE) {\n
return execDisplayCommand(gadget, next_options);\n
}\n
if (command_options.path === COMMAND_DISPLAY_STORED_STATE) {\n
return execDisplayStoredStateCommand(gadget, next_options);\n
}\n
if (command_options.path === COMMAND_INDEX_STATE) {\n
return execIndexCommand(gadget, previous_options, next_options);\n
}\n
if (command_options.path === COMMAND_CHANGE_STATE) {\n
return execChangeCommand(previous_options, next_options);\n
}\n
if (command_options.path === COMMAND_STORE_AND_CHANGE_STATE) {\n
return execStoreAndChangeCommand(gadget, previous_options, next_options);\n
}\n
if (command_options.path === COMMAND_SELECTION_NEXT) {\n
return execSelectionNextCommand(gadget, previous_options, next_options);\n
}\n
......@@ -657,7 +724,6 @@
});\n
\n
}\n
\n
var result = loopEventListener(window, \'hashchange\', false,\n
extractHashAndDispatch),\n
event = document.createEvent("Event");\n
......@@ -703,6 +769,17 @@
});\n
});\n
})\n
\n
.ready(function (gadget) {\n
return gadget.getDeclaredGadget("jio_document_state")\n
.push(function (jio_gadget) {\n
gadget.props.jio_state_gadget = jio_gadget;\n
return jio_gadget.createJio({\n
type: "indexeddb",\n
database: "document_state"\n
});\n
});\n
})\n
\n
.declareMethod(\'getCommandUrlFor\', function (options) {\n
var command = options.command,\n
......@@ -913,7 +990,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>947.784.43671.16128</string> </value>
<value> <string>947.3470.27048.19353</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -931,7 +1008,7 @@
</tuple>
<state>
<tuple>
<float>1447162652.41</float>
<float>1447323762.19</float>
<string>UTC</string>
</tuple>
</state>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_text</string> </key>
<value> <unicode encoding="cdata"><![CDATA[
<html xmlns:tal="http://xml.zope.org/namespaces/tal"\n
xmlns:metal="http://xml.zope.org/namespaces/metal">\n
<head>\n
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\n
<title>Test Form List Search Action</title>\n
</head>\n
<body>\n
<table cellpadding="1" cellspacing="1" border="1">\n
<thead>\n
<tr><td rowspan="1" colspan="3">Test Default Module View</td></tr>\n
</thead><tbody>\n
<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />\n
\n
<tr>\n
<td>open</td>\n
<td>${base_url}/web_site_module/renderjs_runner/#/foo_module</td>\n
<td></td>\n
</tr>\n
\n
<!-- Wait for gadget to be loaded -->\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-url=\'${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_list.html\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForTextPresent</td>\n
<td>Foos</td>\n
<td></td>\n
</tr>\n
\n
<!-- Page has a search field -->\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-scope=\'m\']//div[@data-gadget-scope=\'erp5_searchfield\']//input[@type=\'text\' and @name=\'search\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>type</td>\n
<td>search</td>\n
<td>foobar</td>\n
</tr>\n
<tr>\n
<td>click</td>\n
<td>//div[@data-gadget-scope=\'erp5_searchfield\']//input[@value=\'header-submit\' and @type=\'submit\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>pause</td>\n
<td>1000</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-scope=\'m\']//div[@data-gadget-scope=\'erp5_searchfield\']//input[@type=\'text\' and @name=\'search\' and @value=\'foobar\']</td>\n
<td></td>\n
</tr>\n
\n
</tbody></table>\n
</body>\n
</html>
]]></unicode> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testFormListSearchAction</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -70,12 +70,12 @@
<!-- Generate links to module -->\n
<tr>\n
<td>assertElementPresent</td>\n
<td>//div[@data-gadget-scope=\'m\']//a[text()=\'Bars\' and contains(@href, \'#!display\') and contains(@href, \'n.jio_key=bar_module\')]</td>\n
<td>//div[@data-gadget-scope=\'m\']//a[text()=\'Bars\' and contains(@href, \'#!display_stored_state\') and contains(@href, \'n.jio_key=bar_module\')]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>assertElementPresent</td>\n
<td>//div[@data-gadget-scope=\'m\']//a[text()=\'Foos\' and contains(@href, \'#!display\') and contains(@href, \'n.jio_key=foo_module\')]</td>\n
<td>//div[@data-gadget-scope=\'m\']//a[text()=\'Foos\' and contains(@href, \'#!display_stored_state\') and contains(@href, \'n.jio_key=foo_module\')]</td>\n
<td></td>\n
</tr>\n
\n
......@@ -83,7 +83,7 @@
<!-- Header has a link to the previous history entry -->\n
<tr>\n
<td>click</td>\n
<td>//div[@data-gadget-scope=\'m\']//a[text()=\'Foos\' and contains(@href, \'#!display\') and contains(@href, \'n.jio_key=foo_module\')]</td>\n
<td>//div[@data-gadget-scope=\'m\']//a[text()=\'Foos\' and contains(@href, \'#!display_stored_state\') and contains(@href, \'n.jio_key=foo_module\')]</td>\n
<td></td>\n
</tr>\n
<tr>\n
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_text</string> </key>
<value> <unicode encoding="cdata"><![CDATA[
<html xmlns:tal="http://xml.zope.org/namespaces/tal"\n
xmlns:metal="http://xml.zope.org/namespaces/metal">\n
<head>\n
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\n
<title>Test Display Stored State</title>\n
</head>\n
<body>\n
<table cellpadding="1" cellspacing="1" border="1">\n
<thead>\n
<tr><td rowspan="1" colspan="3">Test Default Module View</td></tr>\n
</thead><tbody>\n
<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />\n
\n
<tr>\n
<td>open</td>\n
<td>${base_url}/web_site_module/renderjs_runner/#/foo_module</td>\n
<td></td>\n
</tr>\n
\n
<!-- Wait for gadget to be loaded -->\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-url=\'${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_list.html\']</td>\n
<td></td>\n
</tr>\n
\n
<!-- Enter a search query to store the state -->\n
<tr>\n
<td>type</td>\n
<td>search</td>\n
<td>title</td>\n
</tr>\n
<tr>\n
<td>click</td>\n
<td>//div[@data-gadget-scope=\'erp5_searchfield\']//input[@value=\'header-submit\' and @type=\'submit\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>pause</td>\n
<td>1000</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>waitForTextPresent</td>\n
<td>Title 1</td>\n
<td></td>\n
</tr>\n
\n
<!-- Go to the module page -->\n
<tr>\n
<td>click</td>\n
<td>//div[@data-gadget-scope=\'header\']//button[text()=\'Menu\' and @type=\'submit\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-scope=\'panel\']//div[contains(@class, \'ui-panel-open\')]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>click</td>\n
<td>//div[@data-gadget-scope=\'panel\']//a[text()=\'Modules\']</td>\n
<td></td>\n
</tr>\n
\n
<!-- Wait for gadget to be loaded -->\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-url=\'${base_url}/web_site_module/renderjs_runner/gadget_erp5_page_front.html\']</td>\n
<td></td>\n
</tr>\n
\n
<!-- Go back to foo module -->\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//h3[@data-i18n=\'Other\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>click</td>\n
<td>//h3[@data-i18n=\'Other\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-scope=\'m\']//a[@data-i18n=\'Foos\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>click</td>\n
<td>//div[@data-gadget-scope=\'m\']//a[@data-i18n=\'Foos\']</td>\n
<td></td>\n
</tr>\n
\n
<!-- Wait for gadget to be loaded -->\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//div[@data-gadget-url=\'${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_list.html\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>assertElementPresent</td>\n
<td>//div[@data-gadget-scope=\'erp5_searchfield\']//input[@value=\'title\' and @type=\'text\' and @name=\'search\']</td>\n
<td></td>\n
</tr>\n
\n
</tbody></table>\n
</body>\n
</html>
]]></unicode> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testCommandDisplayStoredStateJumpToLatestDocumentContext</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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