Commit c4223749 by Scott

Minor updates to SnowFlat

Shrink user avatar height and prevent overlapping (fixes #170).
Add hidden and flagged styles (fixes #168).
Add label to Login icon.
Move a function back into qa-theme.php.
parent 9dbb6df1
......@@ -226,74 +226,14 @@ class qam_snow_theme
private function headers()
{
$this->data['headers'] = array(
'user_account' => $this->user_account(),
'user_points' => $this->user_points(),
'ask_button' => $this->ask_button(),
// 'fb_like_box_init' => $this->fb_like_box_init(),
// 'twitter_widget_init' => $this->twitter_widget_init(),
);
return $this->data;
}
/**
* User account navigation item
*
* This will return based on login information.
*
* If user loggedIn, it will populate user avatar and account links.
* If user is guest, it will populate login form and registration link.
*
* @access private
* @since Snow 1.4
* @version 1.0
* @return string HTML output for user account or authentication form
*
* @author Q2A Market <http://www.q2amarket.com>
* @copyright (c) 2014, Q2A Market
* @license http://www.gnu.org/copyleft/gpl.html
*/
private function user_account()
{
$logged_in = qa_is_logged_in();
$handle = qa_get_logged_in_user_field('handle');
$avatarsize = 36;
// get loogedin user avatar
if ($logged_in) {
if (QA_FINAL_EXTERNAL_USERS) {
$tobar_avatar = qa_get_external_avatar_html( qa_get_logged_in_user_field('userid'), $avatarsize, true );
}
else {
$tobar_avatar = qa_get_user_avatar_html(
qa_get_logged_in_user_field('flags'),
qa_get_logged_in_user_field('email'),
$handle,
qa_get_logged_in_user_field('avatarblobid'),
qa_get_logged_in_user_field('avatarwidth'),
qa_get_logged_in_user_field('avatarheight'),
$avatarsize,
false
);
}
$auth_icon = strip_tags($tobar_avatar, '<img>');
}
else {
$auth_icon = '<i class="icon-key qam-auth-key"></i>';
}
// finally return avatar with div tag
$class = $logged_in ? 'qam-logged-in' : 'qam-logged-out';
$user_account = '<div id="qam-account-toggle" class="' . $class . '">' .
$auth_icon .
'<div class="qam-account-handle">' . qa_html($handle) . '</div>' .
'</div>';
return $user_account;
}
/**
* Get logged in user's points
*
* @access private
......
......@@ -83,9 +83,11 @@ $(document).ready(function () {
$(window).resize(function () {
if (window.matchMedia('(min-width: 980px)').matches) {
$(".qam-search.the-top .qa-search").hide();
$(".qa-nav-main").show();
$(".qa-nav-main").show('fast', function() { $(this).css('display','inline-block'); });
} else {
$(".qam-search.the-top .qa-search").show();
$(".qa-nav-main").hide();
$('.qam-menu-toggle').removeClass('current');
}
});
......
......@@ -464,19 +464,11 @@ blockquote p {
}
.qa-logo {
display: inline-block;
vertical-align: top;
font-size: 24px;
margin: 0 1px 0 0;
}
@media (max-width: 979px) {
.qa-logo {
display: inline-block;
}
}
@media (min-width: 980px) {
.qa-logo {
float: left;
}
}
.qa-logo img {
max-height: 49px;
width: auto;
......@@ -517,8 +509,8 @@ blockquote p {
}
@media (min-width: 980px) {
.qa-nav-main {
vertical-align: top;
display: inline-block;
float: left;
}
}
......@@ -705,34 +697,27 @@ blockquote p {
color: #fff;
}
@media (max-width: 979px) {
.qam-account-items-wrapper {
position: absolute;
top: 8px;
right: 8px;
}
}
@media (min-width: 980px) {
.qam-account-items-wrapper {
float: right;
position: relative;
}
.qam-account-items-wrapper {
float: right;
position: relative;
}
#qam-account-toggle {
background-color: #34495e;
display: block;
text-align: center;
cursor: pointer;
min-width: 60px;
padding: 2px;
background-color: #34495e;
text-align: center;
}
#qam-account-toggle:hover {
background: #445f7a;
}
#qam-account-toggle .qam-auth-key {
font-size: 38px;
font-size: 28px;
}
#qam-account-toggle .qam-auth-key:before {
display: block;
line-height: 50px;
display: inline-block;
}
.qam-account-items {
......@@ -751,6 +736,7 @@ blockquote p {
.qam-account-handle {
font-size: 12px;
line-height: 1.8;
}
#qa-login {
......@@ -2634,6 +2620,17 @@ input[type="submit"], button {
position: relative;
}
.qa-main-hidden, .qa-a-list-item-hidden, .qa-c-item-hidden {
opacity: 0.6;
}
.qa-q-item-flags, .qa-q-view-flags, .qa-a-item-flags, .qa-c-item-flags {
color: #e74c3c;
font-weight: bold;
padding-left: 4px;
}
/*------[ a-list ]------*/
.qa-part-a-form h2 {
margin-top: 0;
......
......@@ -69,7 +69,7 @@ class qa_html_theme extends qa_html_theme_base
*/
public function head_metas()
{
$this->output('<meta name="viewport" content="width=device-width, initial-scale=1">');
$this->output('<meta name="viewport" content="width=device-width, initial-scale=1"/>');
qa_html_theme_base::head_metas();
}
......@@ -182,7 +182,7 @@ class qa_html_theme extends qa_html_theme_base
$this->output('<div class="qam-account-items-wrapper">');
$this->output($qam_snow->headers['user_account']);
$this->qam_user_account();
$this->output('<div class="qam-account-items clearfix">');
......@@ -221,9 +221,9 @@ class qa_html_theme extends qa_html_theme_base
{
$this->output('<div class="qam-main-nav-wrapper clearfix">');
$this->output('<div class="sb-toggle-left qam-menu-toggle"><i class="icon-th-list"></i></div>');
$this->nav_user_search();
$this->logo();
$this->nav('main');
$this->nav_user_search();
$this->output('</div> <!-- END qam-main-nav-wrapper -->');
$this->nav('sub');
}
......@@ -566,6 +566,56 @@ class qa_html_theme extends qa_html_theme_base
}
/**
* User account navigation item. This will return based on login information.
* If user is logged in, it will populate user avatar and account links.
* If user is guest, it will populate login form and registration link.
*
* @since Snow 1.4
*/
private function qam_user_account()
{
$avatarsize = 32;
// get logged-in user avatar
if (qa_is_logged_in()) {
$handle = qa_get_logged_in_user_field('handle');
$toggleClass = 'qam-logged-in';
if (QA_FINAL_EXTERNAL_USERS) {
$tobar_avatar = qa_get_external_avatar_html( qa_get_logged_in_user_field('userid'), $avatarsize, true );
}
else {
$tobar_avatar = qa_get_user_avatar_html(
qa_get_logged_in_user_field('flags'),
qa_get_logged_in_user_field('email'),
$handle,
qa_get_logged_in_user_field('avatarblobid'),
qa_get_logged_in_user_field('avatarwidth'),
qa_get_logged_in_user_field('avatarheight'),
$avatarsize,
false
);
}
$auth_icon = strip_tags($tobar_avatar, '<img>');
}
// display login icon and label
else {
$handle = $this->content['navigation']['user']['login']['label'];
$toggleClass = 'qam-logged-out';
$auth_icon = '<i class="icon-key qam-auth-key"></i>';
}
// finally output avatar with div tag
$this->output(
'<div id="qam-account-toggle" class="' . $toggleClass . '">',
$auth_icon,
'<div class="qam-account-handle">' . qa_html($handle) . '</div>',
'</div>'
);
}
/**
* To add search-box wrapper with extra class for color scheme
*
* @since Snow 1.4
......
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