From 0aafdab8104b7c2bfd2f835e7a2f13d33b89dbf2 Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Wed, 17 Jan 2018 13:27:41 +0100 Subject: [PATCH 1/5] Use template home.tpl for mod/home --- mod/home.php | 30 +++++++++++++++++++----------- view/templates/home.tpl | 14 ++++++++++++++ 2 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 view/templates/home.tpl diff --git a/mod/home.php b/mod/home.php index beda739fd..f3138d186 100644 --- a/mod/home.php +++ b/mod/home.php @@ -24,8 +24,6 @@ function home_init(App $a) { if(! function_exists('home_content')) { function home_content(App $a) { - $o = ''; - if (x($_SESSION,'theme')) { unset($_SESSION['theme']); } @@ -33,21 +31,31 @@ function home_content(App $a) { unset($_SESSION['mobile-theme']); } - /// @TODO No absolute path used, maybe risky (security) - if (file_exists('home.html')) { - if (file_exists('home.css')) { + $customhome = False; + $defaultheader = '

'.((x($a->config,'sitename')) ? sprintf(t("Welcome to %s"), $a->config['sitename']) : "").'

'; + + $homefilepath = $a->basepath . '/home.html'; + $cssfilepath = $a->basepath . '/home.css'; + if (file_exists($homefilepath)) { + $customhome = $homefilepath; + if (file_exists($cssfilepath)) { $a->page['htmlhead'] .= ''; } + } - $o .= file_get_contents('home.html'); - } else { - $o .= '

'.((x($a->config,'sitename')) ? sprintf(t("Welcome to %s"), $a->config['sitename']) : "").'

'; - } + $login = Login::form($a->query_string, $a->config['register_policy'] == REGISTER_CLOSED ? 0 : 1); - $o .= Login::form($a->query_string, $a->config['register_policy'] == REGISTER_CLOSED ? 0 : 1); + $content = ''; + call_hooks("home_content",$content); - call_hooks("home_content",$o); + $tpl = get_markup_template('home.tpl'); + return replace_macros($tpl, [ + '$defaultheader' => $defaultheader, + '$customhome' => $customhome, + '$login' => $login, + '$content' => $content + ]); return $o; diff --git a/view/templates/home.tpl b/view/templates/home.tpl new file mode 100644 index 000000000..6e50a7530 --- /dev/null +++ b/view/templates/home.tpl @@ -0,0 +1,14 @@ + +{{* custom content from hook will replace everything. *}} +{{if $content != '' }} + {{$content}} +{{else}} + + {{if $customhome != false }} + {{include file="$customhome"}} + {{else}} + {{$defaultheader}} + {{/if}} + + {{$login}} +{{/if}} From 9862194914f54052a3ae38bb8ff6a2216e74c227 Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Wed, 17 Jan 2018 13:29:04 +0100 Subject: [PATCH 2/5] Frio: fix home page Add home.tpl, fix style with custom home.html, fix style with custom page content from addon --- view/theme/frio/css/style.css | 44 +++++++++++++++++++++--------- view/theme/frio/templates/home.tpl | 25 +++++++++++++++++ 2 files changed, 56 insertions(+), 13 deletions(-) create mode 100644 view/theme/frio/templates/home.tpl diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index 2900a727f..eb08deea4 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -3024,25 +3024,42 @@ section .profile-match-wrapper { box-shadow: unset; border: 0 } -.mod-home.is-not-singleuser #content > h1, -.mod-login #content > h1 { - color: #eee; +.mod-home.is-not-singleuser .login-content, +.mod-login .login-content { + color: #eee; + margin-top: 2.5%; } -@media screen and (min-width: 700px) { - .mod-home.is-not-singleuser #content > #login-form, - .mod-login #content > #login-form { - width: 50%; +.mod-home.is-not-singleuser .login-form > #login-form, +.mod-login .login-form > #login-form { + color: #eee; +} + +.mod-home.is-not-singleuser .login-panel-content, +.mod-login .login-panel-content { + background-color: rgba(255,255,255,.85); +} + +/* Medium devices (desktops, 992px and up) */ +@media (min-width: 992px) { + .mod-home.is-not-singleuser #content, + .mod-login #content { + margin-top: 100px!important; + } + + + + .mod-home.is-not-singleuser .login-form > #login-form, + .mod-login .login-form > #login-form { background-color: #fff; color: #444; padding: 1em; - float: right; position: relative; margin-top: 4em; } - .mod-home.is-not-singleuser #content > #login-form:before, - .mod-login #content > #login-form:before { + .mod-home.is-not-singleuser .login-form > #login-form:before, + .mod-login .login-form > #login-form:before { display: block; position: absolute; content: " "; @@ -3054,8 +3071,8 @@ section .profile-match-wrapper { z-index: -1; } - .mod-home.is-not-singleuser #content > #login-form:after, - .mod-login #content > #login-form:after { + .mod-home.is-not-singleuser .login-form > #login-form:after, + .mod-login .login-form > #login-form:after { display: block; position: absolute; content: " "; @@ -3065,7 +3082,8 @@ section .profile-match-wrapper { top: -10%; left: 10%; z-index: -1; - } + } + } diff --git a/view/theme/frio/templates/home.tpl b/view/theme/frio/templates/home.tpl new file mode 100644 index 000000000..dd53a1eae --- /dev/null +++ b/view/theme/frio/templates/home.tpl @@ -0,0 +1,25 @@ + +{{* custom content from hook will replace everything. *}} +
+{{if $content != '' }} +
+ +
+{{else}} + + + +{{/if}} +
\ No newline at end of file From 2c8bbea65d0b0d75bfa3ab4eadcc5ae5bfad8663 Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Wed, 17 Jan 2018 16:01:34 +0100 Subject: [PATCH 3/5] frio: tweak login template, fix style move lost pwd link and register to submit wrapper, use flexbox for submit row in login form, show register link as button fix form label colors in mobile --- view/theme/frio/css/style.css | 31 +++++++++++++++++++---------- view/theme/frio/templates/login.tpl | 12 +++++------ 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index eb08deea4..f6f6ad9de 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -3008,6 +3008,14 @@ section .profile-match-wrapper { /** * Login page */ +#login-submit-wrapper { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + align-items: center; +} +#lost-password-link { flex-grow: 2; } + .mod-home.is-not-singleuser, .mod-login { background-image: linear-gradient(to right, rgba(0,0,0, 0.7) , rgba(0,0,0, 0.4)), url($login_bg_image); @@ -3030,10 +3038,11 @@ section .profile-match-wrapper { margin-top: 2.5%; } -.mod-home.is-not-singleuser .login-form > #login-form, -.mod-login .login-form > #login-form { +.mod-home.is-not-singleuser .login-form > #login-form label, +.mod-login #content #login-form label { color: #eee; } + .mod-home.is-not-singleuser .login-panel-content, .mod-login .login-panel-content { @@ -3046,20 +3055,22 @@ section .profile-match-wrapper { .mod-login #content { margin-top: 100px!important; } - - .mod-home.is-not-singleuser .login-form > #login-form, - .mod-login .login-form > #login-form { + .mod-login #content #login-form { background-color: #fff; - color: #444; padding: 1em; position: relative; margin-top: 4em; } - .mod-home.is-not-singleuser .login-form > #login-form:before, - .mod-login .login-form > #login-form:before { + .mod-home.is-not-singleuser .login-form > #login-form label, + .mod-login #content #login-form label { + color: #444; + } + + .mod-home.is-not-singleuser .login-form > #login-form::before, + .mod-login #content #login-form::before { display: block; position: absolute; content: " "; @@ -3071,8 +3082,8 @@ section .profile-match-wrapper { z-index: -1; } - .mod-home.is-not-singleuser .login-form > #login-form:after, - .mod-login .login-form > #login-form:after { + .mod-home.is-not-singleuser .login-form > #login-form::after, + .mod-login #content #login-form::after { display: block; position: absolute; content: " "; diff --git a/view/theme/frio/templates/login.tpl b/view/theme/frio/templates/login.tpl index 1f818f524..aaa42d24b 100644 --- a/view/theme/frio/templates/login.tpl +++ b/view/theme/frio/templates/login.tpl @@ -18,15 +18,15 @@ {{include file="field_checkbox.tpl" field=$lremember}} - {{if $login_bg_image}}{{include file="field_fileinput.tpl" field=$login_bg_image}}{{/if}} +{{if $login_bg_color}}{{include file="field_colorinput.tpl" field=$login_bg_color}}{{/if}}