Combined search and history in navbar

This commit is contained in:
Hillel Coren 2016-02-17 12:12:39 +02:00
parent 0e2bf3bb88
commit ee516cb327

View File

@ -259,6 +259,7 @@
} }
function showSearch() { function showSearch() {
$('#search').typeahead('setQuery', '');
$('#search-form').show(); $('#search-form').show();
$('#navbar-options').hide(); $('#navbar-options').hide();
if (window.hasOwnProperty('searchData')) { if (window.hasOwnProperty('searchData')) {
@ -289,7 +290,6 @@
} }
function hideSearch() { function hideSearch() {
$('#search').typeahead('setQuery', '');
$('#search-form').hide(); $('#search-form').hide();
$('#navbar-options').show(); $('#navbar-options').show();
} }
@ -331,7 +331,7 @@
showSignUp(); showSignUp();
@endif @endif
$('ul.navbar-settings, ul.navbar-history').hover(function () { $('ul.navbar-settings, ul.navbar-search').hover(function () {
if ($('.user-accounts').css('display') == 'block') { if ($('.user-accounts').css('display') == 'block') {
$('.user-accounts').dropdown('toggle'); $('.user-accounts').dropdown('toggle');
} }
@ -403,7 +403,7 @@
<div class="btn-group user-dropdown"> <div class="btn-group user-dropdown">
<button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"> <button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
<div id="myAccountButton" class="ellipsis" style="max-width:{{ Utils::isPro() && ! Utils::isTrial() ? '100' : '70' }}px"> <div id="myAccountButton" class="ellipsis" style="max-width:{{ Utils::isPro() && ! Utils::isTrial() ? '130' : '100' }}px">
@if (session(SESSION_USER_ACCOUNTS) && count(session(SESSION_USER_ACCOUNTS))) @if (session(SESSION_USER_ACCOUNTS) && count(session(SESSION_USER_ACCOUNTS)))
{{ Auth::user()->account->getDisplayName() }} {{ Auth::user()->account->getDisplayName() }}
@else @else
@ -473,10 +473,10 @@
</ul> </ul>
<ul class="nav navbar-nav navbar-right navbar-history"> <ul class="nav navbar-nav navbar-right navbar-search">
<li class="dropdown"> <li class="dropdown">
<a href="{{ Utils::getLastURL() }}" class="dropdown-toggle"> <a href="#" onclick="showSearch()">
<span class="glyphicon glyphicon-time" title="{{ trans('texts.history') }}"/> <span class="glyphicon glyphicon-search" title="{{ trans('texts.search') }}"/>
</a> </a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
@if (count(Session::get(RECENTLY_VIEWED)) == 0) @if (count(Session::get(RECENTLY_VIEWED)) == 0)
@ -491,19 +491,11 @@
</ul> </ul>
</li> </li>
</ul> </ul>
<ul class="nav navbar-nav navbar-right navbar-settings">
<li class="dropdown">
<a href="#" onclick="showSearch()">
<span class="glyphicon glyphicon-search" title="{{ trans('texts.search') }}"/>
</a>
</li>
</ul>
</div> </div>
<form id="search-form" class="navbar-form navbar-right" role="search" style="display:none"> <form id="search-form" class="navbar-form navbar-right" role="search" style="display:none">
<div class="form-group"> <div class="form-group">
<input type="text" id="search" style="width: 300px;padding-top:0px;padding-bottom:0px" <input type="text" id="search" style="width: 240px;padding-top:0px;padding-bottom:0px"
class="form-control" placeholder="{{ trans('texts.search') }}"> class="form-control" placeholder="{{ trans('texts.search') }}">
</div> </div>
</form> </form>