add logo again, hide logo on iframe, add way to exit back to /sso

This commit is contained in:
Lukas Fülling 2019-02-13 00:25:16 +01:00
parent 12f9cebce7
commit 02b2eb1796
4 changed files with 53 additions and 13 deletions

View file

@ -126,6 +126,39 @@ img {
.ynh-wrapper:after {content: " ";display: table;}
.ynh-wrapper:after {clear: both;}
/* Logo */
body.overlay .logo {
display: none;
}
.logo {
text-align: center;
margin-bottom: 0;
opacity: 0.7;
}
.logo img {
margin-top: 4%;
width: 4em;
}
.logged .logo {
position: fixed;
bottom: 20px;
right: 20px;
z-index: 0;
opacity: 0.7;
}
.logged .logo img {
margin-top: 0;
width: 2.5em;
padding: 0.3em;
border-radius: 5px;
}
.ynh-panel-active .logo {
display: none;
}
/* messages */
.messages {
@ -365,6 +398,7 @@ textarea {
transition: all 0.1s ease;
-webkit-transition: all 0.1s ease;
}
.user-container-edit:hover:after,
.user-container-password:hover:after {
left: -20px;

View file

@ -78,10 +78,22 @@ document.addEventListener('DOMContentLoaded', function() {
// Response is JSON
response = JSON.parse(r.responseText);
// load additional theme's script
loadScript("/yunohost/sso/assets/themes/"+ response.theme +"/js/ynhpanel.js");
};
r.send();
if(window.location != window.parent.location) {
// Set class to body to show we're in overlay
document.body.classList.add('overlay');
let userContainer = document.querySelector('a.user-container');
userContainer.classList.replace('user-container-info', 'user-container-edit');
userContainer.setAttribute('href', userContainer
.getAttribute('href')
.replace('edit.html', ''));
userContainer.addEventListener('click', function(e) {
e.preventDefault();
e.stopPropagation();
window.parent.location.href = userContainer.getAttribute('href');
})
}
});

View file

@ -234,7 +234,6 @@ domReady(function(){
// Portal link is draggable, for user convenience
dragg('ynh-overlay-switch');
// Create overlay element
var overlay = document.createElement('iframe');
overlay.src = "/yunohost/sso/info.html";
@ -243,7 +242,6 @@ domReady(function(){
document.body.insertBefore(overlay, null);
// Get user's app
var r = new XMLHttpRequest();
r.open("GET", "/ynhpanel.json", true);
@ -262,14 +260,6 @@ domReady(function(){
portalStyle.setAttribute("href", '/ynhpanel.css');
document.getElementsByTagName("head")[0].insertBefore(portalStyle, null);
// Custom style from theme id specified in config
var portalThemeStyle = document.createElement("link");
portalThemeStyle.setAttribute("rel", "stylesheet");
portalThemeStyle.setAttribute("type", "text/css");
portalThemeStyle.setAttribute("href", '/yunohost/sso/assets/themes/'+ response.theme +'/css/ynhpanel.css');
document.getElementsByTagName("head")[0].insertBefore(portalThemeStyle, null);
// Bind YNH Button
window.addEvent(portal, 'click', function(e){
// Prevent default click

View file

@ -35,6 +35,10 @@
</head>
<body class="{{#connected}}logged{{/connected}}">
<h1 id="logo" class="logo">
<img src="assets/img/logo-ynh-white.svg"/><span class="element-invisible">Yunohost</span>
</h1>
<div class="overlay">
{{#flash_win}}
<div class="wrapper messages success">{{.}}</div>