hide nav search behind a button, css fixes and cleanup

This commit is contained in:
Mario Vavti 2017-03-14 18:31:19 +01:00
parent 7b9df1d401
commit a0a376e95e
11 changed files with 47 additions and 115 deletions

View file

@ -42,8 +42,6 @@ EOT;
$sitelocation = (($myident) ? $myident : App::get_hostname());
/**
*
* Provide a banner/logo/whatever
@ -55,10 +53,9 @@ EOT;
if($banner === false)
$banner = get_config('system','sitename');
//the notifications template is in hdr.tpl
App::$page['header'] .= replace_macros(get_markup_template('hdr.tpl'), array(
'$baseurl' => z_root(),
'$sitelocation' => $sitelocation,
'$banner' => $banner
//we could additionally use this to display important system notifications e.g. for updates
));
$server_role = get_config('system','server_role');
@ -66,21 +63,21 @@ EOT;
$techlevel = get_account_techlevel();
// nav links: array of array('href', 'text', 'extra css classes', 'title')
$nav = Array();
$nav = [];
/**
* Display login or logout
*/
$nav['usermenu']=array();
$nav['usermenu'] = [];
$userinfo = null;
$nav['loginmenu']=array();
$nav['loginmenu'] = [];
if($observer) {
$userinfo = array(
$userinfo = [
'icon' => $observer['xchan_photo_m'],
'name' => $observer['xchan_addr'],
);
];
}
elseif(! $_SESSION['authenticated']) {
@ -96,38 +93,21 @@ EOT;
if($chans && count($chans) > 1 && feature_enabled(local_channel(),'nav_channel_select') && (! $basic))
$nav['channels'] = $chans;
$nav['logout'] = Array('logout',t('Logout'), "", t('End this session'),'logout_nav_btn');
$nav['logout'] = ['logout',t('Logout'), "", t('End this session'),'logout_nav_btn'];
// user menu
//$nav['usermenu'][] = Array('channel/' . $channel['channel_address'], t('Home'), "", t('Your posts and conversations'),'channel_nav_btn');
$nav['usermenu'][] = Array('profile/' . $channel['channel_address'], t('View Profile'), "", t('Your profile page'),'profile_nav_btn');
$nav['usermenu'][] = ['profile/' . $channel['channel_address'], t('View Profile'), "", t('Your profile page'),'profile_nav_btn'];
if(feature_enabled(local_channel(),'multi_profiles') && (! $basic))
$nav['usermenu'][] = Array('profiles', t('Edit Profiles'),"", t('Manage/Edit profiles'),'profiles_nav_btn');
$nav['usermenu'][] = ['profiles', t('Edit Profiles'),"", t('Manage/Edit profiles'),'profiles_nav_btn'];
else
$nav['usermenu'][] = Array('profiles/' . $prof[0]['id'], t('Edit Profile'),"", t('Edit your profile'),'profiles_nav_btn');
$nav['usermenu'][] = ['profiles/' . $prof[0]['id'], t('Edit Profile'),"", t('Edit your profile'),'profiles_nav_btn'];
//$nav['usermenu'][] = Array('photos/' . $channel['channel_address'], t('Photos'), "", t('Your photos'),'photos_nav_btn');
//$nav['usermenu'][] = Array('cloud/' . $channel['channel_address'],t('Files'),"",t('Your files'),'cloud_nav_btn');
//if((! $basic) && feature_enabled(local_channel(),'ajaxchat'))
// $nav['usermenu'][] = Array('chat/' . $channel['channel_address'], t('Chat'),"",t('Your chatrooms'),'chat_nav_btn');
//require_once('include/menu.php');
//$has_bookmarks = menu_list_count(local_channel(),'',MENU_BOOKMARK) + menu_list_count(local_channel(),'',MENU_SYSTEM|MENU_BOOKMARK);
//if(($has_bookmarks) && (! $basic)) {
// $nav['usermenu'][] = Array('bookmarks', t('Bookmarks'), "", t('Your bookmarks'),'bookmarks_nav_btn');
//}
//if(feature_enabled($channel['channel_id'],'webpages') && (! $basic))
// $nav['usermenu'][] = Array('webpages/' . $channel['channel_address'],t('Webpages'),"",t('Your webpages'),'webpages_nav_btn');
//if(feature_enabled($channel['channel_id'],'wiki') && (! $basic))
// $nav['usermenu'][] = Array('wiki/' . $channel['channel_address'],t('Wikis'),"",t('Your wikis'),'wiki_nav_btn');
}
else {
if(! get_account_id()) {
$nav['login'] = login(true,'main-login',false,false);
$nav['loginmenu'][] = Array('login',t('Login'),'',t('Sign in'),'login_nav_btn');
$nav['loginmenu'][] = ['login',t('Login'),'',t('Sign in'),'login_nav_btn'];
App::$page['content'] .= replace_macros(get_markup_template('nav_login.tpl'),
[
'$nav' => $nav,
@ -137,7 +117,7 @@ EOT;
}
else
$nav['alogout'] = Array('logout',t('Logout'), "", t('End this session'),'logout_nav_btn');
$nav['alogout'] = ['logout',t('Logout'), "", t('End this session'),'logout_nav_btn'];
}
@ -159,7 +139,7 @@ EOT;
}
if(((get_config('system','register_policy') == REGISTER_OPEN) || (get_config('system','register_policy') == REGISTER_APPROVE)) && (! $_SESSION['authenticated']))
$nav['register'] = array('register',t('Register'), "", t('Create an account'),'register_nav_btn');
$nav['register'] = ['register',t('Register'), "", t('Create an account'),'register_nav_btn'];
if(! get_config('system','hide_help')) {
$help_url = z_root() . '/help?f=&cmd=' . App::$cmd;
@ -171,15 +151,10 @@ EOT;
//point directly to /help if $context_help is empty - this can be removed once we have context help for all modules
$enable_context_help = (($context_help) ? true : false);
}
$nav['help'] = array($help_url, t('Help'), "", t('Help and documentation'), 'help_nav_btn', $context_help, $enable_context_help);
$nav['help'] = [$help_url, t('Help'), "", t('Help and documentation'), 'help_nav_btn', $context_help, $enable_context_help];
}
if(! $basic)
$nav['apps'] = array('apps', t('Apps'), "", t('Applications, utilities, links, games'),'apps_nav_btn');
$nav['search'] = array('search', t('Search'), "", t('Search site @name, #tag, ?docs, content'));
$nav['directory'] = array('directory', t('Directory'), "", t('Channel Directory'),'directory_nav_btn');
$nav['search'] = ['search', t('Search'), "", t('Search site @name, #tag, ?docs, content')];
/**
@ -246,15 +221,13 @@ EOT;
$banner = get_config('system','sitename');
$x = array('nav' => $nav, 'usermenu' => $userinfo );
call_hooks('nav', $x);
// Not sure the best place to put this on the page. So I'm implementing it but leaving it
// turned off until somebody discovers this and figures out a good location for it.
$powered_by = '';
// $powered_by = '<strong>red<img class="smiley" src="' . z_root() . '/images/rm-16.png" alt="r#" />matrix</strong>';
//app bin
if(local_channel()) {
if(get_pconfig(local_channel(), 'system','initial_import_system_apps') === false) {

View file

@ -17,18 +17,17 @@ nav .badge {
font-size: 1rem;
}
/* nav overrides end */
#navbar-collapse-2.show {
max-height: 100vh;
overflow: auto;
}
nav .dropdown-menu {
max-height: 70vh;
overflow: auto;
}
nav .navbar-collapse.in .dropdown-menu {
max-height: none;
overflow: none;
}
/* nav overrides end */
.wall-item-tools .dropdown-menu {
min-width: auto;
@ -38,10 +37,6 @@ code {
white-space: normal;
}
.form-control {
font-size: unset;
}
.panel-group {
margin-bottom: 0px;
}

View file

@ -60,7 +60,7 @@ function contact_format(item) {
var desc = ((item.label) ? item.nick + ' ' + item.label : item.nick);
if(typeof desc === 'undefined') desc = '';
if(desc) desc = ' ('+desc+')';
return "<div class='{0}' title='{4}'><img class='dropdown-menu-img-sm' src='{1}'><span class='contactname'>{2}</span><span class='dropdown-sub-text'>{3}</span><div class='clear'></div></div>".format(item.taggable, item.photo, item.name, desc, item.link);
return "<div class='{0} dropdown-item dropdown-notification clearfix' title='{4}'><img class='dropdown-menu-img-sm' src='{1}'><span class='contactname'>{2}</span><span class='dropdown-sub-text'>{3}</span></div>".format(item.taggable, item.photo, item.name, desc, item.link);
}
else
return "<div>" + item.text + "</div>";

View file

@ -369,10 +369,10 @@ function NavUpdate() {
updateCountsOnly = false;
if(data.network || data.home || data.intros || data.mail || data.all_events || data.notify) {
$('#notifications-btn').css('color', 'white').prop('disabled', false);
$('#notifications-btn').removeClass('text-muted').addClass('text-white');
}
else {
$('#notifications-btn').css('color', 'grey').prop('disabled', true);
$('#notifications-btn').removeClass('text-white').addClass('text-muted');
$('#navbar-collapse-1').removeClass('in');
}

View file

@ -7,7 +7,7 @@
</head>
<body <?php if($page['direction']) echo 'dir="rtl"' ?> >
<?php if(x($page,'banner')) echo $page['banner']; ?>
<header class="hidden-md-down"><?php if(x($page,'header')) echo $page['header']; ?></header>
<header><?php if(x($page,'header')) echo $page['header']; ?></header>
<nav class="navbar fixed-top navbar-toggleable-sm navbar-inverse bg-inverse"><?php if(x($page,'nav')) echo $page['nav']; ?></nav>
<main>
<aside id="region_1"><div id="left_aside_spacer"><div id="left_aside_wrapper"><?php if(x($page,'aside')) echo $page['aside']; ?></div></div></aside>

View file

@ -108,34 +108,7 @@ a:focus,
cursor: pointer;
}
input[type="text"],
input[type="password"],
input[type="submit"],
input[type="file"],
select,
textarea {
font-family: sans-serif, arial, freesans;
font-size: $body_font_size;
}
input {
padding: 5px;
line-height: 1.5;
border: 1px solid #ccc;
-moz-border-radius: $radiuspx;
border-radius: $radiuspx;
}
input[type="submit"] {
background-color: #F0F0F0;
font-weight: bold;
color: #0080FF;
text-decoration: none;
padding: 6px 12px;
}
input, optgroup, select, textarea {
color: #333;
resize: vertical;
}
@ -570,24 +543,16 @@ footer {
}
#nav-search-spinner {
float: left;
margin: 25px 0px 0px 25px;
color: $nav_active_icon_colour;
float: right;
margin-top: -0.85rem;
margin-right: 1.1rem;
}
/*
#nav-search-text {
font-size: 12px;
width: 200px;
height: 20px;
margin-right: 15px;
padding: 0px 5px 0px 5px;
border-radius: $radiuspx;
border-color: $nav_bd;
background-color: #eee;
transition: background-color 300ms ease 0s;
width: 280px;
}
*/
#nav-search-text::-webkit-input-placeholder {
font-family: FontAwesome, sans-serif;
}
@ -1535,8 +1500,8 @@ nav img {
}
.usermenu {
width: 2rem;
height: 2rem;
width: 2.2rem;
height: 2.2rem;
}
.usermenu img {

View file

@ -2,7 +2,7 @@
<h3>{{$connect}}</h3>
<form action="follow" method="post" />
<div class="input-group">
<input class="form-control" type="text" name="url" title="{{$hint}}" placeholder="{{$desc}}" />
<input class="form-control form-control-sm" type="text" name="url" title="{{$hint}}" placeholder="{{$desc}}" />
<div class="input-group-btn">
<button class="btn btn-success" type="submit" name="submit" value="{{$follow}}" title="{{$follow}}"><i class="fa fa-fw fa-plus"></i></button>
</div>

View file

@ -1,5 +1,3 @@
<div id="banner" class="hidden-sm hidden-xs">{{$banner}}</div>
<div id="nav-notifications-template" rel="template">
<a class="dropdown-item clearfix dropdown-notification {5}" href="{0}" title="{2} {3}"><img class="dropdown-menu-img-sm" data-src="{1}"><span class="contactname">{2}</span><span class="dropdown-sub-text">{3}<br>{4}</span></a>
</div>

View file

@ -19,11 +19,8 @@
<button id="expand-aside" type="button" class="navbar-toggler border-0" data-toggle="offcanvas" data-target="#region_1">
<i class="fa fa-arrow-circle-right" id="expand-aside-icon"></i>
</button>
<!--button id="expand-tabs" type="button" class="navbar-toggler border-0" data-toggle="collapse" data-target="#tabs-collapse-1">
<i class="fa fa-arrow-circle-down" id="expand-tabs-icon"></i>
</button-->
{{if $localuser}}
<button id="notifications-btn" type="button" class="navbar-toggler border-0" data-toggle="collapse" data-target="#navbar-collapse-1" style="color: grey;">
<button id="notifications-btn" type="button" class="navbar-toggler border-0 text-muted" data-toggle="collapse" data-target="#navbar-collapse-1">
<i class="fa fa-exclamation-circle"></i>
</button>
{{/if}}
@ -171,13 +168,17 @@
{{/if}}
</ul>
<!--div class="navbar-text hidden-lg-down">Hubzilla</div-->
<div class="navbar-text text-white font-weight-bold">{{$banner}}</div>
<ul class="navbar-nav hidden-sm-down ml-auto">
<li class="nav-item">
<ul id="nav-right" class="navbar-nav hidden-sm-down ml-auto">
<li class="nav-item collapse clearfix" id="nav-search">
<form class="form-inline" method="get" action="search" role="search">
<div id="nav-search-spinner"></div><input class="fa-search" id="nav-search-text" type="text" value="" placeholder="&#xf002; {{$help}}" name="search" title="{{$nav.search.3}}" onclick="this.submit();"/>
<input class="form-control form-control-sm mt-1" id="nav-search-text" type="text" value="" placeholder="&#xf002; {{$help}}" name="search" title="{{$nav.search.3}}" onclick="this.submit();" onblur=" $('#nav-search').hide(); $('#nav-search-btn').show();"/>
</form>
<div id="nav-search-spinner"></div>
</li>
<li class="nav-item" id="nav-search-btn">
<a class="nav-link" href="#nav-search" title="{{$nav.search.3}}" onclick="$('#nav-search').show(); $('#nav-search-btn').hide(); $('#nav-search-text').focus(); return false;"><i class="fa fa-fw fa-search"></i></a>
</li>
{{if $nav.help.6}}
<li class="nav-item dropdown {{$sel.help}}">

View file

@ -2,7 +2,7 @@
<h3>{{$findpeople}}</h3>
<form action="directory" method="post" />
<div class="input-group form-group">
<input class="form-control" type="text" name="search" title="{{$hint}}{{if $advanced_search}}{{$advanced_hint}}{{/if}}" placeholder="{{$desc}}" />
<input class="form-control form-control-sm" type="text" name="search" title="{{$hint}}{{if $advanced_search}}{{$advanced_hint}}{{/if}}" placeholder="{{$desc}}" />
<div class="input-group-btn">
<button class="btn btn-outline-secondary" type="submit" name="submit"><i class="fa fa-fw fa-search"></i></button>
</div>

View file

@ -1,7 +1,7 @@
<form action="{{$action_url}}" method="get" >
<input type="hidden" name="f" value="" />
<div id="{{$id}}" class="input-group">
<input class="form-control" type="text" name="search" id="search-text" value="{{$s}}" onclick="this.submit();" />
<input class="form-control form-control-sm" type="text" name="search" id="search-text" value="{{$s}}" onclick="this.submit();" />
<div class="input-group-btn">
<button type="submit" name="submit" class="btn btn-outline-secondary" id="search-submit" value="{{$search_label}}"><i class="fa fa-search"></i></button>
{{if $savedsearch}}