Commit f17e1a44 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Logout: stop using translateHTML

parent d727a4ad
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<!--
data-i18n=Confirm
-->
<head> <head>
<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" /> <meta name="viewport" content="width=device-width" />
...@@ -9,21 +12,24 @@ ...@@ -9,21 +12,24 @@
<script src="rsvp.js" type="text/javascript"></script> <script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script> <script src="renderjs.js" type="text/javascript"></script>
<script src="jiodev.js" type="text/javascript"></script> <script src="jiodev.js" type="text/javascript"></script>
<script src="handlebars.js" type="text/javascript"></script>
<!-- custom script --> <script id="form-template" type="text/x-handlebars-template">
<script src="gadget_erp5_page_logout.js" type="text/javascript"></script>
</head>
<body>
<article class="ui-content ui-body-c"> <article class="ui-content ui-body-c">
<section class="ui-body-c ui-content-section"> <section class="ui-body-c ui-content-section">
<form class="logout"> <form class="logout">
<input data-theme="b" data-inline="true" type="submit" data-i18n="[value]Confirm" value="Confirm" data-icon="check" /> <input data-theme="b" data-inline="true" type="submit" value="{{button_text}}" data-icon="check" />
</form> </form>
</section> </section>
</article> </article>
</script>
<!-- custom script -->
<script src="gadget_erp5_page_logout.js" type="text/javascript"></script>
</head>
<body>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>954.45675.44850.53452</string> </value> <value> <string>968.42589.6882.6638</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>1476953691.35</float> <float>1530607558.33</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*global window, rJS, UriTemplate */ /*global window, rJS, UriTemplate, Handlebars */
/*jslint indent: 2, maxerr: 3, nomen: true */ /*jslint indent: 2, maxerr: 3, nomen: true */
(function (window, rJS, UriTemplate) { (function (window, rJS, UriTemplate, Handlebars) {
"use strict"; "use strict";
rJS(window) var gadget_klass = rJS(window),
form_template = Handlebars.compile(
gadget_klass.__template_element
.getElementById("form-template")
.innerHTML
);
gadget_klass
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// handle acquisition // handle acquisition
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
.declareAcquiredMethod("redirect", "redirect") .declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("getUrlFor", "getUrlFor") .declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment") .declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("translateHtml", "translateHtml") .declareAcquiredMethod("translate", "translate")
.declareAcquiredMethod("updateHeader", "updateHeader") .declareAcquiredMethod("updateHeader", "updateHeader")
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// declared methods // declared methods
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
.declareMethod("render", function () { .declareMethod("render", function () {
var gadget = this, var gadget = this;
header_dict = {
page_title: 'Logout',
page_icon: 'power-off'
};
return gadget.getUrlFor({command: 'display'}) return gadget.getUrlFor({command: 'display'})
.push(function (front_url) { .push(function (front_url) {
header_dict.front_url = front_url; return gadget.updateHeader({
return gadget.updateHeader(header_dict); page_title: 'Logout',
page_icon: 'power-off',
front_url: front_url
});
}) })
.push(function () { .push(function () {
return gadget.translateHtml(gadget.element.innerHTML); return gadget.translate('Confirm');
}) })
.push(function (my_translated_html) { .push(function (translated_text) {
gadget.element.innerHTML = my_translated_html; gadget.element.innerHTML = form_template({
button_text: translated_text
});
}); });
}) })
...@@ -58,4 +66,4 @@ ...@@ -58,4 +66,4 @@
}); });
}); });
}); });
}(window, rJS, UriTemplate)); }(window, rJS, UriTemplate, Handlebars));
\ 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>963.11788.48702.26146</string> </value> <value> <string>968.42610.16476.33962</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>1518598022.73</float> <float>1530607593.22</float>
<string>UTC</string> <string>UTC</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