Commit cbfb6ccb authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Editable parameter is now sticky

Allow to switch from editable/viewable mode directly from the panel.
Drop editable/viewable button on tabpage.

The editable parameter is propagated by all links.
parent 4469fdaf
...@@ -498,6 +498,19 @@ div[data-gadget-scope='panel'] img { ...@@ -498,6 +498,19 @@ div[data-gadget-scope='panel'] img {
text-align: left; text-align: left;
height: 100%; height: 100%;
} }
div[data-gadget-scope='panel'] div[data-gadget-scope="erp5_checkbox"] {
padding: 3pt;
padding-left: 12pt;
}
div[data-gadget-scope='panel'] div[data-gadget-scope="erp5_checkbox"] label,
div[data-gadget-scope='panel'] div[data-gadget-scope="erp5_checkbox"] span,
div[data-gadget-scope='panel'] div[data-gadget-scope="erp5_checkbox"] input {
cursor: pointer;
}
div[data-gadget-scope='panel'] div[data-gadget-scope="erp5_checkbox"] span {
width: 24pt;
display: inline-block;
}
div[data-gadget-scope='panel'] ul:first-child { div[data-gadget-scope='panel'] ul:first-child {
margin-top: 30pt; margin-top: 30pt;
} }
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>958.22948.35082.52087</string> </value> <value> <string>958.38697.56980.48179</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1490947545.17</float> <float>1491827283.31</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" /> <meta name="viewport" content="width=device-width, user-scalable=no" />
<title>ERP5 Panel</title> <title>ERP5 Panel</title>
<!--
data-i18n=Editable
-->
<!-- renderjs --> <!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script> <script src="rsvp.js" type="text/javascript"></script>
...@@ -35,17 +38,22 @@ ...@@ -35,17 +38,22 @@
data-gadget-sandbox="public"></div> data-gadget-sandbox="public"></div>
</form> </form>
<ul data-role="listview" class="ui-listview" data-enhanced="true"> <ul data-role="listview" class="ui-listview" data-enhanced="true"></ul>
<li class="ui-first-child"><a href="#" class="ui-btn ui-btn-icon-left ui-icon-home" data-i18n="Home">Home</a></li> <div data-gadget-url="gadget_erp5_field_checkbox.html"
data-gadget-scope="erp5_checkbox"
data-gadget-sandbox="public"></div>
<dl></dl>
</div>
</script>
<script id="panel-template-body-list" type="text/x-handlebars-template">
<li class="ui-first-child"><a href="{{front_href}}" class="ui-btn ui-btn-icon-left ui-icon-home" data-i18n="Home">Home</a></li>
<li><a href="{{module_href}}" class="ui-btn ui-btn-icon-left ui-icon-puzzle-piece" data-i18n="Modules" accesskey="m">Modules</a></li> <li><a href="{{module_href}}" class="ui-btn ui-btn-icon-left ui-icon-puzzle-piece" data-i18n="Modules" accesskey="m">Modules</a></li>
<li><a href="{{worklist_href}}" class="ui-btn ui-btn-icon-left ui-icon-clipboard" data-i18n="Worklists" accesskey="w">Worklists</a></li> <li><a href="{{worklist_href}}" class="ui-btn ui-btn-icon-left ui-icon-clipboard" data-i18n="Worklists" accesskey="w">Worklists</a></li>
<li><a href="{{history_href}}" class="ui-btn ui-btn-icon-left ui-icon-history" data-i18n="History" accesskey="h">History</a></li> <li><a href="{{history_href}}" class="ui-btn ui-btn-icon-left ui-icon-history" data-i18n="History" accesskey="h">History</a></li>
<li><a href="{{search_href}}" class="ui-btn ui-btn-icon-left ui-icon-search" data-i18n="Search" accesskey="s">Search</a></li> <li><a href="{{search_href}}" class="ui-btn ui-btn-icon-left ui-icon-search" data-i18n="Search" accesskey="s">Search</a></li>
<li><a href="{{preference_href}}" class="ui-btn ui-btn-icon-left ui-icon-gear" data-i18n="Preferences">Preferences</a></li> <li><a href="{{preference_href}}" class="ui-btn ui-btn-icon-left ui-icon-gear" data-i18n="Preferences">Preferences</a></li>
<li class="ui-last-child"><a href="{{logout_href}}" class="ui-btn ui-btn-icon-left ui-icon-power-off" data-i18n="Logout" accesskey="o">Logout</a></li> <li class="ui-last-child"><a href="{{logout_href}}" class="ui-btn ui-btn-icon-left ui-icon-power-off" data-i18n="Logout" accesskey="o">Logout</a></li>
</ul>
<dl></dl>
</div>
</script> </script>
<script id="panel-template-body-desktop" type="text/x-handlebars-template"> <script id="panel-template-body-desktop" type="text/x-handlebars-template">
......
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>957.46848.56526.7116</string> </value> <value> <string>958.33121.48203.5614</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1488384141.54</float> <float>1491822419.47</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*jslint nomen: true, indent: 2, maxerr: 3 */ /*jslint nomen: true, indent: 2, maxerr: 3, unparam: true */
/*global window, document, rJS, Handlebars, RSVP, Node, loopEventListener */ /*global window, document, rJS, Handlebars, RSVP, Node, loopEventListener */
(function (window, document, rJS, Handlebars, RSVP, Node, loopEventListener) { (function (window, document, rJS, Handlebars, RSVP, Node, loopEventListener) {
"use strict"; "use strict";
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
panel_template_body = Handlebars.compile(template_element panel_template_body = Handlebars.compile(template_element
.getElementById("panel-template-body") .getElementById("panel-template-body")
.innerHTML), .innerHTML),
panel_template_body_list = Handlebars.compile(template_element
.getElementById("panel-template-body-list")
.innerHTML),
panel_template_body_desktop = Handlebars.compile(template_element panel_template_body_desktop = Handlebars.compile(template_element
.getElementById("panel-template-body-desktop") .getElementById("panel-template-body-desktop")
.innerHTML); .innerHTML);
...@@ -29,7 +32,9 @@ ...@@ -29,7 +32,9 @@
////////////////////////////////////////////// //////////////////////////////////////////////
.declareAcquiredMethod("getUrlFor", "getUrlFor") .declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("translateHtml", "translateHtml") .declareAcquiredMethod("translateHtml", "translateHtml")
.declareAcquiredMethod("translate", "translate")
.declareAcquiredMethod("redirect", "redirect") .declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("getUrlParameter", "getUrlParameter")
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// declared methods // declared methods
...@@ -48,7 +53,8 @@ ...@@ -48,7 +53,8 @@
.declareMethod('render', function (options) { .declareMethod('render', function (options) {
var erp5_document = options.erp5_document, var erp5_document = options.erp5_document,
workflow_list, workflow_list,
view_list; view_list,
context = this;
if (erp5_document !== undefined) { if (erp5_document !== undefined) {
workflow_list = erp5_document._links.action_workflow || []; workflow_list = erp5_document._links.action_workflow || [];
view_list = erp5_document._links.action_object_view || []; view_list = erp5_document._links.action_object_view || [];
...@@ -63,11 +69,14 @@ ...@@ -63,11 +69,14 @@
workflow_list = JSON.stringify(workflow_list); workflow_list = JSON.stringify(workflow_list);
view_list = JSON.stringify(view_list); view_list = JSON.stringify(view_list);
} }
return this.changeState({ return context.getUrlParameter('editable')
.push(function (editable) {
return context.changeState({
workflow_list: workflow_list, workflow_list: workflow_list,
view_list: view_list, view_list: view_list,
global: true, global: true,
editable: options.editable editable: options.editable || editable || false
});
}); });
}) })
...@@ -92,32 +101,16 @@ ...@@ -92,32 +101,16 @@
if (modification_dict.hasOwnProperty("global")) { if (modification_dict.hasOwnProperty("global")) {
queue queue
.push(function () { .push(function () {
return RSVP.all([
context.getUrlFor({command: 'display', options: {page: "front"}}),
context.getUrlFor({command: 'display', options: {page: "history"}}),
context.getUrlFor({command: 'display', options: {page: "preference"}}),
context.getUrlFor({command: 'display', options: {page: "logout"}}),
context.getUrlFor({command: 'display', options: {page: "search"}}),
context.getUrlFor({command: 'display', options: {page: "worklist"}})
]);
})
.push(function (result_list) {
// XXX: Customize panel header! // XXX: Customize panel header!
return context.translateHtml( return context.translateHtml(
panel_template_header() + panel_template_header() +
panel_template_body({ panel_template_body()
"module_href": result_list[0],
"history_href": result_list[1],
"preference_href": result_list[2],
"logout_href": result_list[3],
"search_href": result_list[4],
"worklist_href": result_list[5]
})
); );
}) })
.push(function (my_translated_or_plain_html) { .push(function (my_translated_or_plain_html) {
tmp_element = document.createElement('div'); tmp_element = document.createElement('div');
tmp_element.innerHTML = my_translated_or_plain_html; tmp_element.innerHTML = my_translated_or_plain_html;
return context.declareGadget('gadget_erp5_searchfield.html', { return context.declareGadget('gadget_erp5_searchfield.html', {
scope: "erp5_searchfield", scope: "erp5_searchfield",
element: tmp_element.querySelector('[data-gadget-scope="erp5_searchfield"]') element: tmp_element.querySelector('[data-gadget-scope="erp5_searchfield"]')
...@@ -128,12 +121,75 @@ ...@@ -128,12 +121,75 @@
focus: false focus: false
}); });
}) })
.push(function () {
return context.declareGadget('gadget_erp5_field_multicheckbox.html', {
scope: "erp5_checkbox",
element: tmp_element.querySelector('[data-gadget-scope="erp5_checkbox"]')
});
})
.push(function () { .push(function () {
context.element.querySelector("div").appendChild(tmp_element); context.element.querySelector("div").appendChild(tmp_element);
return context.listenResize(); return context.listenResize();
}); });
} }
if (modification_dict.hasOwnProperty("editable")) {
queue
// Update the global links
.push(function () {
return RSVP.all([
context.getUrlFor({command: 'display', options: {page: "front"}}),
context.getUrlFor({command: 'display', options: {page: "history"}}),
context.getUrlFor({command: 'display', options: {page: "preference"}}),
context.getUrlFor({command: 'display', options: {page: "logout"}}),
context.getUrlFor({command: 'display', options: {page: "search"}}),
context.getUrlFor({command: 'display', options: {page: "worklist"}}),
context.getUrlFor({command: 'display'})
]);
})
.push(function (result_list) {
return context.translateHtml(
panel_template_body_list({
"module_href": result_list[0],
"history_href": result_list[1],
"preference_href": result_list[2],
"logout_href": result_list[3],
"search_href": result_list[4],
"worklist_href": result_list[5],
"front_href": result_list[6]
})
);
})
.push(function (result) {
context.element.querySelector("ul").innerHTML = result;
// Update the checkbox field value
return RSVP.all([
context.getDeclaredGadget("erp5_checkbox"),
context.translate("Editable")
]);
})
.push(function (result_list) {
var value = [],
search_gadget = result_list[0],
title = result_list[1];
if (context.state.editable) {
value = ['editable'];
}
return search_gadget.render({field_json: {
editable: true,
name: 'editable',
key: 'editable',
hidden: false,
items: [[title, 'editable']],
default: value
}});
});
}
if ((this.state.global === true) && if ((this.state.global === true) &&
(modification_dict.hasOwnProperty("desktop") || (modification_dict.hasOwnProperty("desktop") ||
modification_dict.hasOwnProperty("editable") || modification_dict.hasOwnProperty("editable") ||
...@@ -240,10 +296,29 @@ ...@@ -240,10 +296,29 @@
return result; return result;
}) })
.allowPublicAcquisition('notifyChange', function () { .allowPublicAcquisition('notifyChange', function (argument_list, scope) {
if (scope === 'erp5_checkbox') {
var context = this;
return context.getDeclaredGadget('erp5_checkbox')
.push(function (gadget) {
return gadget.getContent();
})
.push(function (result) {
var options = {editable: undefined};
if (result.editable.length === 1) {
options.editable = true;
}
return context.redirect({command: 'change', options: options});
});
}
// Typing a search query should not modify the header status // Typing a search query should not modify the header status
return; return;
}) })
.allowPublicAcquisition('notifyValid', function () {
// Typing a search query should not modify the header status
return;
})
.onEvent('submit', function () { .onEvent('submit', function () {
var gadget = this; var gadget = this;
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>958.19723.40120.16469</string> </value> <value> <string>958.33121.48203.5614</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1490688736.61</float> <float>1491816291.84</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -52,8 +52,7 @@ ...@@ -52,8 +52,7 @@
command: 'change', command: 'change',
options: { options: {
view: view_list[i].href, view: view_list[i].href,
page: undefined, page: undefined
editable: options.editable
} }
}) })
); );
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>955.29509.41156.45721</string> </value> <value> <string>956.58742.58866.48708</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1479825199.32</float> <float>1491225034.71</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>957.40691.44097.35481</string> </value> <value> <string>958.28347.56387.25600</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1488273849.34</float> <float>1491225124.12</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*global window, rJS, RSVP, calculatePageTitle */ /*global window, rJS, RSVP, calculatePageTitle, jIO */
/*jslint nomen: true, indent: 2, maxerr: 3 */ /*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP, calculatePageTitle) { (function (window, rJS, RSVP, calculatePageTitle, jIO) {
"use strict"; "use strict";
rJS(window) rJS(window)
...@@ -71,13 +71,13 @@ ...@@ -71,13 +71,13 @@
} }
if (delete_action !== undefined) { if (delete_action !== undefined) {
delete_action = form_gadget.getUrlFor({command: 'change', options: {view: delete_action.href, editable: undefined}}); delete_action = form_gadget.getUrlFor({command: 'change', options: {view: delete_action.href}});
} else { } else {
delete_action = ""; delete_action = "";
} }
return RSVP.all([ return RSVP.all([
form_gadget.getUrlFor({command: 'change', options: {page: "tab"}}), form_gadget.getUrlFor({command: 'change', options: {page: "tab"}}),
form_gadget.getUrlFor({command: 'change', options: {page: "action", editable: true}}), form_gadget.getUrlFor({command: 'change', options: {page: "action"}}),
new_content_action, new_content_action,
form_gadget.getUrlFor({command: 'history_previous'}), form_gadget.getUrlFor({command: 'history_previous'}),
delete_action, delete_action,
...@@ -137,9 +137,8 @@ ...@@ -137,9 +137,8 @@
.push(function (result_list) { .push(function (result_list) {
if (result_list[1].target.responseType === "blob") { if (result_list[1].target.responseType === "blob") {
return jIO.util.readBlobAsText(result_list[1].target.response); return jIO.util.readBlobAsText(result_list[1].target.response);
} else {
return {target: {result: result_list[1].target.response}};
} }
return {target: {result: result_list[1].target.response}};
}) })
.push(function (event) { .push(function (event) {
var message; var message;
...@@ -171,9 +170,8 @@ ...@@ -171,9 +170,8 @@
.push(function () { .push(function () {
if (error.target.responseType === "blob") { if (error.target.responseType === "blob") {
return jIO.util.readBlobAsText(error.target.response); return jIO.util.readBlobAsText(error.target.response);
} else {
return {target: {result: error.target.response}};
} }
return {target: {result: error.target.response}};
}) })
.push(function (event) { .push(function (event) {
return form_gadget.displayFormulatorValidationError(JSON.parse(event.target.result)); return form_gadget.displayFormulatorValidationError(JSON.parse(event.target.result));
...@@ -187,4 +185,4 @@ ...@@ -187,4 +185,4 @@
}, false, true); }, false, true);
}(window, rJS, RSVP, calculatePageTitle)); }(window, rJS, RSVP, calculatePageTitle, jIO));
\ No newline at end of file \ No newline at end of file
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>957.33876.27734.63044</string> </value> <value> <string>958.31331.40640.10291</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1490373394.35</float> <float>1491385195.38</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -62,7 +62,6 @@ ...@@ -62,7 +62,6 @@
.push(function (result2) { .push(function (result2) {
return gadget.redirect({command: 'change', options: { return gadget.redirect({command: 'change', options: {
view: result2._links.view[0].href, view: result2._links.view[0].href,
editable: undefined,
page: undefined page: undefined
}}); }});
}); });
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>958.2825.24067.48281</string> </value> <value> <string>958.28347.56387.25600</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1489674820.97</float> <float>1491391860.07</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
gadget = this, gadget = this,
erp5_document, erp5_document,
tab_title = "Views", tab_title = "Views",
tab_icon = options.editable ? "pencil" : "eye", tab_icon = "eye",
jump_list; jump_list;
function handleParent(parent_link) { function handleParent(parent_link) {
...@@ -88,7 +88,6 @@ ...@@ -88,7 +88,6 @@
for (i = 0; i < view_list.length; i += 1) { for (i = 0; i < view_list.length; i += 1) {
promise_list.push(gadget.getUrlFor({command: 'change', options: { promise_list.push(gadget.getUrlFor({command: 'change', options: {
view: view_list[i].href, view: view_list[i].href,
editable: options.editable,
page: undefined page: undefined
}})); }}));
} }
...@@ -147,10 +146,7 @@ ...@@ -147,10 +146,7 @@
gadget.getUrlFor({command: 'change', options: { gadget.getUrlFor({command: 'change', options: {
page: undefined page: undefined
}}), }}),
calculatePageTitle(gadget, erp5_document), calculatePageTitle(gadget, erp5_document)
gadget.getUrlFor({command: 'change', options: {
editable: options.editable ? undefined : true
}})
]); ]);
}) })
.push(function (url_list) { .push(function (url_list) {
...@@ -158,11 +154,6 @@ ...@@ -158,11 +154,6 @@
back_url: url_list[0], back_url: url_list[0],
page_title: url_list[1] page_title: url_list[1]
}; };
if (options.editable) {
dict.view_url = url_list[2];
} else {
dict.edit_url = url_list[2];
}
return gadget.updateHeader(dict); return gadget.updateHeader(dict);
}); });
}); });
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>955.29510.26421.23705</string> </value> <value> <string>958.28347.56387.25600</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1479825091.01</float> <float>1491225418.18</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -15,20 +15,36 @@ ...@@ -15,20 +15,36 @@
PREFIX_DISPLAY = "/", PREFIX_DISPLAY = "/",
PREFIX_COMMAND = "!", PREFIX_COMMAND = "!",
// PREFIX_ERROR = "?", // PREFIX_ERROR = "?",
// Display a jio document with only the passed parameters
COMMAND_DISPLAY_STATE = "display", COMMAND_DISPLAY_STATE = "display",
// Store the jio key for the person document of the user
COMMAND_LOGIN = "login", COMMAND_LOGIN = "login",
// Display a raw string URL
COMMAND_RAW = "raw", COMMAND_RAW = "raw",
// Redisplay the page with the same parameters
COMMAND_RELOAD = "reload", COMMAND_RELOAD = "reload",
// Display the latest state stored for a jio document
COMMAND_DISPLAY_STORED_STATE = "display_stored_state", COMMAND_DISPLAY_STORED_STATE = "display_stored_state",
// Display the current jio document, but change some URL parameters
COMMAND_CHANGE_STATE = "change", COMMAND_CHANGE_STATE = "change",
// Like change, but also store the current jio document display state
COMMAND_STORE_AND_CHANGE_STATE = "store_and_change", COMMAND_STORE_AND_CHANGE_STATE = "store_and_change",
// Display one entry index from a selection
COMMAND_INDEX_STATE = "index", COMMAND_INDEX_STATE = "index",
// Display previous entry index from a selection
COMMAND_SELECTION_PREVIOUS = "selection_previous", COMMAND_SELECTION_PREVIOUS = "selection_previous",
// Display next entry index from a selection
COMMAND_SELECTION_NEXT = "selection_next", COMMAND_SELECTION_NEXT = "selection_next",
// Display previously accessed document
COMMAND_HISTORY_PREVIOUS = "history_previous", COMMAND_HISTORY_PREVIOUS = "history_previous",
// Store the current document in history and display the next one
COMMAND_PUSH_HISTORY = "push_history", COMMAND_PUSH_HISTORY = "push_history",
// Change UI language
COMMAND_CHANGE_LANGUAGE = "change_language", COMMAND_CHANGE_LANGUAGE = "change_language",
VALID_URL_COMMAND_DICT = {}; VALID_URL_COMMAND_DICT = {},
STICKY_PARAMETER_LIST = ['editable'];
VALID_URL_COMMAND_DICT[COMMAND_DISPLAY_STATE] = null; VALID_URL_COMMAND_DICT[COMMAND_DISPLAY_STATE] = null;
VALID_URL_COMMAND_DICT[COMMAND_DISPLAY_STORED_STATE] = null; VALID_URL_COMMAND_DICT[COMMAND_DISPLAY_STORED_STATE] = null;
VALID_URL_COMMAND_DICT[COMMAND_CHANGE_STATE] = null; VALID_URL_COMMAND_DICT[COMMAND_CHANGE_STATE] = null;
...@@ -43,6 +59,32 @@ ...@@ -43,6 +59,32 @@
VALID_URL_COMMAND_DICT[COMMAND_RELOAD] = null; VALID_URL_COMMAND_DICT[COMMAND_RELOAD] = null;
VALID_URL_COMMAND_DICT[COMMAND_CHANGE_LANGUAGE] = null; VALID_URL_COMMAND_DICT[COMMAND_CHANGE_LANGUAGE] = null;
function dropStickyParameterEntry(options) {
// Drop sticky parameters from an options dict
// Do not modify the options parameters, to prevent any unexpected side effect
var i,
result = JSON.parse(JSON.stringify(options));
for (i = 0; i < STICKY_PARAMETER_LIST.length; i += 1) {
delete result[STICKY_PARAMETER_LIST[i]];
}
return result;
}
function copyStickyParameterDict(previous_options, next_options, drop_options) {
var i,
key;
// Keep sticky parameters if they are currently defined in URL
if (drop_options === undefined) {
drop_options = {};
}
for (i = 0; i < STICKY_PARAMETER_LIST.length; i += 1) {
key = STICKY_PARAMETER_LIST[i];
// Check that sticky parameter previously exist and that it was not modified
if (previous_options.hasOwnProperty(key) && (!(next_options.hasOwnProperty(key) || drop_options.hasOwnProperty(key)))) {
next_options[key] = previous_options[key];
}
}
}
function endsWith(str, suffix) { function endsWith(str, suffix) {
return str.indexOf(suffix, str.length - suffix.length) !== -1; return str.indexOf(suffix, str.length - suffix.length) !== -1;
...@@ -68,6 +110,9 @@ ...@@ -68,6 +110,9 @@
} }
function addHistory(gadget, options, previous_selection_id) { function addHistory(gadget, options, previous_selection_id) {
// Drop sticky parameters
options = dropStickyParameterEntry(options);
var options_blob = { var options_blob = {
type: "options", type: "options",
data: options data: options
...@@ -242,6 +287,8 @@ ...@@ -242,6 +287,8 @@
if (jio_key) { if (jio_key) {
queue = gadget.props.jio_state_gadget.get(jio_key) queue = gadget.props.jio_state_gadget.get(jio_key)
.push(function (options) { .push(function (options) {
// Keep the sticky parameters
copyStickyParameterDict(next_options, options);
next_options = options; next_options = options;
}, function (error) { }, function (error) {
if ((error instanceof jIO.util.jIOError) && if ((error instanceof jIO.util.jIOError) &&
...@@ -291,23 +338,24 @@ ...@@ -291,23 +338,24 @@
function execStoreAndChangeCommand(gadget, previous_options, next_options, drop_options) { function execStoreAndChangeCommand(gadget, previous_options, next_options, drop_options) {
var options, var options,
jio_key, jio_key,
queue; queue,
display_url;
options = calculateChangeOptions(previous_options, next_options, drop_options); options = calculateChangeOptions(previous_options, next_options, drop_options);
jio_key = options.jio_key; jio_key = options.jio_key;
delete options.jio_key; delete options.jio_key;
display_url = getDisplayUrlFor(jio_key, options);
if (jio_key) { if (jio_key) {
queue = gadget.props.jio_state_gadget.put(jio_key, options); queue = gadget.props.jio_state_gadget.put(jio_key, dropStickyParameterEntry(options));
} else { } else {
queue = new RSVP.Queue(); queue = new RSVP.Queue();
} }
return queue return queue
.push(function () { .push(function () {
return synchronousChangeState( return synchronousChangeState(display_url);
getDisplayUrlFor(jio_key, options)
);
}); });
} }
...@@ -376,14 +424,16 @@ ...@@ -376,14 +424,16 @@
getCommandUrlFor(gadget, COMMAND_HISTORY_PREVIOUS, previous_options) getCommandUrlFor(gadget, COMMAND_HISTORY_PREVIOUS, previous_options)
); );
} }
return addNavigationHistoryAndDisplay( var options = {
gadget,
result.data.rows[0].id,
{
selection: previous_options.selection, selection: previous_options.selection,
selection_index: parseInt(previous_options.selection_index || '0', 10) + 1, selection_index: parseInt(previous_options.selection_index || '0', 10) + 1,
history: previous_options.history history: previous_options.history
} };
copyStickyParameterDict(previous_options, options);
return addNavigationHistoryAndDisplay(
gadget,
result.data.rows[0].id,
options
); );
}); });
}, function (error) { }, function (error) {
...@@ -425,14 +475,16 @@ ...@@ -425,14 +475,16 @@
getCommandUrlFor(gadget, COMMAND_HISTORY_PREVIOUS, previous_options) getCommandUrlFor(gadget, COMMAND_HISTORY_PREVIOUS, previous_options)
); );
} }
return addNavigationHistoryAndDisplay( var options = {
gadget,
result.data.rows[0].id,
{
selection: previous_options.selection, selection: previous_options.selection,
selection_index: parseInt(previous_options.selection_index, 10) - 1, selection_index: parseInt(previous_options.selection_index, 10) - 1,
history: previous_options.history history: previous_options.history
} };
copyStickyParameterDict(previous_options, options);
return addNavigationHistoryAndDisplay(
gadget,
result.data.rows[0].id,
options
); );
}); });
}, function (error) { }, function (error) {
...@@ -446,15 +498,16 @@ ...@@ -446,15 +498,16 @@
}); });
} }
function redirectToParent(gadget, jio_key) { function redirectToParent(gadget, jio_key, previous_options) {
return gadget.jio_getAttachment(jio_key, "links") return gadget.jio_getAttachment(jio_key, "links")
.push(function (erp5_document) { .push(function (erp5_document) {
var parent_link = erp5_document._links.parent, var parent_link = erp5_document._links.parent,
uri; uri,
options = {};
if (parent_link !== undefined) { if (parent_link !== undefined) {
uri = new URI(parent_link.href); uri = new URI(parent_link.href);
copyStickyParameterDict(previous_options, options);
return addNavigationHistoryAndDisplay(gadget, uri.segment(2), {}); return addNavigationHistoryAndDisplay(gadget, uri.segment(2), options);
} }
}); });
} }
...@@ -468,7 +521,7 @@ ...@@ -468,7 +521,7 @@
previous_id; previous_id;
if (history === undefined) { if (history === undefined) {
if (jio_key !== undefined) { if (jio_key !== undefined) {
return redirectToParent(gadget, jio_key); return redirectToParent(gadget, jio_key, previous_options);
} }
} }
if (previous_options.back_field) { if (previous_options.back_field) {
...@@ -511,12 +564,14 @@ ...@@ -511,12 +564,14 @@
options = result_list[0].data, options = result_list[0].data,
next_jio_key = options.jio_key; next_jio_key = options.jio_key;
delete options.jio_key; delete options.jio_key;
copyStickyParameterDict(previous_options, options);
return addNavigationHistoryAndDisplay(gadget, next_jio_key, options); return addNavigationHistoryAndDisplay(gadget, next_jio_key, options);
}, function (error) { }, function (error) {
// XXX Check if 404 // XXX Check if 404
if ((error instanceof jIO.util.jIOError) && if ((error instanceof jIO.util.jIOError) &&
(error.status_code === 404)) { (error.status_code === 404)) {
return redirectToParent(gadget, jio_key); return redirectToParent(gadget, jio_key, previous_options);
// return [{data: {}}, undefined]; // return [{data: {}}, undefined];
} }
throw error; throw error;
...@@ -544,14 +599,19 @@ ...@@ -544,14 +599,19 @@
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
// Command URL functions // Command URL functions
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
function routeMethodLess(gadget) { function routeMethodLess(gadget, previous_options) {
// Nothing. Go to front page // Nothing. Go to front page
// If no frontpage is configured, his may comes from missing configuration on website // If no frontpage is configured, his may comes from missing configuration on website
// or default HTML gadget modification date more recent than the website modification date // or default HTML gadget modification date more recent than the website modification date
return gadget.getSetting("frontpage_gadget") return gadget.getSetting("frontpage_gadget")
.push(function (result) { .push(function (result) {
var options = {page: result};
if (previous_options === undefined) {
previous_options = {};
}
copyStickyParameterDict(previous_options, options);
return synchronousChangeState( return synchronousChangeState(
getDisplayUrlFor(undefined, {page: result}) getDisplayUrlFor(undefined, options)
); );
}); });
} }
...@@ -573,7 +633,7 @@ ...@@ -573,7 +633,7 @@
} }
if (command_options.args.page === undefined) { if (command_options.args.page === undefined) {
return routeMethodLess(gadget); return routeMethodLess(gadget, command_options.args);
} }
command_options.args.jio_key = command_options.path || undefined; command_options.args.jio_key = command_options.path || undefined;
...@@ -652,6 +712,9 @@ ...@@ -652,6 +712,9 @@
throw new Error('Unsupported parameters: ' + key); throw new Error('Unsupported parameters: ' + key);
} }
// Do not calculate this while generating the URL string to not do this too much time
copyStickyParameterDict(previous_options, next_options, drop_options);
if (command_options.path === COMMAND_DISPLAY_STATE) { if (command_options.path === COMMAND_DISPLAY_STATE) {
return execDisplayCommand(gadget, next_options); return execDisplayCommand(gadget, next_options);
} }
...@@ -864,7 +927,7 @@ ...@@ -864,7 +927,7 @@
if (command_options.method) { if (command_options.method) {
throw new Error('Unsupported hash method: ' + command_options.method); throw new Error('Unsupported hash method: ' + command_options.method);
} }
result = routeMethodLess(gadget); result = routeMethodLess(gadget, command_options.args);
} }
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
......
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>958.21187.63463.29218</string> </value> <value> <string>958.31324.24990.32187</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1490952254.49</float> <float>1491384797.89</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -591,6 +591,19 @@ div[data-gadget-scope='panel'] { ...@@ -591,6 +591,19 @@ div[data-gadget-scope='panel'] {
height: 100%; height: 100%;
} }
div[data-gadget-scope="erp5_checkbox"] {
padding: @half-margin-size;
padding-left: @double-margin-size;
label, span, input {
cursor: pointer;
}
span {
width: @quadruple-margin-size;
display: inline-block;
}
}
.alignwithicon() { .alignwithicon() {
padding: @half-margin-size; padding: @half-margin-size;
......
<?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>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>testListboxInNoEditableMode</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>
...@@ -64,12 +64,12 @@ ...@@ -64,12 +64,12 @@
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//div[@data-gadget-scope='m']//a[text()='Relation Fields' and contains(@href, '#!change') and contains(@href, 'u.page=') and contains(@href, 'n.editable=true')]</td> <td>//div[@data-gadget-scope='m']//a[text()='Relation Fields' and contains(@href, '#!change') and contains(@href, 'u.page=')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//div[@data-gadget-scope='m']//a[text()='Relation Fields' and contains(@href, '#!change') and contains(@href, 'u.page=') and contains(@href, 'n.editable=true')]</td> <td>//div[@data-gadget-scope='m']//a[text()='Relation Fields' and contains(@href, '#!change') and contains(@href, 'u.page=')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
......
...@@ -29,11 +29,7 @@ ...@@ -29,11 +29,7 @@
<td></td> <td></td>
</tr> </tr>
<tr> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/verify_is_non_editable_mode" />
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="header"]//a[@data-i18n="Editable"]</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
...@@ -54,14 +50,7 @@ ...@@ -54,14 +50,7 @@
<td></td> <td></td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/verify_is_non_editable_mode" />
<tr>
<td>verifyElementPresent</td>
<td>//a[@data-i18n="Editable"]</td>
<td></td>
</tr>
<tr> <tr>
......
...@@ -38,14 +38,14 @@ ...@@ -38,14 +38,14 @@
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//div[@data-gadget-scope='m']//a[text()='Validate Action' and contains(@href, '#!change') and contains(@href, 'validate_action') and contains(@href, 'u.page=') and contains(@href, 'u.editable=')]</td> <td>//div[@data-gadget-scope='m']//a[text()='Validate Action' and contains(@href, '#!change') and contains(@href, 'validate_action') and contains(@href, 'u.page=')]</td>
<td></td> <td></td>
</tr> </tr>
<!-- Follow one link --> <!-- Follow one link -->
<tr> <tr>
<td>click</td> <td>click</td>
<td>//div[@data-gadget-scope='m']//a[text()='Validate Action' and contains(@href, '#!change') and contains(@href, 'validate_action') and contains(@href, 'u.page=') and contains(@href, 'u.editable=')]</td> <td>//div[@data-gadget-scope='m']//a[text()='Validate Action' and contains(@href, '#!change') and contains(@href, 'validate_action') and contains(@href, 'u.page=')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
......
<?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>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>testPageTabEditablesLinkList</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>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test Page Front</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test Page Tab Link List</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/foo_module/1?page=tab</td>
<td></td>
</tr>
<!-- Wait for gadget to be loaded -->
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_page_tab.html']</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Title 1</td>
<td></td>
</tr>
<!-- Generate links to parents -->
<tr>
<td>click</td>
<td>//div[@data-gadget-scope="header"]//a[@data-i18n="Editable"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope='m']//a[text()='View' and contains(@href, '#!change') and contains(@href, 'n.view=') and contains(@href, 'u.page=') and contains(@href, 'n.editable=true')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-scope='m']//a[text()='View' and contains(@href, '#!change') and contains(@href, 'n.view=') and contains(@href, 'u.page=') and contains(@href, 'n.editable=true')]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-scope='m']//a[text()='Duration Field' and contains(@href, '#!change') and contains(@href, 'view_duration_field') and contains(@href, 'u.page=') and contains(@href, 'n.editable=true')]</td>
<td></td>
</tr>
<!-- Follow one link -->
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='m']//a[text()='Duration Field' and contains(@href, '#!change') and contains(@href, 'view_duration_field') and contains(@href, 'u.page=') and contains(@href, 'n.editable=true')]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_view_editable.html']</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Title 1</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Duration Quantity</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test Page Front</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test Page Tab Breadcrumb List</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/foo_module/1?page=tab</td>
<td></td>
</tr>
<!-- Wait for gadget to be loaded -->
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_page_tab.html']</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Title 1</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="header"]//a[@data-i18n="Editable"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[@data-i18n="Relation Fields"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[@data-i18n="Relation Fields"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[@data-i18n="Views"]</td>
<td></td>
</tr>
<tr>
<td>verifyElementPresent</td>
<td>//a[@data-i18n="Editable"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[@data-i18n="Views"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[@data-i18n="Relation Fields"]</td>
<td></td>
</tr>
<tr>
<td>verifyElementPresent</td>
<td>//div[@data-gadget-scope="header"]//a[@data-i18n="Editable"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[@data-gadget-scope="header"]//a[@data-i18n="Editable"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="header"]//a[@data-i18n="Viewable"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[@data-i18n="Relation Fields"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[@data-i18n="Relation Fields"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//button[@data-i18n="Save"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[@data-i18n="Views"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="header"]//a[@data-i18n="Viewable"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[@data-gadget-scope="header"]//a[@data-i18n="Viewable"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="header"]//a[@data-i18n="Editable"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[@data-i18n="Relation Fields"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[@data-i18n="Relation Fields"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[@data-i18n="Views"]</td>
<td></td>
</tr>
<tr>
<td>verifyElementPresent</td>
<td>//a[@data-i18n="Editable"]</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
...@@ -34,14 +34,14 @@ ...@@ -34,14 +34,14 @@
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//div[@data-gadget-scope='m']//a[text()='View' and contains(@href, '#!change') and contains(@href, 'u.page=') and contains(@href, 'u.editable=')]</td> <td>//div[@data-gadget-scope='m']//a[text()='View' and contains(@href, '#!change') and contains(@href, 'u.page=')]</td>
<td></td> <td></td>
</tr> </tr>
<!-- Follow one link --> <!-- Follow one link -->
<tr> <tr>
<td>click</td> <td>click</td>
<td>//div[@data-gadget-scope='m']//a[text()='View' and contains(@href, '#!change') and contains(@href, 'u.page=') and contains(@href, 'u.editable=')]</td> <td>//div[@data-gadget-scope='m']//a[text()='View' and contains(@href, '#!change') and contains(@href, 'u.page=')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
......
...@@ -55,24 +55,24 @@ ...@@ -55,24 +55,24 @@
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//a[@data-i18n='Views']</td> <td>//div[@data-gadget-scope='header']//a[text()='Views' and contains(@href, '#!change') and contains(@href, 'n.page=tab')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//a[@data-i18n='Views']</td> <td>//div[@data-gadget-scope='header']//a[text()='Views' and contains(@href, '#!change') and contains(@href, 'n.page=tab')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//a[@data-i18n='Relation Fields']</td> <td>//div[@data-gadget-scope='m']//a[text()='Relation Fields' and contains(@href, '#!change')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//a[@data-i18n='Relation Fields']</td> <td>//div[@data-gadget-scope='m']//a[text()='Relation Fields' and contains(@href, '#!change')]</td>
<td></td> <td></td>
</tr> </tr>
...@@ -108,6 +108,11 @@ ...@@ -108,6 +108,11 @@
<td>blur</td> <td>blur</td>
</tr> </tr>
<tr>
<td>waitForElementPresent</td>
<td>//li[@data-relative-url='portal_categories/foo_category/a/a1']</td>
<td></td>
</tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//li[@data-relative-url='portal_categories/foo_category/a/a1']</td> <td>//li[@data-relative-url='portal_categories/foo_category/a/a1']</td>
...@@ -237,16 +242,12 @@ ...@@ -237,16 +242,12 @@
<td></td> <td></td>
</tr> </tr>
<tr> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<td>waitForElementPresent</td> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/verify_is_editable_mode" />
<td>//a[@data-i18n="Editable"]</td>
<td></td>
</tr>
<tr> <tr>
<td>verifyText</td> <td>verifyValue</td>
<td>//div[@data-gadget-scope="field_my_title"]//p</td> <td>//div[@data-gadget-scope="field_my_title"]//input</td>
<td>A New Foo</td> <td>A New Foo</td>
</tr> </tr>
...@@ -256,6 +257,7 @@ ...@@ -256,6 +257,7 @@
<td></td> <td></td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
...@@ -263,24 +265,18 @@ ...@@ -263,24 +265,18 @@
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//div[@data-gadget-scope='field_my_bar_category_title_list']//fieldset[2]//a[contains(@class, "ui-icon-plane")]</td> <td>//div[@data-gadget-scope='field_my_bar_category_title_list']//fieldset[2]//a[contains(@class, "ui-icon-plane")]</td>
<td></td> <td></td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/verify_is_editable_mode" />
<tr> <tr>
<td>waitForElementPresent</td> <td>verifyValue</td>
<td>//a[@data-i18n="Editable"]</td> <td>//div[@data-gadget-scope="field_my_title"]//input</td>
<td></td>
</tr>
<tr>
<td>verifyText</td>
<td>//div[@data-gadget-scope="field_my_title"]//p</td>
<td>Another Foo</td> <td>Another Foo</td>
</tr> </tr>
......
...@@ -227,31 +227,7 @@ ...@@ -227,31 +227,7 @@
</tr> </tr>
<!-- Switch back to readonly mode --> <!-- Switch back to readonly mode -->
<tr> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/toggle_editable_mode" />
<td>click</td>
<td>//div[@data-gadget-scope='header']//a[text()='Views' and contains(@href, '#!change') and contains(@href, 'n.page=tab')]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope='header']//a[text()='Viewable' and contains(@href, '#!change')]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='header']//a[text()='Viewable' and contains(@href, '#!change')]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[text()='Relation Fields' and contains(@href, '#!change') and contains(@href, 'u.editable=')]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[text()='Relation Fields' and contains(@href, '#!change') and contains(@href, 'u.editable=')]</td>
<td></td>
</tr>
<!-- Check airplane link --> <!-- Check airplane link -->
<tr> <tr>
......
...@@ -44,12 +44,12 @@ ...@@ -44,12 +44,12 @@
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//a[@data-i18n='Views']</td> <td>//div[@data-gadget-scope='header']//a[text()='Views' and contains(@href, '#!change') and contains(@href, 'n.page=tab')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//a[@data-i18n='Views']</td> <td>//div[@data-gadget-scope='header']//a[text()='Views' and contains(@href, '#!change') and contains(@href, 'n.page=tab')]</td>
<td></td> <td></td>
</tr> </tr>
...@@ -72,13 +72,13 @@ ...@@ -72,13 +72,13 @@
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//a[@data-i18n='Relation Fields']</td> <td>//div[@data-gadget-scope='m']//a[text()='Relation Fields' and contains(@href, '#!change')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//a[@data-i18n='Relation Fields']</td> <td>//div[@data-gadget-scope='m']//a[text()='Relation Fields' and contains(@href, '#!change')]</td>
<td></td> <td></td>
</tr> </tr>
...@@ -355,62 +355,45 @@ ...@@ -355,62 +355,45 @@
<td>Foo Module</td> <td>Foo Module</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>waitForElementPresent</td>
<td>//tbody/tr[1]/th/a</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/clear_query" />
<tr> <tr>
<td>click</td> <td>waitForElementPresent</td>
<td>//tbody/tr[1]/th/a</td> <td>//tbody/tr[1]/th/a</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[@data-i18n="Views"]</td>
<td></td>
</tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//a[@data-i18n="Views"]</td> <td>//tbody/tr[1]/th/a</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//a[@data-i18n='Relation Fields']</td> <td>//div[@data-gadget-scope='header']//a[text()='Views' and contains(@href, '#!change') and contains(@href, 'n.page=tab')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//a[@data-i18n='Relation Fields']</td> <td>//div[@data-gadget-scope='header']//a[text()='Views' and contains(@href, '#!change') and contains(@href, 'n.page=tab')]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//a[@data-i18n='Actions']</td> <td>//div[@data-gadget-scope='m']//a[text()='Relation Fields' and contains(@href, '#!change')]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[@data-i18n='Editable']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//a[@data-i18n='Editable']</td> <td>//div[@data-gadget-scope='m']//a[text()='Relation Fields' and contains(@href, '#!change')]</td>
<td></td> <td></td>
</tr> </tr>
......
...@@ -168,6 +168,8 @@ ...@@ -168,6 +168,8 @@
<td></td> <td></td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//input[@name='field_my_successor_title']</td> <td>//input[@name='field_my_successor_title']</td>
...@@ -194,16 +196,12 @@ ...@@ -194,16 +196,12 @@
<td></td> <td></td>
</tr> </tr>
<tr> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<td>waitForElementPresent</td> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/verify_is_editable_mode" />
<td>//a[@data-i18n="Editable"]</td>
<td></td>
</tr>
<tr> <tr>
<td>verifyText</td> <td>verifyValue</td>
<td>//div[@data-gadget-scope="field_my_title"]//p</td> <td>//div[@data-gadget-scope="field_my_title"]//input</td>
<td>A new foo</td> <td>A new foo</td>
</tr> </tr>
......
...@@ -188,31 +188,7 @@ ...@@ -188,31 +188,7 @@
</tr> </tr>
<!-- Switch back to readonly mode --> <!-- Switch back to readonly mode -->
<tr> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/toggle_editable_mode" />
<td>click</td>
<td>//div[@data-gadget-scope='header']//a[text()='Views' and contains(@href, '#!change') and contains(@href, 'n.page=tab')]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope='header']//a[text()='Viewable' and contains(@href, '#!change')]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='header']//a[text()='Viewable' and contains(@href, '#!change')]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[text()='Relation Fields' and contains(@href, '#!change') and contains(@href, 'u.editable=')]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[text()='Relation Fields' and contains(@href, '#!change') and contains(@href, 'u.editable=')]</td>
<td></td>
</tr>
<!-- Check airplane link --> <!-- Check airplane link -->
<tr> <tr>
......
...@@ -415,17 +415,8 @@ ...@@ -415,17 +415,8 @@
<td></td> <td></td>
</tr> </tr>
<tr> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<td>waitForElementPresent</td> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/verify_is_editable_mode" />
<td>//a[@data-i18n="Editable"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[@data-i18n="Editable"]</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
......
...@@ -68,41 +68,13 @@ ...@@ -68,41 +68,13 @@
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" /> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" />
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope='header']//a[text()='Views' and contains(@href, '#!change') and contains(@href, 'n.page=tab')]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='header']//a[text()='Views' and contains(@href, '#!change') and contains(@href, 'n.page=tab')]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_page_tab.html']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[@data-i18n="Viewable"]</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//a[@data-i18n="Editable"]</td> <td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_view_editable.html']</td>
<td></td> <td></td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/toggle_editable_mode" />
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='m']//a[text()='View' and contains(@href, '#!change') and contains(@href, 'u.page=') and contains(@href, 'u.editable=')]</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_view.html']</td> <td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_view.html']</td>
...@@ -132,16 +104,19 @@ ...@@ -132,16 +104,19 @@
<td>Title 1</td> <td>Title 1</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_view_editable.html']</td> <td>//div[@data-gadget-scope='header']//a[text()='Foo: Title 1' and contains(@href, '#!history_previous')]</td>
<td></td> <td></td>
</tr> </tr>
<!-- Editable is sticky, and the view should stay non editble in this case -->
<tr> <tr>
<td>waitForElementPresent</td> <td>assertElementNotPresent</td>
<td>//div[@data-gadget-scope='header']//a[text()='Foo: Title 1' and contains(@href, '#!history_previous')]</td> <td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_view_editable.html']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//div[@data-gadget-scope='header']//a[text()='Foo: Title 1' and contains(@href, '#!history_previous')]</td> <td>//div[@data-gadget-scope='header']//a[text()='Foo: Title 1' and contains(@href, '#!history_previous')]</td>
......
...@@ -64,41 +64,13 @@ ...@@ -64,41 +64,13 @@
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//a[@data-i18n = 'Editable' and text() = 'bianxue']</td> <td>//h3[text() = 'shitu']</td>
<td></td>
</tr>
<tr>
<td>verifyElementPresent</td>
<td>//a[@data-i18n = 'Editable' and text() = 'bianxue']</td>
<td></td>
</tr>
<tr>
<td>verifyElementPresent</td>
<td>//a[text() = 'lishi']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[@data-i18n = 'Editable' and text() = 'bianxue']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[@data-i18n = 'Viewable' and text() = 'shitujiemian']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>verifyElementPresent</td> <td>verifyElementPresent</td>
<td>//a[@data-i18n = 'Viewable' and text() = 'shitujiemian']</td> <td>//h3[text() = 'shitu']</td>
<td></td> <td></td>
</tr> </tr>
......
...@@ -74,6 +74,12 @@ ...@@ -74,6 +74,12 @@
</tr> </tr>
<tr>
<td>verifyText</td>
<td>//div[@data-gadget-scope="erp5_checkbox"]//label</td>
<td>bianxue</td>
</tr>
</tbody></table> </tbody></table>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -157,8 +157,8 @@ ...@@ -157,8 +157,8 @@
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForTextPresent</td>
<td>//div[@data-gadget-scope="field_listbox"]</td> <td>2 Records</td>
<td></td> <td></td>
</tr> </tr>
...@@ -188,27 +188,24 @@ ...@@ -188,27 +188,24 @@
<td></td> <td></td>
</tr> </tr>
<tr> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/toggle_editable_mode" />
<td>click</td> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<td>//a[@class="ui-link"]</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>click</td>
<td>//a[@data-i18n="Editable"]</td> <td>//div[contains(@data-gadget-url, 'gadget_erp5_pt_form_list.html')]//div[@data-gadget-scope="field_listbox"]//a[@class="ui-link"]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="field_listbox"]//a[@class="ui-link"]</td> <td>//div[contains(@data-gadget-url, 'gadget_erp5_pt_form_view.html')]//div[@data-gadget-scope="field_listbox"]//a[@class="ui-link"]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//div[@data-gadget-scope="field_listbox"]//a[@class="ui-link"]</td> <td>//div[contains(@data-gadget-url, 'gadget_erp5_pt_form_view.html')]//div[@data-gadget-scope="field_listbox"]//a[@class="ui-link"]</td>
<td></td> <td></td>
</tr> </tr>
...@@ -218,17 +215,7 @@ ...@@ -218,17 +215,7 @@
<td></td> <td></td>
</tr> </tr>
<tr> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/toggle_editable_mode" />
<td>waitForElementPresent</td>
<td>//a[@data-i18n="Editable"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[@data-i18n="Editable"]</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
...@@ -244,28 +231,24 @@ ...@@ -244,28 +231,24 @@
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" /> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" />
<tr>
<td>waitForElementPresent</td>
<td>//a[@data-i18n="Editable"]</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//a[@data-i18n="Previous"]</td> <td>//a[@data-i18n="Previous"]</td>
<td></td> <td></td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/toggle_editable_mode" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="field_listbox"]//a[@class="ui-link"]</td> <td>//div[contains(@data-gadget-url, 'gadget_erp5_pt_form_view.html')]//div[@data-gadget-scope="field_listbox"]//a[@class="ui-link"]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//div[@data-gadget-scope="field_listbox"]//a[@class="ui-link"]</td> <td>//div[contains(@data-gadget-url, 'gadget_erp5_pt_form_view.html')]//div[@data-gadget-scope="field_listbox"]//a[@class="ui-link"]</td>
<td></td> <td></td>
</tr> </tr>
...@@ -275,17 +258,7 @@ ...@@ -275,17 +258,7 @@
<td></td> <td></td>
</tr> </tr>
<tr> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/toggle_editable_mode" />
<td>waitForElementPresent</td>
<td>//a[@data-i18n="Editable"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[@data-i18n="Editable"]</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
...@@ -301,19 +274,12 @@ ...@@ -301,19 +274,12 @@
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" /> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" />
<tr>
<td>waitForElementPresent</td>
<td>//a[@data-i18n="Editable"]</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//a[@data-i18n="Previous"]</td> <td>//a[@data-i18n="Previous"]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>waitForTextPresent</td> <td>waitForTextPresent</td>
<td>No records</td> <td>No records</td>
...@@ -326,13 +292,6 @@ ...@@ -326,13 +292,6 @@
<td></td> <td></td>
</tr> </tr>
<tr>
<td>click</td>
<td>//a[@data-i18n="Editable"]</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//a[@data-i18n='Delete' and contains(@class, 'ui-disabled')]</td> <td>//a[@data-i18n='Delete' and contains(@class, 'ui-disabled')]</td>
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>testPageTabSwitchMode</string> </value> <value> <string>testPanelEditableButton</string> </value>
</item> </item>
<item> <item>
<key> <string>output_encoding</string> </key> <key> <string>output_encoding</string> </key>
......
...@@ -11,19 +11,6 @@ ...@@ -11,19 +11,6 @@
</thead><tbody> </thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" /> <tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<!-- Clean Up -->
<tr>
<td>open</td>
<td>${base_url}/bar_module/ListBoxZuite_reset</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Reset Successfully.</td>
<td></td>
</tr>
<!-- Initialize --> <!-- Initialize -->
<tr> <tr>
<td>open</td> <td>open</td>
...@@ -45,96 +32,50 @@ ...@@ -45,96 +32,50 @@
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" /> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" />
<tr> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<td>waitForElementPresent</td>
<td>//a[@data-i18n="Add"]</td>
<td></td>
</tr>
<tr> <tr>
<td>click</td> <td>verifyElementPresent</td>
<td>link=Add</td> <td>//div[@data-gadget-scope='field_my_title']//input</td>
<td></td> <td></td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" />
<tr>
<td>waitForElementPresent</td>
<td>//button[@data-i18n='Save']</td>
<td></td>
</tr>
<tr> <tr>
<td>click</td> <td>verifyElementNotPresent</td>
<td>//a[text()='Foo Line: 1']</td> <td>//div[@data-gadget-scope='field_my_title']//p</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="INPUT"]</td>
<td></td> <td></td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/verify_is_editable_mode" />
<tr> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/toggle_editable_mode" />
<td>click</td>
<td>//a[@data-i18n="Views"]</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementNotPresent</td>
<td>//div[@data-gadget-scope="header"]//a[@data-i18n="Viewable"]</td> <td>//div[@data-gadget-scope='field_my_title']//input</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>verifyElementPresent</td>
<td>//div[@data-gadget-scope="header"]//a[@data-i18n="Viewable"]</td> <td>//div[@data-gadget-scope='field_my_title']//p</td>
<td></td> <td></td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/verify_is_non_editable_mode" />
<tr> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/toggle_editable_mode" />
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="header"]//a[@data-i18n="Editable"]</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//div[@role="main"]//a[@data-i18n="View"]</td> <td>//div[@data-gadget-scope='field_my_title']//input</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>click</td>
<td>//div[@role="main"]//a[@data-i18n="View"]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>1</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>1</td>
<td></td>
</tr>
<tr> <tr>
<td>verifyElementNotPresent</td> <td>verifyElementNotPresent</td>
<td>//div[@data-gadget-scope="INPUT"]</td> <td>//div[@data-gadget-scope='field_my_title']//p</td>
<td></td> <td></td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/verify_is_editable_mode" />
</tbody></table> </tbody></table>
......
...@@ -219,4 +219,33 @@ ...@@ -219,4 +219,33 @@
</tr> </tr>
</tal:block> </tal:block>
<tal:block metal:define-macro="toggle_editable_mode">
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_panel.html')]//div[contains(@data-gadget-url, 'gadget_erp5_field_multicheckbox.html')]//label</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_panel.html')]//div[contains(@data-gadget-url, 'gadget_erp5_field_multicheckbox.html')]//label</td>
<td></td>
</tr>
</tal:block>
<tal:block metal:define-macro="verify_is_non_editable_mode">
<tr>
<td>assertNotChecked</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_panel.html')]//div[contains(@data-gadget-url, 'gadget_erp5_field_multicheckbox.html')]//input</td>
<td></td>
</tr>
</tal:block>
<tal:block metal:define-macro="verify_is_editable_mode">
<tr>
<td>assertChecked</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_panel.html')]//div[contains(@data-gadget-url, 'gadget_erp5_field_multicheckbox.html')]//input</td>
<td></td>
</tr>
</tal:block>
</tal:block> </tal:block>
\ No newline at end of file
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