From 60b00b029ac27254fb0eb4b024b9eab5787ccb4f Mon Sep 17 00:00:00 2001 From: emanuele Date: Tue, 12 Nov 2013 18:29:37 +0100 Subject: [PATCH] Revisit the header/news area moving things around a bit according to #710 Signed-off-by: emanuele --- sources/Subs.php | 20 ++-- themes/default/css/index.css | 58 +++++++++-- themes/default/css/index_light.css | 2 +- themes/default/index.template.php | 108 ++++++++++----------- themes/default/languages/index.english.php | 3 + themes/default/scripts/theme.js | 20 +++- 6 files changed, 130 insertions(+), 81 deletions(-) diff --git a/sources/Subs.php b/sources/Subs.php index c66e7e3d65..4f27217cd5 100644 --- a/sources/Subs.php +++ b/sources/Subs.php @@ -2719,7 +2719,7 @@ function determineTopicClass(&$topic_context) */ function setupThemeContext($forceload = false) { - global $modSettings, $user_info, $scripturl, $context, $settings, $options, $txt, $maintenance; + global $modSettings, $user_info, $scripturl, $context, $settings, $options, $txt; global $user_settings; static $loaded = false; @@ -2731,7 +2731,6 @@ function setupThemeContext($forceload = false) $loaded = true; - $context['in_maintenance'] = !empty($maintenance); $context['current_time'] = standardTime(time(), false); $context['current_action'] = isset($_GET['action']) ? $_GET['action'] : ''; $context['show_quick_login'] = !empty($modSettings['enableVBStyleLogin']) && $user_info['is_guest']; @@ -3573,13 +3572,6 @@ function setupMenuContext() // The main menu $menu->addBulk( array( - // The old "logout" is meh. Not a real word. "Log out" is better. - 'logout' => array( - 'title' => $txt['logout'], - 'href' => $scripturl . '?action=logout;%1$s=%2$s', - 'show' => !$user_info['is_guest'], - ), - 'home' => array( 'title' => $txt['community'], 'href' => $scripturl, @@ -3801,6 +3793,12 @@ function setupMenuContext() 'href' => $scripturl . '?action=profile;area=theme', 'show' => allowedTo(array('profile_extra_any', 'profile_extra_own', 'profile_extra_any')), ), + // The old "logout" is meh. Not a real word. "Log out" is better. + 'logout' => array( + 'title' => $txt['logout'], + 'href' => $scripturl . '?action=logout;' . $context['session_var'] . '=' . $context['session_id'], + 'show' => !$user_info['is_guest'], + ), ) ); @@ -3870,10 +3868,6 @@ function setupMenuContext() $context['menu_buttons'] = $menu_buttons; $allMenus->destroy('Main_Menu'); - // Logging out requires the session id in the url. - if (isset($context['menu_buttons']['logout'])) - $context['menu_buttons']['logout']['href'] = sprintf($context['menu_buttons']['logout']['href'], $context['session_var'], $context['session_id']); - // Figure out which action we are doing so we can set the active tab. // Default to home. $current_action = 'home'; diff --git a/themes/default/css/index.css b/themes/default/css/index.css index 8c3531bd9a..cc7c3168a0 100644 --- a/themes/default/css/index.css +++ b/themes/default/css/index.css @@ -846,8 +846,33 @@ div.bbc_footnotes { margin: 0; padding: 14px 8px 0 8px; line-height: 1.3em; + min-width:38%; + position: relative; + min-height: 40px; /* @todo - See me grumblez in Issue #552. ;) */ } +#top_section_notice .toggle_login { + position:absolute; + left: 0; + padding-top: 2px; + display: inline; + cursor: pointer; +} +#top_section_notice form { + white-space: nowrap; + width: 100%; +} +#top_section_notice .button_submit { + position: absolute; + right: 0; +} +#password_login, #openid_login { + display: inline-block; + margin-left: 50px; +} +#password_login input, #password_login select { + margin-left: -5px; +} #search_form { padding: 12px 0 4px 8px; float: left; @@ -892,9 +917,7 @@ div.bbc_footnotes { } /* The user info, news, etc.*/ #news { - display: table-cell; vertical-align: top; - width: 90%; } #upper_section>.user { display: table-cell; @@ -903,7 +926,9 @@ div.bbc_footnotes { font-size: 0.857em; } .greeting { + float: right; font-weight: bold; + padding-top: 10px; } /* The login form. */ #guest_form { @@ -914,16 +939,18 @@ div.bbc_footnotes { margin: 0 4px 8px 0; } /* User information. @todo - Simplify. */ -#upper_section .avatar { - float: left; - margin: 0 5px 5px 0; +#top_section_notice a.avatar { + float: right; + vertical-align: middle; + padding-right: 5px; } /* No more huge avatars up top. YAY! */ -#upper_section .avatar img, .notifavatar .avatar { +#top_section_notice .avatar img, .notifavatar .avatar { width: auto; height: auto; - max-width: 60px; - max-height: 60px; + max-width: 36px; + max-height: 36px; + border-radius: 2px; } .modtask { margin: 1em 0 0 0; @@ -1002,7 +1029,7 @@ div.bbc_footnotes { .listlevel1:hover { z-index: 5; } -.listlevel1#collapse_button, .listlevel1#button_logout { +.listlevel1#collapse_button, .listlevel1#button_profile { float: right; } /* Level 1 Menu bar: link or button. */ @@ -1030,6 +1057,10 @@ div.bbc_footnotes { .listlevel1:hover .menulevel2, .listlevel1.sfhover .menulevel2 { left: 0; } +.listlevel1#button_profile:hover .menulevel2, .listlevel1#button_profile.sfhover .menulevel2 { + left: auto; + right: 0px; +} /* Hiding Level 3 drop menu off hover. */ .listlevel1:hover .menulevel3, .listlevel1.sfhover .menulevel3 { left: -9999px; @@ -4135,6 +4166,9 @@ a.help .icon { .board_stats, .topic_stats { display: none; } + #password_login select { + display: none; + } } /* This one does 800 screens at default font size. */ @media screen and (min-width: 30em) and (max-width: 50em) { @@ -4191,6 +4225,12 @@ a.help .icon { display: block; } /* End playing silly buggers. */ + #top_section_notice { + min-width: 250px; + } + #password_login select { + display: none; + } } /* This one does 480 screens at default font size. */ @media screen and (max-width: 30em) { diff --git a/themes/default/css/index_light.css b/themes/default/css/index_light.css index 01c5afe590..28b10f26a7 100644 --- a/themes/default/css/index_light.css +++ b/themes/default/css/index_light.css @@ -206,7 +206,7 @@ sup.bbc_footnotes, sup.bbc_footnotes a { } /* News section. */ #news { - padding: 0 0 1em 1em; + padding: 0 1em 1em 1em; font-size: 0.929em; } #news>h2 { diff --git a/themes/default/index.template.php b/themes/default/index.template.php index a1173fdd92..063ef3a6c2 100644 --- a/themes/default/index.template.php +++ b/themes/default/index.template.php @@ -205,29 +205,66 @@ function template_body_above() // Skip nav link. echo '
-
-

'; +

'; // If the user is logged in, display the time, or a maintenance warning for admins. // @todo - TBH I always intended the time/date to be more or less a place holder for more important things. // The maintenance mode warning for admins is an obvious one, but this could also be used for moderation notifications. // I also assumed this would be an obvious place for sites to put a string of icons to link to their FB, Twitter, etc. // This could still be done via conditional, so that administration and moderation notices were still active when applicable. - if ($context['user']['is_logged']) + + echo ' +
'; + + // Show log in form to guests. + if (!empty($context['show_login_bar'])) { - // Is the forum in maintenance mode? - if ($context['in_maintenance'] && $context['user']['is_admin']) + echo ' + +
', !empty($modSettings['enableOpenID']) ? ' + ' : '', ' +
+ + + +
'; + + if (!empty($modSettings['enableOpenID'])) + { echo ' - ', $txt['maintain_mode_on'], ''; - else - echo $context['current_time']; - } - // Otherwise they're a guest. Ask them to either register or login. - else - echo sprintf($txt[$context['can_register'] ? 'welcome_guest_register' : 'welcome_guest'], $txt['guest_title'], $scripturl . '?action=login'); +
+ +
+ '; + } + echo ' + + + + +
'; + } + // If the user is logged in, display stuff like their name, new messages, etc. + elseif ($context['user']['is_logged']) + { + echo ' + ', $txt['hello_member_ndt'], ' ', $context['user']['name'], ''; + if (!empty($context['user']['avatar'])) + echo ' + ', $context['user']['avatar']['image'], ''; + } echo ' -

'; +
'; if ($context['allow_search']) { @@ -304,50 +341,7 @@ function template_body_above()
-