Commit f655e886 authored by Ivan Tyagov's avatar Ivan Tyagov

UI changes

See merge request !57
parents 448c9c9d ec9de243
......@@ -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>
......
......@@ -25,6 +25,7 @@
//////////////////////////////////////////////
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("translateHtml", "translateHtml")
.declareAcquiredMethod("getSetting", "getSetting")
/////////////////////////////////////////////////////////////////
// declared methods
......@@ -44,7 +45,6 @@
var g = this;
return new RSVP.Queue()
.push(function () {
//return g.getUrlFor({command: 'display', options: {page: "logout"}});
return RSVP.all([
g.getUrlFor({command: 'display', options: {page: "preference"}}),
g.getUrlFor({command: 'display', options: {page: "download"}}),
......@@ -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.getSetting('hateoas_url')
]);
})
.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] + "connection/login_form"
})
);
})
.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.24907.61542.62720</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1562052098.2</float>
<float>1595267359.56</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