Working on nav sidebar

This commit is contained in:
Hillel Coren 2016-08-23 20:28:45 +03:00
parent 48ab77a93e
commit f021ee11fa
7 changed files with 81 additions and 107 deletions

View File

@ -32,15 +32,11 @@ class AppServiceProvider extends ServiceProvider
return 'data:image/jpeg;base64,' . base64_encode($contents); return 'data:image/jpeg;base64,' . base64_encode($contents);
}); });
Form::macro('nav_link', function($url, $text, $url2 = '', $extra = '') { Form::macro('nav_link', function($url, $text) {
$capitalize = config('former.capitalize_translations');
$class = ( Request::is($url) || Request::is($url.'/*') || Request::is($url2.'/*') ) ? ' class="active"' : ''; $class = ( Request::is($url) || Request::is($url.'/*') || Request::is($url2.'/*') ) ? ' class="active"' : '';
if ($capitalize) {
$title = ucwords(trans("texts.$text")) . Utils::getProLabel($text);
} else {
$title = trans("texts.$text") . Utils::getProLabel($text); $title = trans("texts.$text") . Utils::getProLabel($text);
}
return '<li'.$class.'><a href="'.URL::to($url).'" '.$extra.'>'.$title.'</a></li>'; return '<li'.$class.'><a href="'.URL::to($url).'">'.$title.'</a></li>';
}); });
Form::macro('tab_link', function($url, $text, $active = false) { Form::macro('tab_link', function($url, $text, $active = false) {
@ -53,41 +49,10 @@ class AppServiceProvider extends ServiceProvider
$Type = ucfirst($type); $Type = ucfirst($type);
$Types = ucfirst($types); $Types = ucfirst($types);
$class = ( Request::is($types) || Request::is('*'.$type.'*')) && !Request::is('*settings*') ? ' active' : ''; $class = ( Request::is($types) || Request::is('*'.$type.'*')) && !Request::is('*settings*') ? ' active' : '';
$user = Auth::user();
$str = '<li class="dropdown '.$class.'"> return '<li class="dropdown '.$class.'">
<a href="'.URL::to($types).'" class="dropdown-toggle">'.trans("texts.$types").'</a>'; <a href="'.URL::to($types).'" class="dropdown-toggle">'.trans("texts.$types").'</a>
</li>';
$items = [];
if ($user->can('create', $type)) {
$items[] = '<li><a href="'.URL::to($types.'/create').'">'.trans("texts.new_$type").'</a></li>';
}
if ($type == ENTITY_INVOICE) {
if(!empty($items))$items[] = '<li class="divider"></li>';
$items[] = '<li><a href="'.URL::to('recurring_invoices').'">'.trans('texts.recurring_invoices').'</a></li>';
if($user->can('create', ENTITY_INVOICE))$items[] = '<li><a href="'.URL::to('recurring_invoices/create').'">'.trans('texts.new_recurring_invoice').'</a></li>';
$items[] = '<li class="divider"></li>';
$items[] = '<li><a href="'.URL::to('quotes').'">'.trans('texts.quotes').'</a></li>';
if($user->can('create', ENTITY_QUOTE))$items[] = '<li><a href="'.URL::to('quotes/create').'">'.trans('texts.new_quote').'</a></li>';
} else if ($type == ENTITY_CLIENT) {
if(!empty($items))$items[] = '<li class="divider"></li>';
$items[] = '<li><a href="'.URL::to('credits').'">'.trans('texts.credits').'</a></li>';
if($user->can('create', ENTITY_CREDIT))$items[] = '<li><a href="'.URL::to('credits/create').'">'.trans('texts.new_credit').'</a></li>';
} else if ($type == ENTITY_EXPENSE) {
if(!empty($items))$items[] = '<li class="divider"></li>';
$items[] = '<li><a href="'.URL::to('vendors').'">'.trans('texts.vendors').'</a></li>';
if($user->can('create', ENTITY_VENDOR))$items[] = '<li><a href="'.URL::to('vendors/create').'">'.trans('texts.new_vendor').'</a></li>';
}
if(!empty($items)){
$str.= '<ul class="dropdown-menu" id="menu1">'.implode($items).'</ul>';
}
$str .= '</li>';
return $str;
}); });
Form::macro('flatButton', function($label, $color) { Form::macro('flatButton', function($label, $color) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -403,6 +403,10 @@ font-weight: bold;
filter: none; filter: none;
} }
.navbar-collapse {
background-color: #0b4d78;
}
.navbar, .navbar,
ul.dropdown-menu, ul.dropdown-menu,
.twitter-typeahead .tt-menu { .twitter-typeahead .tt-menu {

View File

@ -2085,6 +2085,7 @@ $LANG = array(
'update_invoiceninja_decide_update_download' => 'You can decide to update directly to :version or to just download the new relase and update later.', 'update_invoiceninja_decide_update_download' => 'You can decide to update directly to :version or to just download the new relase and update later.',
'update_invoiceninja_update_start' => 'Update now', 'update_invoiceninja_update_start' => 'Update now',
'update_invoiceninja_download_start' => 'Download :version', 'update_invoiceninja_download_start' => 'Download :version',
'create_new' => 'Create New',
); );

View File

@ -7,6 +7,16 @@
<style type="text/css"> <style type="text/css">
.menu-toggle {
color: #999 !important;
text-decoration: none;
}
.menu-toggle:hover {
color: #fff !important;
text-decoration: none;
}
/*! /*!
* Start Bootstrap - Simple Sidebar (http://startbootstrap.com/) * Start Bootstrap - Simple Sidebar (http://startbootstrap.com/)
* Copyright 2013-2016 Start Bootstrap * Copyright 2013-2016 Start Bootstrap
@ -80,24 +90,32 @@
line-height: 40px; line-height: 40px;
} }
.sidebar-nav li a { .sidebar-nav li > div {
display: block; display: block;
text-decoration: none; text-decoration: none;
color: #999999; color: #999999;
cursor: pointer;
} }
.sidebar-nav li a:hover, .sidebar-nav li > div:hover {
.sidebar-nav li a.active {
text-decoration: none; text-decoration: none;
color: #fff; color: #fff;
background: rgba(255,255,255,0.2); background: rgba(255,255,255,0.2);
} }
.sidebar-nav li a:active, .sidebar-nav li > div:hover {
.sidebar-nav li a:focus {
text-decoration: none; text-decoration: none;
} }
.sidebar-nav li > div > div.btn {
display: none;
}
.sidebar-nav li > div.hover > div.btn,
.sidebar-nav li > div:hover > div.btn {
display: block;
}
.sidebar-nav > .sidebar-brand { .sidebar-nav > .sidebar-brand {
height: 65px; height: 65px;
font-size: 18px; font-size: 18px;
@ -113,7 +131,6 @@
background: none; background: none;
} }
@media(min-width:768px) {
#wrapper { #wrapper {
padding-left: 250px; padding-left: 250px;
} }
@ -139,10 +156,6 @@
position: relative; position: relative;
margin-right: 0; margin-right: 0;
} }
}
body { body {
@ -170,12 +183,6 @@
<script type="text/javascript"> <script type="text/javascript">
function setTheme(id)
{
$('#theme_id').val(id);
$('form.themeForm').submit();
}
@if (!Auth::check() || !Auth::user()->registered) @if (!Auth::check() || !Auth::user()->registered)
function validateSignUp(showError) function validateSignUp(showError)
{ {
@ -477,6 +484,10 @@
} }
}); });
$("#left-menu-toggle").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
});
}); });
</script> </script>
@ -485,7 +496,7 @@
@section('body') @section('body')
<nav class="navbar navbar-default navbar-fixed-top" role="navigation" style="padding-right:30px; height:60px;"> <nav class="navbar navbar-default navbar-fixed-top" role="navigation" style="height:60px;">
<div class="navbar-header"> <div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse-1"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse-1">
@ -495,7 +506,9 @@
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> </button>
<div class="navbar-brand"> <div class="navbar-brand">
<i class="fa fa-bars" style="color:white; width:30px"></i> <a href="#" id="left-menu-toggle" class="menu-toggle">
<i class="fa fa-bars" style="width:30px;padding-right:10px"> </i>
</a>
<a href="{{ URL::to(NINJA_WEB_URL) }}" target="_blank"> <a href="{{ URL::to(NINJA_WEB_URL) }}" target="_blank">
{{-- Per our license, please do not remove or modify this link. --}} {{-- Per our license, please do not remove or modify this link. --}}
<img src="{{ asset('images/invoiceninja-logo.png') }}" width="193" height="25"/> <img src="{{ asset('images/invoiceninja-logo.png') }}" width="193" height="25"/>
@ -504,16 +517,7 @@
</div> </div>
<div class="collapse navbar-collapse" id="navbar-collapse-1"> <div class="collapse navbar-collapse" id="navbar-collapse-1">
<ul class="nav navbar-nav hide-non-phone" style="font-weight: bold"> <div class="navbar-form navbar-right" style="padding-right:30px">
{!! Form::nav_link('dashboard', 'dashboard') !!}
{!! Form::menu_link('client') !!}
{!! Form::menu_link('task') !!}
{!! Form::menu_link('expense') !!}
{!! Form::menu_link('invoice') !!}
{!! Form::menu_link('payment') !!}
</ul>
<div class="navbar-form navbar-right">
@if (Auth::check()) @if (Auth::check())
@if (!Auth::user()->registered) @if (!Auth::user()->registered)
@ -627,11 +631,18 @@
'settings' => 'cog', 'settings' => 'cog',
] as $option => $icon) ] as $option => $icon)
<li style="border-bottom:solid 1px"> <li style="border-bottom:solid 1px">
<a href="{{ url($option) }}" style="font-size:16px; padding-top:6px; padding-bottom:6px" <div onclick="location.href='{{ url($option == 'recurring' ? 'recurring_invoice' : $option) }}'"
style="font-size:16px; padding-top:6px; padding-bottom:6px"
class="{{ Request::is("{$option}*") ? 'active' : '' }}"> class="{{ Request::is("{$option}*") ? 'active' : '' }}">
<i class="fa fa-{{ $icon }}" style="width:46px; color:white; padding-right:10px"></i> <i class="fa fa-{{ $icon }}" style="width:46px; color:white; padding-right:10px"></i>
{{ trans("texts.{$option}")}} {{ ($option == 'recurring_invoices') ? trans('texts.recurring') : trans("texts.{$option}") }}
</a> @if ($option != 'dashboard' && $option != 'settings')
<div type="button" class="btn btn-primary btn-sm pull-right" style="margin-top:5px;margin-right:10px;text-indent:0px"
onclick="event.cancelBubble = true;if(event.stopPropagation) event.stopPropagation();location.href='{{ url("/{$option}/create") }}'">
<i class="fa fa-plus-circle" style="color:white;width:20px" title="{{ trans('texts.create_new') }}"></i>
</div>
@endif
</div>
</li> </li>
@endforeach @endforeach
</ul> </ul>
@ -642,8 +653,7 @@
<div id="page-content-wrapper"> <div id="page-content-wrapper">
<div class="container-fluid"> <div class="container-fluid">
<br/> <div class="xcontainer">
<div class="container">
@include('partials.warn_session', ['redirectTo' => '/dashboard']) @include('partials.warn_session', ['redirectTo' => '/dashboard'])

View File

@ -35,14 +35,8 @@
<div id="top_right_buttons" class="pull-right"> <div id="top_right_buttons" class="pull-right">
<input id="tableFilter" type="text" style="width:140px;margin-right:17px;background-color: white !important" <input id="tableFilter" type="text" style="width:140px;margin-right:17px;background-color: white !important"
class="form-control pull-left" placeholder="{{ trans('texts.filter') }}" value="{{ Input::get('filter') }}"/> class="form-control pull-left" placeholder="{{ trans('texts.filter') }}" value="{{ Input::get('filter') }}"/>
@if (Auth::user()->hasFeature(FEATURE_QUOTES) && $entityType == ENTITY_INVOICE) @if ($entityType == ENTITY_EXPENSE)
{!! Button::normal(trans('texts.quotes'))->asLinkTo(URL::to('/quotes'))->appendIcon(Icon::create('list')) !!}
{!! Button::normal(trans('texts.recurring'))->asLinkTo(URL::to('/recurring_invoices'))->appendIcon(Icon::create('list')) !!}
@elseif ($entityType == ENTITY_EXPENSE)
{!! Button::normal(trans('texts.categories'))->asLinkTo(URL::to('/expense_categories'))->appendIcon(Icon::create('list')) !!} {!! Button::normal(trans('texts.categories'))->asLinkTo(URL::to('/expense_categories'))->appendIcon(Icon::create('list')) !!}
{!! Button::normal(trans('texts.vendors'))->asLinkTo(URL::to('/vendors'))->appendIcon(Icon::create('list')) !!}
@elseif ($entityType == ENTITY_CLIENT)
{!! Button::normal(trans('texts.credits'))->asLinkTo(URL::to('/credits'))->appendIcon(Icon::create('list')) !!}
@endif @endif
@if (Auth::user()->can('create', $entityType)) @if (Auth::user()->can('create', $entityType))