Commit 9243a777 authored by Roque's avatar Roque

erp5_wendelin_data_lake_ui: login-logout links in panel

parent 448c9c9d
......@@ -33,7 +33,8 @@
<li><a href="{{download_href}}" class="ui-btn ui-btn-icon-left ui-icon-download" data-i18n="Download Ebulk">Download Ebulk</a></li>
<!--<li><a href="{{documentation_href}}" class="ui-btn ui-btn-icon-left ui-icon-file" data-i18n="Ebulk's Documentation">Ebulk's Documentation</a></li> -->
<li><a href="{{contact_info_href}}" class="ui-btn ui-btn-icon-left ui-icon-user" data-i18n="Contact us">Contact us</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">Logout</a></li>
<li id="logout-li" class="ui-last-child ui-screen-hidden"><a href="{{logout_href}}" class="ui-btn ui-btn-icon-left ui-icon-power-off" data-i18n="Logout">Logout</a></li>
<li id="login-li" class="ui-last-child ui-screen-hidden"><a href="{{login_href}}" class="ui-btn ui-btn-icon-left ui-icon-power-off" data-i18n="Login">Loin</a></li>
</ul>
</div>
</script>
......
......@@ -240,7 +240,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>976.52509.17260.4864</string> </value>
<value> <string>985.24591.15293.42325</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -258,7 +258,7 @@
</tuple>
<state>
<tuple>
<float>1562054802.81</float>
<float>1595254758.81</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -52,7 +52,8 @@
g.getUrlFor({command: 'display', options: {page: "contact"}}),
g.getUrlFor({command: 'display', options: {page: "logout"}}),
g.getUrlFor({command: 'display', options: {page: "fifdata"}}),
g.getUrlFor({command: 'display', options: {page: "register"}})
g.getUrlFor({command: 'display', options: {page: "register"}}),
g.getUrlFor({command: 'display', options: {page: "login"}})
]);
})
.push(function (all_result) {
......@@ -66,12 +67,14 @@
"contact_info_href": all_result[3],
"logout_href": all_result[4],
"data_download_href": all_result[5],
"register_href": all_result[6]
"register_href": all_result[6],
"login_href": all_result[7]
})
);
})
.push(function (my_translated_or_plain_html) {
g.element.querySelector("div").innerHTML = my_translated_or_plain_html;
return g.renderLoginLinks();
});
})
......@@ -86,6 +89,24 @@
}
}
})
.declareJob("renderLoginLinks", function () {
return new RSVP.Queue()
.push(function () {
return jIO.util.ajax({
type: "GET",
url: new URL('./ERP5Site_getUserName', window.location.href)
});
})
.push(function (result) {
var login_link = document.querySelector("#login-li"),
logout_link = document.querySelector("#logout-li");
if (result.target.response) {
logout_link.classList.remove("ui-screen-hidden");
} else {
login_link.classList.remove("ui-screen-hidden");
}
});
})
/////////////////////////////////////////////////////////////////
// declared services
......
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>976.41266.49650.34030</string> </value>
<value> <string>985.24889.24350.2884</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1562052098.2</float>
<float>1595266175.28</float>
<string>UTC</string>
</tuple>
</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