Improved history feature

This commit is contained in:
Hillel Coren 2015-11-11 18:24:48 +02:00
parent 6ae83e8469
commit 933b94e8b5
9 changed files with 30 additions and 10 deletions

View File

@ -127,6 +127,19 @@ class Utils
return $response;
}
public static function getLastURL()
{
if (!count(Session::get(RECENTLY_VIEWED))) {
return '#';
}
$history = Session::get(RECENTLY_VIEWED);
$last = $history[0];
$penultimate = count($history) > 1 ? $history[1] : $last;
return Request::url() == $last->url ? $penultimate->url : $last->url;
}
public static function getProLabel($feature)
{
if (Auth::check()
@ -394,12 +407,8 @@ class Utils
continue;
}
// temporary fix to check for new property in session
if (!property_exists($item, 'accountId')) {
continue;
}
array_push($data, $item);
array_unshift($data, $item);
if (isset($counts[$item->accountId])) {
$counts[$item->accountId]++;
} else {

View File

@ -336,7 +336,7 @@ class Account extends Eloquent
if (strstr($pattern, '{$userId}')) {
$search[] = '{$userId}';
$replace[] = str_pad($invoice->user->public_id, 2, '0', STR_PAD_LEFT);
$replace[] = str_pad(($invoice->user->public_id + 1), 2, '0', STR_PAD_LEFT);
}
$matches = false;

View File

@ -33,7 +33,7 @@ class AppServiceProvider extends ServiceProvider {
$types = $type.'s';
$Type = ucfirst($type);
$Types = ucfirst($types);
$class = ( Request::is($types) || Request::is('*'.$type.'*')) && !Request::is('*advanced_settings*') ? ' active' : '';
$class = ( Request::is($types) || Request::is('*'.$type.'*')) && !Request::is('*settings*') ? ' active' : '';
$str = '<li class="dropdown '.$class.'">
<a href="'.URL::to($types).'" class="dropdown-toggle">'.trans("texts.$types").'</a>

View File

@ -3269,7 +3269,7 @@ div.dataTables_length label {
a .glyphicon,
button .glyphicon {
padding-left: 8px;
padding-left: 12px;
}
.pro-plan-modal {

View File

@ -918,7 +918,7 @@ div.dataTables_length label {
a .glyphicon,
button .glyphicon {
padding-left: 8px;
padding-left: 12px;
}
.pro-plan-modal {

View File

@ -31572,6 +31572,7 @@ function truncate(string, length){
}
};
// Show/hide the 'Select' option in the datalists
function actionListHandler() {
$('tbody tr').mouseover(function() {
$(this).closest('tr').find('.tr-action').css('display', 'inline-block');

View File

@ -1694,6 +1694,7 @@ function truncate(string, length){
}
};
// Show/hide the 'Select' option in the datalists
function actionListHandler() {
$('tbody tr').mouseover(function() {
$(this).closest('tr').find('.tr-action').css('display', 'inline-block');

View File

@ -304,6 +304,15 @@
$('.primaryDropDown:not(.dropdown-toggle)').click(function() {
window.location = '{{ URL::to('invoices/create/' . $client->public_id ) }}';
});
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
var target = $(e.target).attr("href") // activated tab
localStorage.setItem('client_tab', target);
});
var tab = localStorage.getItem('client_tab');
if (tab) {
$('.nav-tabs a[href="' + tab + '"]').tab('show');
}
});
function onArchiveClick() {

View File

@ -462,7 +462,7 @@
<ul class="nav navbar-nav navbar-right navbar-history">
<li class="dropdown">
<a href="{{ count(Session::get(RECENTLY_VIEWED)) ? Session::get(RECENTLY_VIEWED)[0]->url : '#' }}" class="dropdown-toggle">
<a href="{{ Utils::getLastURL() }}" class="dropdown-toggle">
<span class="glyphicon glyphicon-time" title="{{ trans('texts.history') }}"/>
</a>
<ul class="dropdown-menu">