Commit ce4e546b authored by Jérome Perrin's avatar Jérome Perrin

Updates for xhtml style and gadgets

Gadgets:

* Support `changed` flag from `erp5.js`: 

![unsaved changes sreenshot](/uploads/cff30eae0a5d87df26bac13d43e1da3f/image.png)

* Comply with translation protocol used in ERP5JS. This does not translate, because it would not be easy ( ERP5JS translate client side with a json database of message, but in xhtml style the translation is performed server side with localizer) and not so important now. What matters is just that we can somehow reuse gadgets.

Style:

* While we are at it, fix a minor annoyance that the button in "long" dialogs where not easy to reach, at least on chrome

![before](/uploads/e03a8311571806a55fd72f6923cf855a/Screenshot_2019-05-31_at_10.38.05.png)

![after](/uploads/5753bc44fbc0f69b6adfeb14b3367236/Screenshot_2019-05-31_at_10.38.37.png)

/reviewed-on !880
parents 2fa162d7 56297366
......@@ -61,6 +61,12 @@
</tr>
<!-- the flag used in erp5.js to warn unsaved changes is initially not set -->
<tr>
<td>assertEval</td>
<td>selenium.browserbot.currentWindow.changed</td>
<td>false</td>
</tr>
<tr>
<td>type</td>
......@@ -68,6 +74,12 @@
<td>123</td>
</tr>
<!-- the flag used in erp5.js to warn unsaved changes is set after gadget is changed -->
<tr>
<td>waitForEval</td>
<td>selenium.browserbot.currentWindow.changed</td>
<td>true</td>
</tr>
<tr>
......
......@@ -4,13 +4,27 @@
"use strict";
rJS(window)
.declareAcquiredMethod('notifyChange', 'notifyChange')
.declareAcquiredMethod('translateHtml', 'translateHtml')
.declareMethod('render', function (options) {
this.element.firstChild.value = options.value || "";
this.element.firstChild.title = options.key;
this.element.firstChild.setAttribute('data-name',
options.key || "");
var form_gadget = this;
// gadgets can use translation methods also in xhtml style,
// this test gadget also exercise this.
return form_gadget
.translateHtml(form_gadget.element.innerHtml)
.push(function (html) {
form_gadget.element.innerHtml = html;
form_gadget.element.firstChild.value = options.value || "";
form_gadget.element.firstChild.title = options.key;
form_gadget.element.firstChild.setAttribute(
"data-name",
options.key || ""
);
});
})
.onEvent('change', function () {
return this.notifyChange();
})
.declareMethod('getContent', function () {
var input = this.element.firstChild,
form_gadget = this,
......
......@@ -838,6 +838,10 @@ body[dir="rtl"] .logged_in_as {
background-image: url('images/exec16.png');
}
.bottom_actions {
margin-bottom: 1em;
}
.document .actions {
position: relative;
float: left;
......
......@@ -74,6 +74,8 @@
/////////////////////////////////////////////////////////////////
.allowPublicAcquisition('notifyChange',
function () {
// This flag is used for erp5.js's onBeforeUnload warning for unsaved changes.
window.changed = true;
return;
})
......@@ -86,6 +88,17 @@
return this.element.querySelector('form').querySelector('[type="submit"]').click();
})
// Comply to interface_translation.html, but without actually translating.
.allowPublicAcquisition('translate', function (argument_list) {
return argument_list[0];
})
.allowPublicAcquisition('getTranslationList', function (argument_list) {
return argument_list[0];
})
.allowPublicAcquisition('translateHtml', function (argument_list) {
return argument_list[0];
})
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
......
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