Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First tests to introducing custom themings. #116

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions helpers.lua
Expand Up @@ -547,6 +547,7 @@ function get_data_for(view)
local mails = get_mails(user)
data = {
connected = true,
theme = conf.theme,
portal_url = conf.portal_url,
uid = user,
cn = cache:get(user.."-cn"),
Expand Down Expand Up @@ -679,7 +680,7 @@ function edit_user()

-- Open the LDAP connection
local ldap = lualdap.open_simple(conf["ldap_host"], dn, args.currentpassword)

local password = hash_password(args.newpassword)

-- Modify the LDAP information
Expand Down Expand Up @@ -906,7 +907,7 @@ function login()
local uri_args = ngx.req.get_uri_args()

args.user = string.lower(args.user)

local user = authenticate(args.user, args.password)
if user then
ngx.status = ngx.HTTP_CREATED
Expand Down
6 changes: 6 additions & 0 deletions portal/assets/css/ynh-style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 20 additions & 7 deletions portal/assets/js/ynhpanel.js
Expand Up @@ -223,13 +223,6 @@ domReady(function(){
meta_viewport = document.querySelector('meta[name="viewport"]');
meta_viewport_content = meta_viewport.getAttribute('content');

// Add portal stylesheet
var portalStyle = document.createElement("link");
portalStyle.setAttribute("rel", "stylesheet");
portalStyle.setAttribute("type", "text/css");
portalStyle.setAttribute("href", '/ynhpanel.css');
document.getElementsByTagName("head")[0].insertBefore(portalStyle, null);

// Create portal link
var portal = document.createElement('a');
portal.setAttribute('id', 'ynh-overlay-switch');
Expand Down Expand Up @@ -302,6 +295,26 @@ domReady(function(){
}
}


// Load all stylesheets after getting config

// Add portal stylesheet
var portalStyle = document.createElement("link");
portalStyle.setAttribute("rel", "stylesheet");
portalStyle.setAttribute("type", "text/css");
portalStyle.setAttribute("href", '/ynhpanel.css');
document.getElementsByTagName("head")[0].insertBefore(portalStyle, null);

// Custom style from theme
if (response.theme) {
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
Expand Down
12 changes: 12 additions & 0 deletions portal/assets/themes/black/css/ynh-style.css
@@ -0,0 +1,12 @@

#logo {
z-index: 10;
background-image: url("../img/logo-ynh-white.svg");
}

.overlay {
background-color: black;
width: 100%;
height: 100%;
position: absolute;
}
11 changes: 11 additions & 0 deletions portal/assets/themes/black/css/ynhpanel.css
@@ -0,0 +1,11 @@

#ynh-overlay-switch {
background-image: url("../img/logo-ynh-white.svg");
}

#ynh-overlay {
background-color: black;
width: 100%;
height: 100%;
position: absolute;
}
32 changes: 32 additions & 0 deletions portal/assets/themes/black/img/logo-ynh-white.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions portal/assets/themes/clouds/css/ynh-style.css
@@ -0,0 +1,14 @@

#logo {
z-index: 10;
background-image: url("../img/logo-ynh.svg");
}

.overlay {
background-image: url("../img/background.jpg");
width: 100%;
height: 100%;
position: absolute;
background-size: cover;
background-position: center;
}
13 changes: 13 additions & 0 deletions portal/assets/themes/clouds/css/ynhpanel.css
@@ -0,0 +1,13 @@

#ynh-overlay-switch {
background-image: url("../img/logo-ynh.svg");
}

#ynh-overlay {
background-image: url("../img/background.jpg");
width: 100%;
height: 100%;
position: absolute;
background-size: cover;
background-position: center;
}
Binary file added portal/assets/themes/clouds/img/background.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions portal/assets/themes/clouds/img/logo-ynh.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions portal/header.ms
Expand Up @@ -13,6 +13,9 @@

<!-- Stylesheets -->
<link rel="stylesheet" href="assets/css/ynh-style.css">
{{#theme}}
<link rel="stylesheet" href="assets/themes/{{theme}}/css/ynh-style.css">
{{/theme}}

<!-- Icons -->
<link rel="shortcut icon" href="assets/icons/favicon.ico">
Expand All @@ -35,7 +38,7 @@
<body class="{{#connected}}logged{{/connected}}">

<h1 id="logo" class="logo">
<img src="assets/img/logo-ynh-white.svg"/><span class="element-invisible">Yunohost</span>
<span class="element-invisible">Yunohost</span>
</h1>

<div class="overlay">
Expand All @@ -50,4 +53,3 @@
{{#flash_info}}
<div class="wrapper messages info">{{.}}</div>
{{/flash_info}}