Commit 07eea340 authored by Nicolas Wavrant's avatar Nicolas Wavrant

Renderjs: translation of the "Maximize" button (used in editors)

See merge request nexedi/erp5!1988
parents 27a6dce4 1c364e1c
......@@ -6901,6 +6901,9 @@ msgstr "Délai max. (jours)"
msgid "Max. delay (day)"
msgstr "Délai Max (jours)"
msgid "Maximize"
msgstr "Agrandir"
msgid "Maximum Date"
msgstr "Date maximale"
......
......@@ -335,6 +335,9 @@
scope: 'maximize',
element: div_max,
sandbox: 'public'
})
.push(function (button_maximize_gadget) {
return button_maximize_gadget.render();
});
})
.declareMethod('getContent', function getContent() {
......
......@@ -246,7 +246,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1009.27442.40137.15394</string> </value>
<value> <string>1017.65217.22701.26760</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -266,7 +266,7 @@
</tuple>
<state>
<tuple>
<float>1688063552.11</float>
<float>1726209635.9</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -6,15 +6,19 @@
<title>ERP5 Button Maximize</title>
<link rel="http://www.renderjs.org/rel/interface" href="interface_maximize_button.html">
<!--
data-i18n=Maximize
-->
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="domsugar.js"></script>
<!-- custom script -->
<script src="gadget_button_maximize.js" type="text/javascript"></script>
</head>
<body>
<button class="ui-icon-expand ui-btn-icon-notext" type="button">Maximize</button>
</body>
</html>
......@@ -232,7 +232,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <unicode>zope</unicode> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -246,7 +246,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>968.5552.51560.44322</string> </value>
<value> <string>1019.49777.15867.23517</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -266,7 +266,7 @@
</tuple>
<state>
<tuple>
<float>1536322858.1</float>
<float>1728437604.68</float>
<string>UTC</string>
</tuple>
</state>
......
/*global window, rJS */
/*global window, rJS, domsugar */
/*jslint indent: 2, maxerr: 3 */
(function (window, rJS) {
(function (window, rJS, domsugar) {
"use strict";
rJS(window)
.declareAcquiredMethod('triggerMaximize', 'triggerMaximize')
.declareAcquiredMethod("translate", "translate")
.declareMethod('render', function () {
var gadget = this;
return gadget.changeState({'init': true});
})
.onStateChange(function (modification_dict) {
var gadget = this;
return gadget.translate("Maximize")
.push(function (translation) {
return gadget.element.appendChild(domsugar("button", {
"class": "ui-icon-expand ui-btn-icon-notext",
"type": "button",
"text": translation
}));
});
})
.onEvent('click', function (event) {
if (event.target.tagName === "BUTTON") {
......@@ -15,4 +33,4 @@
return this.triggerMaximize(true);
});
}(window, rJS));
\ No newline at end of file
}(window, rJS, domsugar));
\ No newline at end of file
......@@ -244,7 +244,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1009.17156.6548.44731</string> </value>
<value> <string>1019.59406.56317.53077</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -264,7 +264,7 @@
</tuple>
<state>
<tuple>
<float>1687447620.32</float>
<float>1728611478.5</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="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</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>testEditor</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 RenderJS UI</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test RenderJS UI</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/create_translation_data" />
<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/wo/#/foo_module</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<tal:block tal:define="click_configuration python: {'text': 'Title 1'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_page_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>assertElementPresent</td>
<td>//label[@for="field_my_id"]</td>
<td></td>
</tr>
<tal:block tal:define="click_configuration python: {'text': 'Editor Field'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_panel_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/toggle_editable_mode" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/verify_is_editable_mode" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope='maximize']//button[text()='zuidahua']</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
......@@ -82,7 +82,8 @@ param_dict = [
{ 'message': 'Configure Editor', 'translation': 'peizhibianjiqi', 'language': 'wo'},
{ 'message': 'List', 'translation': 'liebiao', 'language': 'wo'},
{ 'message': 'This page contains unsaved changes, do you really want to leave the page ?', 'translation': 'querenlikai?', 'language': 'wo'},
{ 'message': 'What are you looking for?', 'translation': 'Ni zai zhao shenme?', 'language': 'wo'}
{ 'message': 'What are you looking for?', 'translation': 'Ni zai zhao shenme?', 'language': 'wo'},
{ 'message': 'Maximize', 'translation': 'zuidahua', 'language': 'wo'},
]
for tmp in param_dict:
context.Base_addUITestTranslation(message = tmp['message'], translation = tmp['translation'], language = tmp['language'])
......
......@@ -148,6 +148,8 @@
scope: 'maximize',
element: div_max,
sandbox: 'public'
}).push(function (button_maximize_gadget) {
return button_maximize_gadget.render();
});
}, function (error) {
// Check Acquisition, old erp5 ui don't have triggerMaximize
......
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