Working on sidebar

This commit is contained in:
Hillel Coren 2016-08-23 23:20:03 +03:00
parent f021ee11fa
commit d55cdd7619
8 changed files with 186 additions and 151 deletions

View File

@ -257,6 +257,10 @@ class AccountController extends BaseController
*/
public function showSection($section = false)
{
if ( ! Auth::user()->is_admin) {
return Redirect::to('/settings/user_details');
}
if (!$section) {
return Redirect::to('/settings/'.ACCOUNT_COMPANY_DETAILS, 301);
}

View File

@ -354,4 +354,16 @@ class UserController extends BaseController
return View::make('users.account_management');
}
public function saveSidebarState()
{
if (Input::has('show_left')) {
Session::put(SESSION_LEFT_SIDEBAR, boolval(Input::get('show_left')));
}
if (Input::has('show_right')) {
Session::put(SESSION_RIGHT_SIDEBAR, boolval(Input::get('show_right')));
}
return Session::get(SESSION_LEFT_SIDEBAR) ? 'true' : 'false';
}
}

View File

@ -128,6 +128,7 @@ Route::group(['middleware' => 'auth:user'], function() {
Route::get('force_inline_pdf', 'UserController@forcePDFJS');
Route::get('account/get_search_data', ['as' => 'get_search_data', 'uses' => 'AccountController@getSearchData']);
Route::get('check_invoice_number/{invoice_number}', 'InvoiceController@checkInvoiceNumber');
Route::get('save_sidebar_state', 'UserController@saveSidebarState');
Route::get('settings/user_details', 'AccountController@showUserDetails');
Route::post('settings/user_details', 'AccountController@saveUserDetails');
@ -153,6 +154,7 @@ Route::group(['middleware' => 'auth:user'], function() {
Route::get('invoices/create/{client_id?}', 'InvoiceController@create');
Route::get('recurring_invoices/create/{client_id?}', 'InvoiceController@createRecurring');
Route::get('recurring_invoices', 'RecurringInvoiceController@index');
Route::get('recurring_invoices/{invoices}/edit', 'InvoiceController@edit');
Route::get('invoices/{invoices}/clone', 'InvoiceController@cloneInvoice');
Route::post('invoices/bulk', 'InvoiceController@bulk');
Route::post('recurring_invoices/bulk', 'InvoiceController@bulk');
@ -242,7 +244,6 @@ Route::group([
Route::post('settings/change_plan', 'AccountController@changePlan');
Route::post('settings/cancel_account', 'AccountController@cancelAccount');
Route::post('settings/company_details', 'AccountController@updateDetails');
Route::get('settings/{section?}', 'AccountController@showSection');
Route::post('settings/{section?}', 'AccountController@doSection');
Route::post('user/setTheme', 'UserController@setTheme');
@ -270,6 +271,10 @@ Route::group([
Route::get('self-update/download', 'SelfUpdateController@download');
});
Route::group(['middleware' => 'auth:user'], function() {
Route::get('settings/{section?}', 'AccountController@showSection');
});
// Route groups for API
Route::group(['middleware' => 'api', 'prefix' => 'api/v1'], function()
{
@ -548,6 +553,8 @@ if (!defined('CONTACT_EMAIL')) {
define('SESSION_LOCALE', 'sessionLocale');
define('SESSION_USER_ACCOUNTS', 'userAccounts');
define('SESSION_REFERRAL_CODE', 'referralCode');
define('SESSION_LEFT_SIDEBAR', 'showLeftSidebar');
define('SESSION_RIGHT_SIDEBAR', 'showRightSidebar');
define('SESSION_LAST_REQUEST_PAGE', 'SESSION_LAST_REQUEST_PAGE');
define('SESSION_LAST_REQUEST_TIME', 'SESSION_LAST_REQUEST_TIME');

View File

@ -131,7 +131,12 @@ class Invoice extends EntityModel implements BalanceAffecting
*/
public function getRoute()
{
if ($this->is_recurring) {
$entityType = 'recurring_invoice';
} else {
$entityType = $this->getEntityType();
}
return "/{$entityType}s/{$this->public_id}/edit";
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -796,6 +796,7 @@ box-shadow: 0px 0px 15px 0px rgba(0, 5, 5, 0.2);
.form-padding-right {
padding-right: 40px;
}
.hide-non-phone {
display: none;
}
@ -817,29 +818,6 @@ box-shadow: 0px 0px 15px 0px rgba(0, 5, 5, 0.2);
}
}
/* Style to fix navigation by show icon instead of name */
@media only screen and (min-width : 1200px) {
.nav-account-icon {
display: none;
}
}
@media only screen and (max-width : 992px) {
.nav-account-icon {
display: none;
}
}
@media only screen and (max-width : 1200px) and (min-width: 992px) {
.nav-account-name {
display: none;
}
}
@media (max-width: 992px) {
.hide-phone {
display: none !important;
}
}
@media (max-width: 767px) {
.test-class{color:black;}
@ -857,6 +835,10 @@ box-shadow: 0px 0px 15px 0px rgba(0, 5, 5, 0.2);
.plans-table .cell div:first-child {margin-bottom: 5px;}
.plans-table .cell .cta {margin-bottom: 0 !important;}
.plans-table .pro {margin-top: 40px;}
.hide-phone {
display: none;
}
}
label[for=recommendedGateway_id2].radio{

View File

@ -97,7 +97,8 @@
cursor: pointer;
}
.sidebar-nav li > div:hover {
.sidebar-nav li > div:hover,
.sidebar-nav li > div.active {
text-decoration: none;
color: #fff;
background: rgba(255,255,255,0.2);
@ -131,6 +132,7 @@
background: none;
}
@media(min-width:768px) {
#wrapper {
padding-left: 250px;
}
@ -156,7 +158,7 @@
position: relative;
margin-right: 0;
}
}
body {
background-color: #EEEEEE;
@ -357,12 +359,12 @@
}
window.loadedSearchData = false;
function showSearch() {
function onSearchFocus() {
$('#search').typeahead('val', '');
$('#search-form').show();
$('#search').focus();
if (!window.loadedSearchData) {
window.loadedSearchData = true;
trackEvent('/activity', '/search');
var request = $.get('{{ URL::route('get_search_data') }}', function(data) {
$('#search').typeahead({
@ -405,7 +407,6 @@
).on('typeahead:selected', function(element, datum, name) {
window.location = datum.url;
}).focus();
window.loadedSearchData = true;
});
request.error(function(httpObj, textStatus) {
@ -477,17 +478,23 @@
@endif
// Focus the search input if the user clicks forward slash
$('#search').focusin(onSearchFocus);
$('body').keypress(function(event) {
if (event.which == 47 && !$('*:focus').length) {
event.preventDefault();
showSearch();
$('#search').focus();
}
});
// manage sidebar state
$("#left-menu-toggle").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
var toggled = $("#wrapper").hasClass("toggled") ? '1' : '0';
$.get('{{ url('save_sidebar_state') }}?show_left=' + toggled);
});
});
</script>
@ -506,8 +513,8 @@
<span class="icon-bar"></span>
</button>
<div class="navbar-brand">
<a href="#" id="left-menu-toggle" class="menu-toggle">
<i class="fa fa-bars" style="width:30px;padding-right:10px"> </i>
<a href="#" id="left-menu-toggle" class="menu-toggle hide-phone">
<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. --}}
@ -529,7 +536,7 @@
<div class="btn-group user-dropdown">
<button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
<div id="myAccountButton" class="ellipsis nav-account-name" style="max-width:{{ Utils::hasFeature(FEATURE_USERS) ? '130' : '100' }}px;">
<div id="myAccountButton" class="ellipsis" style="max-width:{{ Utils::hasFeature(FEATURE_USERS) ? '130' : '100' }}px;">
@if (session(SESSION_USER_ACCOUNTS) && count(session(SESSION_USER_ACCOUNTS)))
{{ Auth::user()->account->getDisplayName() }}
@else
@ -537,8 +544,6 @@
@endif
<span class="caret"></span>
</div>
<span class="glyphicon glyphicon-user nav-account-icon" style="padding-left:0px"
title="{{ Auth::user()->account->getDisplayName() }}"/>
</button>
<ul class="dropdown-menu user-accounts">
@if (session(SESSION_USER_ACCOUNTS))
@ -586,7 +591,9 @@
</ul>
</div>
<i class="fa fa-bars" style="color:white; width:30px; padding-left:14px"></i>
<a href="#" id="left-menu-toggle" class="menu-toggle hide-phone">
<i class="fa fa-bars" style="width:30px;padding-left:14px"></i>
</a>
</div>
@ -609,10 +616,28 @@
</ul>
@endif
<ul class="nav navbar-nav hide-non-phone" style="font-weight: bold">
@foreach ([
'dashboard' => false,
'clients' => false,
'credits' => false,
'tasks' => false,
'expenses' => false,
'vendors' => false,
'quotes' => false,
'invoices' => false,
'recurring_invoices' => 'recurring',
'payments' => false,
'settings' => false,
] as $key => $value)
{!! Form::nav_link($key, $value ?: $key) !!}
@endforeach
</ul>
</div><!-- /.navbar-collapse -->
</nav>
<div id="wrapper">
<div id="wrapper" {!! session(SESSION_LEFT_SIDEBAR) ? 'class="toggled"' : '' !!}>
<!-- Sidebar -->
<div id="sidebar-wrapper">
@ -620,14 +645,14 @@
@foreach([
'dashboard' => 'tachometer',
'clients' => 'users',
'invoices' => 'file-pdf-o',
'payments' => 'credit-card',
'recurring_invoices' => 'files-o',
'credits' => 'credit-card',
'quotes' => 'file-text-o',
'tasks' => 'clock-o',
'expenses' => 'file-image-o',
'vendors' => 'building',
'quotes' => 'file-text-o',
'invoices' => 'file-pdf-o',
'recurring_invoices' => 'files-o',
'payments' => 'credit-card',
'settings' => 'cog',
] as $option => $icon)
<li style="border-bottom:solid 1px">
@ -637,11 +662,13 @@
<i class="fa fa-{{ $icon }}" style="width:46px; color:white; padding-right:10px"></i>
{{ ($option == 'recurring_invoices') ? trans('texts.recurring') : trans("texts.{$option}") }}
@if ($option != 'dashboard' && $option != 'settings')
@if (Auth::user()->can('create', substr($option, 0, -1)))
<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
@endif
</div>
</li>
@endforeach
@ -653,8 +680,6 @@
<div id="page-content-wrapper">
<div class="container-fluid">
<div class="xcontainer">
@include('partials.warn_session', ['redirectTo' => '/dashboard'])
@if (Session::has('warning'))
@ -682,12 +707,67 @@
@yield('content')
<div class="row">
<div class="col-md-12">
@if (Utils::isNinjaProd())
@if (Auth::check() && Auth::user()->isTrial())
{!! trans(Auth::user()->account->getCountTrialDaysLeft() == 0 ? 'texts.trial_footer_last_day' : 'texts.trial_footer', [
'count' => Auth::user()->account->getCountTrialDaysLeft(),
'link' => link_to('/settings/account_management?upgrade=true', trans('texts.click_here'))
]) !!}
@endif
@else
{{ trans('texts.powered_by') }}
{{-- Per our license, please do not remove or modify this section. --}}
{!! link_to('https://www.invoiceninja.com/?utm_source=powered_by', 'InvoiceNinja.com', ['target' => '_blank', 'title' => 'invoiceninja.com']) !!} -
{!! link_to(RELEASES_URL, 'v' . NINJA_VERSION, ['target' => '_blank', 'title' => trans('texts.trello_roadmap')]) !!} |
@if (Auth::user()->account->hasFeature(FEATURE_WHITE_LABEL))
{{ trans('texts.white_labeled') }}
@else
<a href="#" onclick="loadImages('#whiteLabelModal');$('#whiteLabelModal').modal('show');">{{ trans('texts.white_label_link') }}</a>
<div class="modal fade" id="whiteLabelModal" tabindex="-1" role="dialog" aria-labelledby="whiteLabelModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">{{ trans('texts.white_label_header') }}</h4>
</div>
<div class="panel-body">
<p>{{ trans('texts.white_label_text', ['price' => WHITE_LABEL_PRICE])}}</p>
<div class="row">
<div class="col-md-6">
<h4>{{ trans('texts.before') }}</h4>
<img src="{{ BLANK_IMAGE }}" data-src="{{ asset('images/pro_plan/white_label_before.png') }}" width="100%" alt="before">
</div>
<div class="col-md-6">
<h4>{{ trans('texts.after') }}</h4>
<img src="{{ BLANK_IMAGE }}" data-src="{{ asset('images/pro_plan/white_label_after.png') }}" width="100%" alt="after">
</div>
</div>
</div>
<div class="modal-footer" id="signUpFooter" style="margin-top: 0px">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.close') }} </button>
{{-- DropdownButton::success_lg(trans('texts.buy'), [
['url' => URL::to(""), 'label' => trans('texts.pay_with_paypal')],
['url' => URL::to(""), 'label' => trans('texts.pay_with_card')]
])->addClass('btn-lg') --}}
<button type="button" class="btn btn-primary" onclick="buyProduct('{{ WHITE_LABEL_AFFILIATE_KEY }}', '{{ PRODUCT_WHITE_LABEL }}')">{{ trans('texts.buy') }} </button>
</div>
</div>
</div>
</div>
@endif
</div>
@endif
</div>
</div>
</div>
<!-- /#page-content-wrapper -->
</div>
@ -827,61 +907,6 @@
@endif
</div>
<br/>
<div class="container">
@if (Utils::isNinjaProd())
@if (Auth::check() && Auth::user()->isTrial())
{!! trans(Auth::user()->account->getCountTrialDaysLeft() == 0 ? 'texts.trial_footer_last_day' : 'texts.trial_footer', [
'count' => Auth::user()->account->getCountTrialDaysLeft(),
'link' => link_to('/settings/account_management?upgrade=true', trans('texts.click_here'))
]) !!}
@endif
@else
{{ trans('texts.powered_by') }}
{{-- Per our license, please do not remove or modify this section. --}}
{!! link_to('https://www.invoiceninja.com/?utm_source=powered_by', 'InvoiceNinja.com', ['target' => '_blank', 'title' => 'invoiceninja.com']) !!} -
{!! link_to(RELEASES_URL, 'v' . NINJA_VERSION, ['target' => '_blank', 'title' => trans('texts.trello_roadmap')]) !!} |
@if (Auth::user()->account->hasFeature(FEATURE_WHITE_LABEL))
{{ trans('texts.white_labeled') }}
@else
<a href="#" onclick="loadImages('#whiteLabelModal');$('#whiteLabelModal').modal('show');">{{ trans('texts.white_label_link') }}</a>
<div class="modal fade" id="whiteLabelModal" tabindex="-1" role="dialog" aria-labelledby="whiteLabelModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">{{ trans('texts.white_label_header') }}</h4>
</div>
<div class="panel-body">
<p>{{ trans('texts.white_label_text', ['price' => WHITE_LABEL_PRICE])}}</p>
<div class="row">
<div class="col-md-6">
<h4>{{ trans('texts.before') }}</h4>
<img src="{{ BLANK_IMAGE }}" data-src="{{ asset('images/pro_plan/white_label_before.png') }}" width="100%" alt="before">
</div>
<div class="col-md-6">
<h4>{{ trans('texts.after') }}</h4>
<img src="{{ BLANK_IMAGE }}" data-src="{{ asset('images/pro_plan/white_label_after.png') }}" width="100%" alt="after">
</div>
</div>
</div>
<div class="modal-footer" id="signUpFooter" style="margin-top: 0px">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.close') }} </button>
{{-- DropdownButton::success_lg(trans('texts.buy'), [
['url' => URL::to(""), 'label' => trans('texts.pay_with_paypal')],
['url' => URL::to(""), 'label' => trans('texts.pay_with_card')]
])->addClass('btn-lg') --}}
<button type="button" class="btn btn-primary" onclick="buyProduct('{{ WHITE_LABEL_AFFILIATE_KEY }}', '{{ PRODUCT_WHITE_LABEL }}')">{{ trans('texts.buy') }} </button>
</div>
</div>
</div>
</div>
@endif
</div>
@endif
<p>&nbsp;</p>