Commit 54e6e71c authored by Sven Franck's avatar Sven Franck Committed by Xiaowu Zhang

erp5_web_renderjs_ui: add translations and menu to panel gadget

- update handlebars template, web sites with translations will have a collapsible language menu.
- add collapsible menu inside listview
- fix missing form element on panel searchfield
- add handler to retrieve available languages when creating template
- add translations for all text elements used
- update declareService to handle multiple forms (close panel, searchfield, languages)
parent ac93b0ce
...@@ -118,31 +118,67 @@ ...@@ -118,31 +118,67 @@
<script src="handlebars.js" type="text/javascript"></script>\n <script src="handlebars.js" type="text/javascript"></script>\n
<script src="gadget_global.js" type="text/javascript"></script>\n <script src="gadget_global.js" type="text/javascript"></script>\n
<script src="jquery.js" type="text/javascript"></script>\n <script src="jquery.js" type="text/javascript"></script>\n
<script src="jquerymobile.js"> type="text/javascript"></script>\n <script src="jquerymobile.js" type="text/javascript"></script>\n
\n \n
<script id="panel-template" type="text/x-handlebars-template">\n <script id="panel-template" type="text/x-handlebars-template">\n
\n
<div data-role="header" class="ui-bar-inherit">\n <div data-role="header" class="ui-bar-inherit">\n
<div class="ui-controlgroup ui-controlgroup-horizontal ui-btn-left">\n <div class="ui-controlgroup ui-controlgroup-horizontal ui-btn-left">\n
<div class="ui-controlgroup-controls">\n <div class="ui-controlgroup-controls">\n
<form action="#" method="post">\n <form action="#" method="post">\n
<input type="submit" data-icon="delete" data-iconpos="notext" value="Close" />\n <input type="submit" data-i18n="[value]Close" data-icon="delete" data-iconpos="notext" value="Close" />\n
</form>\n </form>\n
</div>\n </div>\n
</div>\n </div>\n
<img class="ui-title" alt="ERP5" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJcAAAA/CAMAAADaDqrIAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0i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YA/zP//zPM/zOZ/zNm/zMz/zMA/wD//wDM/wCZ/wBm/wAz/wAAzP//zP/MzP+ZzP9mzP8zzP8AzMz/zMzMzMyZzMxmzMwzzMwAzJn/zJnMzJmZzJlmzJkzzJkAzGb/zGbMzGaZzGZmzGYzzGYAzDP/zDPMzDOZzDNmzDMzzDMAzAD/zADMzACZzABmzAAzzAAAmf//mf/Mmf+Zmf9mmf8zmf8Amcz/mczMmcyZmcxmmcwzmcwAmZn/mZnMmZmZmZlmmZkzmZkAmWb/mWbMmWaZmWZmmWYzmWYAmTP/mTPMmTOZmTNmmTMzmTMAmQD/mQDMmQCZmQBmmQAzmQAAZv//Zv/MZv+ZZv9mZv8zZv8AZsz/ZszMZsyZZsxmZswzZswAZpn/ZpnMZpmZZplmZpkzZpkAZmb/ZmbMZmaZZmZmZmYzZmYAZjP/ZjPMZjOZZjNmZjMzZjMAZgD/ZgDMZgCZZgBmZgAzZgAAM///M//MM/+ZM/9mM/8zM/8AM8z/M8zMM8yZM8xmM8wzM8wAM5n/M5nMM5mZM5lmM5kzM5kAM2b/M2bMM2aZM2ZmM2YzM2YAMzP/MzPMMzOZMzNmMzMzMzMAMwD/MwDMMwCZMwBmMwAzMwAAAP//AP/MAP+ZAP9mAP8zAP8AAMz/AMzMAMyZAMxmAMwzAMwAAJn/AJnMAJmZAJlmAJkzAJkAAGb/AGbMAGaZAGZmAGYzAGYAADP/ADPMADOZADNmADMzADMAAAD/AADMAACZAABmAAAzAAAAHHa7K3/AOojESZHJWZvNaKTSd63Whrbblb/fpMjks9Howtrt4e320uTx8Pb6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAdfKHSQAAAOh0Uk5T////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////ALItoLoAAAJkSURBVHja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/2b//2bM/2aZ/2Zm/2Yz/2YA/zP//zPM/zOZ/zNm/zMz/zMA/wD//wDM/wCZ/wBm/wAz/wAAzP//zP/MzP+ZzP9mzP8zzP8AzMz/zMzMzMyZzMxmzMwzzMwAzJn/zJnMzJmZzJlmzJkzzJkAzGb/zGbMzGaZzGZmzGYzzGYAzDP/zDPMzDOZzDNmzDMzzDMAzAD/zADMzACZzABmzAAzzAAAmf//mf/Mmf+Zmf9mmf8zmf8Amcz/mczMmcyZmcxmmcwzmcwAmZn/mZnMmZmZmZlmmZkzmZkAmWb/mWbMmWaZmWZmmWYzmWYAmTP/mTPMmTOZmTNmmTMzmTMAmQD/mQDMmQCZmQBmmQAzmQAAZv//Zv/MZv+ZZv9mZv8zZv8AZsz/ZszMZsyZZsxmZswzZswAZpn/ZpnMZpmZZplmZpkzZpkAZmb/ZmbMZmaZZmZmZmYzZmYAZjP/ZjPMZjOZZjNmZjMzZjMAZgD/ZgDMZgCZZgBmZgAzZgAAM///M//MM/+ZM/9mM/8zM/8AM8z/M8zMM8yZM8xmM8wzM8wAM5n/M5nMM5mZM5lmM5kzM5kAM2b/M2bMM2aZM2ZmM2YzM2YAMzP/MzPMMzOZMzNmMzMzMzMAMwD/MwDMMwCZMwBmMwAzMwAAAP//AP/MAP+ZAP9mAP8zAP8AAMz/AMzMAMyZAMxmAMwzAMwAAJn/AJnMAJmZAJlmAJkzAJkAAGb/AGbMAGaZAGZmAGYzAGYAADP/ADPMADOZADNmADMzADMAAAD/AADMAACZAABmAAAzAAAAHHa7K3/AOojESZHJWZvNaKTSd63Whrbblb/fpMjks9Howtrt4e320uTx8Pb6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAdfKHSQAAAOh0Uk5T////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////ALItoLoAAAJkSURBVHja7NlZsqsgEABQ979C5kGGddxo4os0Q8BAynoFn0nUU23TNGRB9xzLdE3XdE3XdP2fLnIzF2VSrsYvC72HizAh9eZ5DVuOl15S4/jWwC+kDC8HPzCSJVHcRY8QXV2PwQuujUYTsYrvYlBv1yKLrsXHsPghnvR3Lazoip/JKuwpF8sm6/bY01Ow9CBlTXi53PNoRcUktEZT1NV1PIPnXAjtMJIMlzerFIzU1dVWF7aPj3Tetae4gjdxktG2et/qQjJ4kZFrv6ED4bK4eR1qduHzvEi4+PbGwD0EGu9CQQLFrv1F4jBc6BcuW3YhkPiPX1hOfxQvnHfh0HVMRqc4HuqiQf5k3mO6dq1s8Hx0H/Le5kq9YaNcxAcrZLpOvAv+ClcgNcZFtnrucd5Fwx4mXj0drnbBYXMuJmFDAV3Uhm4qlbHh3ddOrmholHNxFTVC+xTl2mf6pI4uVe4LwSp0DPGOmh/hAnM94bKZjkHlWuiLeV+cTab4luMKk82wy/Px2fLJskvKUk03hRf9RZ0wiYiZ4uVwVwTb9E71y0XboTYXGuTaa33Y47W5zBjXM3P11y7TfR2ycFdxyaW7uwSc5m0un9ix91m3TWJfW+1ijfW+wcVAfjS5dOP62LyvZZdcLHnA1MkFAtbgwq+Vm47po8OA1buwyy/a1ec5urzveAes2sV8kfW963mFaHNhlT0b6+Yi5+StchH1CtaK0ThXELDPLiyOPZHldzm/J1z9O/B14g7/K+DtkP7U8ivSeD4xaPCTSQvy+YIfubZWzRgtRe1iMP+3mq7pmq7p6jv+BBgAPrgi/TzwWzkAAAAASUVORK5CYII="/>\n
<div class="ui-controlgroup ui-controlgroup-horizontal ui-btn-right">\n <div class="ui-controlgroup ui-controlgroup-horizontal ui-btn-right">\n
<div class="ui-controlgroup-controls"></div>\n <div class="ui-controlgroup-controls">\n
<a href="#" class="ui-btn ui-btn-icon-notext ui-icon-home" data-i18n="Home">Home</a>\n
</div>\n
</div>\n </div>\n
</div>\n </div>\n
</script>\n
<script id="panel-template-nolang" type="text/x-handlebars-template">\n
<div class="ui-content">\n <div class="ui-content">\n
<ul data-role="listview">\n <ul data-role="listview">\n
<li><a href="{{module_href}}" class="ui-btn ui-btn-icon-left ui-icon-puzzle-piece">Modules</a></li>\n <li><a href="{{module_href}}" class="ui-btn ui-btn-icon-left ui-icon-puzzle-piece" data-i18n="Modules">Modules</a></li>\n
<li><a class="ui-btn ui-btn-icon-left ui-icon-clipboard">Worklists</a></li>\n <li><a class="ui-btn ui-btn-icon-left ui-icon-clipboard" data-i18n="Worklists">Worklists</a></li>\n
<li><a href="{{history_href}}" class="ui-btn ui-btn-icon-left ui-icon-history">History</a></li>\n <li><a href="{{history_href}}" class="ui-btn ui-btn-icon-left ui-icon-history" data-i18n="History">History</a></li>\n
<li><a class="ui-btn ui-btn-icon-left ui-icon-gear">Preferences</a></li>\n <li><a class="ui-btn ui-btn-icon-left ui-icon-gear" data-i18n="Preference">Preferences</a></li>\n
<li><a class="ui-btn ui-btn-icon-left ui-icon-comment-o">Language</a></li>\n <li><a class="ui-btn ui-btn-icon-left ui-icon-comment-o" data-i18n="Language">Language</a></li>\n
<li><a class="ui-btn ui-btn-icon-left ui-icon-power-off">Logout</a></li>\n <li><a class="ui-btn ui-btn-icon-left ui-icon-power-off" data-i18n="Logout">Logout</a></li>\n
</ul>\n
</div>\n
</script>\n
\n
<!-- listview needs to be pre-enhanced for language collapsibe to work -->\n
<script id="panel-template-lang" type="text/x-handlebars-template">\n
<div class="ui-content">\n
<ul data-role="listview" class="ui-listview" data-enhanced="true">\n
<li class="ui-first-child"><a href="{{module_href}}" class="ui-btn ui-btn-icon-left ui-icon-puzzle-piece" data-i18n="Modules">Modules</a></li>\n
<li><a class="ui-btn ui-btn-icon-left ui-icon-clipboard" data-i18n="Worklists">Worklists</a></li>\n
<li><a href="{{history_href}}" class="ui-btn ui-btn-icon-left ui-icon-history" data-i18n="History">History</a></li>\n
<li><a class="ui-btn ui-btn-icon-left ui-icon-gear" data-i18n="Preference">Preferences</a></li>\n
<li data-role="collapsible" data-enhanced="true" data-collapsed="true" data-collapsed-icon="comment-o" class="ui-collapsible ui-collapsible-collapsed">\n
<h4 class="ui-collapsible-heading ui-collapsible-heading-collapsed ui-li-divider ui-li-has-icon">\n
<a class="ui-collapsible-heading-toggle ui-icon-comment-o ui-btn-icon-left ui-btn-inherit" href="#" data-i18n="[last]Languages">\n
<span data-i18n="Click to expand content" class="ui-collapsible-heading-status"></span>Languages\n
</a>\n
</h4>\n
<div class="ui-collapsible-content ui-collapsible-content-collapsed" aria-hidden="true">\n
<fieldset data-role="controlgroup">\n
{{#each document_list}}\n
<form method="POST" action="">\n
<div class="ui-btn ui-input-btn ui-corner-all ui-shadow ui-btn-icon-right ui-icon-carat-r" data-i18n="[node]{{lang}}">\n
&nbsp;\n
<input type="submit" data-enhanced="true" name="lang" id="lang-{{count}}" value="{{lang}}" />\n
</div>\n
<label class="ui-hidden-accessible" for="lang-{{count}}" data-i18n="{{lang}}"></label>\n
</form>\n
{{/each}}\n
</fieldset>\n
</div>\n
</li>\n
<li class="ui-last-child"><a class="ui-btn ui-btn-icon-left ui-icon-power-off" data-i18n="Logout">Logout</a></li>\n
</ul>\n </ul>\n
</div>\n </div>\n
</script>\n </script>\n
...@@ -279,7 +315,7 @@ ...@@ -279,7 +315,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>sven</string> </value> <value> <string>super_sven</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -293,7 +329,7 @@ ...@@ -293,7 +329,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>938.24764.47660.35054</string> </value> <value> <string>939.64258.51349.15786</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -311,7 +347,7 @@ ...@@ -311,7 +347,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1413816767.6</float> <float>1420197041.32</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
...@@ -99,7 +99,9 @@ ...@@ -99,7 +99,9 @@
</item> </item>
<item> <item>
<key> <string>text_content</string> </key> <key> <string>text_content</string> </key>
<value> <string>/*jslint nomen: true, indent: 2, maxerr: 3 */\n <value> <string encoding="cdata"><![CDATA[
/*jslint nomen: true, indent: 2, maxerr: 3 */\n
/*global window, rJS, Handlebars, jQuery */\n /*global window, rJS, Handlebars, jQuery */\n
(function (window, rJS, Handlebars, $) {\n (function (window, rJS, Handlebars, $) {\n
"use strict";\n "use strict";\n
...@@ -107,12 +109,20 @@ ...@@ -107,12 +109,20 @@
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
// Handlebars\n // Handlebars\n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
// Precompile the templates while loading the first gadget instance\n // Precompile templates while loading the first gadget instance\n
var gadget_klass = rJS(window),\n var gadget_klass = rJS(window),\n
source = gadget_klass.__template_element\n source = gadget_klass.__template_element\n
.getElementById("panel-template")\n .getElementById("panel-template")\n
.innerHTML,\n .innerHTML,\n
panel_template = Handlebars.compile(source);\n panel_template = Handlebars.compile(source),\n
source_content = gadget_klass.__template_element\n
.getElementById("panel-template-lang")\n
.innerHTML,\n
panel_template_lang = Handlebars.compile(source_content),\n
source_content_no_lang = gadget_klass.__template_element\n
.getElementById("panel-template-nolang")\n
.innerHTML,\n
panel_template_nolang = Handlebars.compile(source_content_no_lang);\n
\n \n
gadget_klass\n gadget_klass\n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
...@@ -122,6 +132,14 @@ ...@@ -122,6 +132,14 @@
.ready(function (g) {\n .ready(function (g) {\n
g.props = {};\n g.props = {};\n
})\n })\n
\n
//////////////////////////////////////////////\n
// acquired method\n
//////////////////////////////////////////////\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("changeLanguage", "changeLanguage")\n
.declareAcquiredMethod("getLanguageList", "getLanguageList")\n
.declareAcquiredMethod("whoWantToDisplayThisFrontPage", "whoWantToDisplayThisFrontPage")\n
\n \n
// Assign the element to a variable\n // Assign the element to a variable\n
.ready(function (g) {\n .ready(function (g) {\n
...@@ -147,18 +165,43 @@ ...@@ -147,18 +165,43 @@
return RSVP.all([\n return RSVP.all([\n
g.whoWantToDisplayThisFrontPage("front"),\n g.whoWantToDisplayThisFrontPage("front"),\n
g.whoWantToDisplayThisFrontPage("history"),\n g.whoWantToDisplayThisFrontPage("history"),\n
g.getLanguageList()\n
]);\n ]);\n
})\n })\n
.push(function (all_result) {\n .push(function (all_result) {\n
g.props.jelement.html(panel_template({\n var i,\n
tmp,\n
document_list = [],\n
language_list = JSON.parse(all_result[2]),\n
i_len = language_list.length;\n
\n
// XXX: Customize panel header!\n
tmp = panel_template();\n
\n
// XXX: will there be websites without translations/multiple lang?\n
if (i_len > 1) {\n
for (i = 0; i < i_len; i += 1) {\n
document_list.push({"count": i, "lang": language_list[i]});\n
}\n
tmp += panel_template_lang({\n
module_href: all_result[0],\n
history_href: all_result[1],\n
document_list: document_list\n
});\n
} else {\n
tmp += panel_template_nolang({\n
module_href: all_result[0],\n module_href: all_result[0],\n
history_href: all_result[1]\n history_href: all_result[1]\n
}));\n });\n
}\n
return g.translateHtml(tmp);\n
})\n
.push(function (my_translated_html) {\n
g.props.jelement.html(my_translated_html);\n
g.props.jelement.trigger("create");\n g.props.jelement.trigger("create");\n
});\n });\n
})\n })\n
\n \n
.declareAcquiredMethod("whoWantToDisplayThisFrontPage", "whoWantToDisplayThisFrontPage")\n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
// declared methods\n // declared methods\n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
...@@ -200,22 +243,45 @@ ...@@ -200,22 +243,45 @@
// declared services\n // declared services\n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
.declareService(function () {\n .declareService(function () {\n
var panel_gadget = this;\n var panel_gadget, \n
form_list, \n
event_list, \n
handler,\n
i,\n
len;\n
\n
function translate(my_event) {\n
return panel_gadget.changeLanguage(my_event.target.lang.value);\n
}\n
\n \n
function formSubmit() {\n function formSubmit() {\n
panel_gadget.toggle();\n panel_gadget.toggle();\n
}\n }\n
\n \n
// Listen to form submit\n panel_gadget = this;\n
return loopEventListener(\n form_list = panel_gadget.props.element.querySelectorAll(\'form\');\n
panel_gadget.props.element.querySelector(\'form\'),\n event_list = [];\n
handler = [formSubmit];\n
\n
// XXX: not robust - Will break when search field is active\n
for (i = 0, len = form_list.length; i < len; i += 1) {\n
event_list[i] = loopEventListener(\n
form_list[i],\n
\'submit\',\n \'submit\',\n
false,\n false,\n
formSubmit\n handler[i] || translate\n
);\n );\n
})\n }\n
\n
return new RSVP.Queue()\n
.push(function () {\n
return RSVP.all(event_list);\n
});\n
});\n
\n \n
}(window, rJS, Handlebars, jQuery));</string> </value> }(window, rJS, Handlebars, jQuery));
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
...@@ -336,7 +402,7 @@ ...@@ -336,7 +402,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>sven</string> </value> <value> <string>super_sven</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -350,7 +416,7 @@ ...@@ -350,7 +416,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>938.25789.47838.52889</string> </value> <value> <string>939.64379.20572.33536</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -368,7 +434,7 @@ ...@@ -368,7 +434,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1413879105.71</float> <float>1420039467.89</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
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