mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix more redirections.
This commit is contained in:
parent
83f32478fa
commit
a80b7aac6c
@ -10,7 +10,7 @@ use Preferences;
|
|||||||
use Redirect;
|
use Redirect;
|
||||||
use Session;
|
use Session;
|
||||||
use View;
|
use View;
|
||||||
|
use URL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CurrencyController
|
* Class CurrencyController
|
||||||
@ -39,6 +39,12 @@ class CurrencyController extends Controller
|
|||||||
$subTitleIcon = 'fa-plus';
|
$subTitleIcon = 'fa-plus';
|
||||||
$subTitle = 'Create a new currency';
|
$subTitle = 'Create a new currency';
|
||||||
|
|
||||||
|
// put previous url in session if not redirect from store (not "create another").
|
||||||
|
if (Session::get('currency.create.fromStore') !== true) {
|
||||||
|
Session::put('currency.create.url', URL::previous());
|
||||||
|
}
|
||||||
|
Session::forget('currency.create.fromStore');
|
||||||
|
|
||||||
return view('currency.create', compact('subTitleIcon', 'subTitle'));
|
return view('currency.create', compact('subTitleIcon', 'subTitle'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,6 +78,9 @@ class CurrencyController extends Controller
|
|||||||
if ($currency->transactionJournals()->count() > 0) {
|
if ($currency->transactionJournals()->count() > 0) {
|
||||||
Session::flash('error', 'Cannot delete ' . e($currency->name) . ' because there are still transactions attached to it.');
|
Session::flash('error', 'Cannot delete ' . e($currency->name) . ' because there are still transactions attached to it.');
|
||||||
|
|
||||||
|
// put previous url in session
|
||||||
|
Session::put('currency.delete.url', URL::previous());
|
||||||
|
|
||||||
return Redirect::route('currency.index');
|
return Redirect::route('currency.index');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +105,7 @@ class CurrencyController extends Controller
|
|||||||
|
|
||||||
$currency->delete();
|
$currency->delete();
|
||||||
|
|
||||||
return Redirect::route('currency.index');
|
return Redirect::to(Session::get('currency.delete.url'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -110,6 +119,12 @@ class CurrencyController extends Controller
|
|||||||
$subTitle = 'Edit currency "' . e($currency->name) . '"';
|
$subTitle = 'Edit currency "' . e($currency->name) . '"';
|
||||||
$currency->symbol = htmlentities($currency->symbol);
|
$currency->symbol = htmlentities($currency->symbol);
|
||||||
|
|
||||||
|
// put previous url in session if not redirect from store (not "return_to_edit").
|
||||||
|
if (Session::get('currency.edit.fromUpdate') !== true) {
|
||||||
|
Session::put('currency.edit.url', URL::previous());
|
||||||
|
}
|
||||||
|
Session::forget('currency.edit.fromUpdate');
|
||||||
|
|
||||||
return view('currency.edit', compact('currency', 'subTitle', 'subTitleIcon'));
|
return view('currency.edit', compact('currency', 'subTitle', 'subTitleIcon'));
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -148,10 +163,12 @@ class CurrencyController extends Controller
|
|||||||
Session::flash('success', 'Currency "' . $currency->name . '" created');
|
Session::flash('success', 'Currency "' . $currency->name . '" created');
|
||||||
|
|
||||||
if (intval(Input::get('create_another')) === 1) {
|
if (intval(Input::get('create_another')) === 1) {
|
||||||
|
Session::put('currency.create.fromStore', true);
|
||||||
return Redirect::route('currency.create')->withInput();
|
return Redirect::route('currency.create')->withInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Redirect::route('currency.index');
|
// redirect to previous URL.
|
||||||
|
return Redirect::to(Session::get('categories.create.url'));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -173,10 +190,12 @@ class CurrencyController extends Controller
|
|||||||
|
|
||||||
|
|
||||||
if (intval(Input::get('return_to_edit')) === 1) {
|
if (intval(Input::get('return_to_edit')) === 1) {
|
||||||
|
Session::put('currency.edit.fromUpdate', true);
|
||||||
return Redirect::route('currency.edit', $currency->id);
|
return Redirect::route('currency.edit', $currency->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Redirect::route('currency.index');
|
// redirect to previous URL.
|
||||||
|
return Redirect::to(Session::get('currency.edit.url'));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ use Redirect;
|
|||||||
use Session;
|
use Session;
|
||||||
use Steam;
|
use Steam;
|
||||||
use View;
|
use View;
|
||||||
|
use URL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class PiggyBankController
|
* Class PiggyBankController
|
||||||
@ -49,9 +50,6 @@ class PiggyBankController extends Controller
|
|||||||
$leftToSave = $piggyBank->targetamount - $savedSoFar;
|
$leftToSave = $piggyBank->targetamount - $savedSoFar;
|
||||||
$maxAmount = min($leftOnAccount, $leftToSave);
|
$maxAmount = min($leftOnAccount, $leftToSave);
|
||||||
|
|
||||||
|
|
||||||
\Log::debug('Now going to view for piggy bank #' . $piggyBank->id . ' (' . $piggyBank->name . ')');
|
|
||||||
|
|
||||||
return view('piggy-banks.add', compact('piggyBank', 'maxAmount'));
|
return view('piggy-banks.add', compact('piggyBank', 'maxAmount'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,6 +66,12 @@ class PiggyBankController extends Controller
|
|||||||
$subTitle = 'Create new piggy bank';
|
$subTitle = 'Create new piggy bank';
|
||||||
$subTitleIcon = 'fa-plus';
|
$subTitleIcon = 'fa-plus';
|
||||||
|
|
||||||
|
// put previous url in session if not redirect from store (not "create another").
|
||||||
|
if (Session::get('piggy-banks.create.fromStore') !== true) {
|
||||||
|
Session::put('piggy-banks.create.url', URL::previous());
|
||||||
|
}
|
||||||
|
Session::forget('piggy-banks.create.fromStore');
|
||||||
|
|
||||||
return view('piggy-banks.create', compact('accounts', 'periods', 'subTitle', 'subTitleIcon'));
|
return view('piggy-banks.create', compact('accounts', 'periods', 'subTitle', 'subTitleIcon'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,6 +84,9 @@ class PiggyBankController extends Controller
|
|||||||
{
|
{
|
||||||
$subTitle = 'Delete "' . e($piggyBank->name) . '"';
|
$subTitle = 'Delete "' . e($piggyBank->name) . '"';
|
||||||
|
|
||||||
|
// put previous url in session
|
||||||
|
Session::put('piggy-banks.delete.url', URL::previous());
|
||||||
|
|
||||||
return view('piggy-banks.delete', compact('piggyBank', 'subTitle'));
|
return view('piggy-banks.delete', compact('piggyBank', 'subTitle'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +101,7 @@ class PiggyBankController extends Controller
|
|||||||
Session::flash('success', 'Piggy bank "' . e($piggyBank->name) . '" deleted.');
|
Session::flash('success', 'Piggy bank "' . e($piggyBank->name) . '" deleted.');
|
||||||
$piggyBank->delete();
|
$piggyBank->delete();
|
||||||
|
|
||||||
return Redirect::route('piggy-banks.index');
|
return Redirect::to(Session::get('piggy-banks.delete.url'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -132,6 +139,12 @@ class PiggyBankController extends Controller
|
|||||||
];
|
];
|
||||||
Session::flash('preFilled', $preFilled);
|
Session::flash('preFilled', $preFilled);
|
||||||
|
|
||||||
|
// put previous url in session if not redirect from store (not "return_to_edit").
|
||||||
|
if (Session::get('piggy-banks.edit.fromUpdate') !== true) {
|
||||||
|
Session::put('piggy-banks.edit.url', URL::previous());
|
||||||
|
}
|
||||||
|
Session::forget('piggy-banks.edit.fromUpdate');
|
||||||
|
|
||||||
return view('piggy-banks.edit', compact('subTitle', 'subTitleIcon', 'piggyBank', 'accounts', 'periods', 'preFilled'));
|
return view('piggy-banks.edit', compact('subTitle', 'subTitleIcon', 'piggyBank', 'accounts', 'periods', 'preFilled'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -312,11 +325,13 @@ class PiggyBankController extends Controller
|
|||||||
Session::flash('success', 'Stored piggy bank "' . e($piggyBank->name) . '".');
|
Session::flash('success', 'Stored piggy bank "' . e($piggyBank->name) . '".');
|
||||||
|
|
||||||
if (intval(Input::get('create_another')) === 1) {
|
if (intval(Input::get('create_another')) === 1) {
|
||||||
|
Session::put('piggy-banks.create.fromStore', true);
|
||||||
return Redirect::route('piggy-banks.create')->withInput();
|
return Redirect::route('piggy-banks.create')->withInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return Redirect::route('piggy-banks.index');
|
// redirect to previous URL.
|
||||||
|
return Redirect::to(Session::get('piggy-banks.create.url'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -344,11 +359,13 @@ class PiggyBankController extends Controller
|
|||||||
Session::flash('success', 'Updated piggy bank "' . e($piggyBank->name) . '".');
|
Session::flash('success', 'Updated piggy bank "' . e($piggyBank->name) . '".');
|
||||||
|
|
||||||
if (intval(Input::get('return_to_edit')) === 1) {
|
if (intval(Input::get('return_to_edit')) === 1) {
|
||||||
|
Session::put('piggy-banks.edit.fromUpdate', true);
|
||||||
return Redirect::route('piggy-banks.edit', $piggyBank->id);
|
return Redirect::route('piggy-banks.edit', $piggyBank->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return Redirect::route('piggy-banks.index');
|
// redirect to previous URL.
|
||||||
|
return Redirect::to(Session::get('piggy-banks.edit.url'));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user