1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 12:12:48 +01:00

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);
});
Form::macro('nav_link', function($url, $text, $url2 = '', $extra = '') {
$capitalize = config('former.capitalize_translations');
Form::macro('nav_link', function($url, $text) {
$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);
}
return '<li'.$class.'><a href="'.URL::to($url).'" '.$extra.'>'.$title.'</a></li>';
$title = trans("texts.$text") . Utils::getProLabel($text);
return '<li'.$class.'><a href="'.URL::to($url).'">'.$title.'</a></li>';
});
Form::macro('tab_link', function($url, $text, $active = false) {
@ -53,41 +49,10 @@ class AppServiceProvider extends ServiceProvider
$Type = ucfirst($type);
$Types = ucfirst($types);
$class = ( Request::is($types) || Request::is('*'.$type.'*')) && !Request::is('*settings*') ? ' active' : '';
$user = Auth::user();
$str = '<li class="dropdown '.$class.'">
<a href="'.URL::to($types).'" class="dropdown-toggle">'.trans("texts.$types").'</a>';
$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;
return '<li class="dropdown '.$class.'">
<a href="'.URL::to($types).'" class="dropdown-toggle">'.trans("texts.$types").'</a>
</li>';
});
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;
}
.navbar-collapse {
background-color: #0b4d78;
}
.navbar,
ul.dropdown-menu,
.twitter-typeahead .tt-menu {

View File

@ -2085,7 +2085,8 @@ $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_update_start' => 'Update now',
'update_invoiceninja_download_start' => 'Download :version',
'create_new' => 'Create New',
);
return $LANG;

View File

@ -7,6 +7,16 @@
<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/)
* Copyright 2013-2016 Start Bootstrap
@ -80,24 +90,32 @@
line-height: 40px;
}
.sidebar-nav li a {
.sidebar-nav li > div {
display: block;
text-decoration: none;
color: #999999;
cursor: pointer;
}
.sidebar-nav li a:hover,
.sidebar-nav li a.active {
.sidebar-nav li > div:hover {
text-decoration: none;
color: #fff;
background: rgba(255,255,255,0.2);
}
.sidebar-nav li a:active,
.sidebar-nav li a:focus {
.sidebar-nav li > div:hover {
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 {
height: 65px;
font-size: 18px;
@ -113,36 +131,31 @@
background: none;
}
@media(min-width:768px) {
#wrapper {
padding-left: 250px;
}
#wrapper.toggled {
padding-left: 0;
}
#sidebar-wrapper {
width: 250px;
}
#wrapper.toggled #sidebar-wrapper {
width: 0;
}
#page-content-wrapper {
padding: 20px;
position: relative;
}
#wrapper.toggled #page-content-wrapper {
position: relative;
margin-right: 0;
}
#wrapper {
padding-left: 250px;
}
#wrapper.toggled {
padding-left: 0;
}
#sidebar-wrapper {
width: 250px;
}
#wrapper.toggled #sidebar-wrapper {
width: 0;
}
#page-content-wrapper {
padding: 20px;
position: relative;
}
#wrapper.toggled #page-content-wrapper {
position: relative;
margin-right: 0;
}
body {
@ -170,12 +183,6 @@
<script type="text/javascript">
function setTheme(id)
{
$('#theme_id').val(id);
$('form.themeForm').submit();
}
@if (!Auth::check() || !Auth::user()->registered)
function validateSignUp(showError)
{
@ -477,6 +484,10 @@
}
});
$("#left-menu-toggle").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
});
});
</script>
@ -485,7 +496,7 @@
@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">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse-1">
@ -495,7 +506,9 @@
<span class="icon-bar"></span>
</button>
<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">
{{-- Per our license, please do not remove or modify this link. --}}
<img src="{{ asset('images/invoiceninja-logo.png') }}" width="193" height="25"/>
@ -504,16 +517,7 @@
</div>
<div class="collapse navbar-collapse" id="navbar-collapse-1">
<ul class="nav navbar-nav hide-non-phone" style="font-weight: bold">
{!! 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">
<div class="navbar-form navbar-right" style="padding-right:30px">
@if (Auth::check())
@if (!Auth::user()->registered)
@ -627,11 +631,18 @@
'settings' => 'cog',
] as $option => $icon)
<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' : '' }}">
<i class="fa fa-{{ $icon }}" style="width:46px; color:white; padding-right:10px"></i>
{{ trans("texts.{$option}")}}
</a>
{{ ($option == 'recurring_invoices') ? trans('texts.recurring') : trans("texts.{$option}") }}
@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>
@endforeach
</ul>
@ -642,8 +653,7 @@
<div id="page-content-wrapper">
<div class="container-fluid">
<br/>
<div class="container">
<div class="xcontainer">
@include('partials.warn_session', ['redirectTo' => '/dashboard'])

View File

@ -35,14 +35,8 @@
<div id="top_right_buttons" class="pull-right">
<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') }}"/>
@if (Auth::user()->hasFeature(FEATURE_QUOTES) && $entityType == ENTITY_INVOICE)
{!! 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)
@if ($entityType == ENTITY_EXPENSE)
{!! 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
@if (Auth::user()->can('create', $entityType))
@ -101,7 +95,7 @@
if (action == 'delete') {
sweetConfirm(function() {
$('#action').val(action);
$('form.listForm').submit();
$('form.listForm').submit();
});
} else {
$('#action').val(action);