Return to edit / create screen when user indicates.

This commit is contained in:
James Cole 2015-03-26 17:45:03 +01:00
parent d624efa799
commit fcc47b58b4
7 changed files with 40 additions and 4 deletions

View File

@ -196,7 +196,7 @@ class AccountController extends Controller
Session::flash('success', 'New account "' . $account->name . '" stored!');
if (intval(Input::get('create_another')) === 1) {
return Redirect::route('accounts.create', $request->input('what'));
return Redirect::route('accounts.create', $request->input('what'))->withInput();
}
return Redirect::route('accounts.index', $request->input('what'));

View File

@ -152,6 +152,12 @@ class BudgetController extends Controller
return Redirect::route('budgets.index');
}
/**
* @param BudgetFormRequest $request
* @param BudgetRepositoryInterface $repository
*
* @return \Illuminate\Http\RedirectResponse
*/
public function store(BudgetFormRequest $request, BudgetRepositoryInterface $repository)
{
$budgetData = [
@ -204,6 +210,10 @@ class BudgetController extends Controller
Session::flash('success', 'Budget "' . $budget->name . '" updated.');
if (intval(Input::get('return_to_edit')) === 1) {
return Redirect::route('budgets.edit', $budget->id);
}
return Redirect::route('budgets.index');
}

View File

@ -156,7 +156,7 @@ class CategoryController extends Controller
Session::flash('success', 'New category "' . $category->name . '" stored!');
if (intval(Input::get('create_another')) === 1) {
return Redirect::route('categories.create');
return Redirect::route('categories.create')->withInput();
}
return Redirect::route('categories.index');
@ -181,6 +181,10 @@ class CategoryController extends Controller
Session::flash('success', 'Category "' . $category->name . '" updated.');
if (intval(Input::get('return_to_edit')) === 1) {
return Redirect::route('categories.edit', $category->id);
}
return Redirect::route('categories.index');
}

View File

@ -148,7 +148,7 @@ class CurrencyController extends Controller
Session::flash('success', 'Currency "' . $currency->name . '" created');
if (intval(Input::get('create_another')) === 1) {
return Redirect::route('currency.create');
return Redirect::route('currency.create')->withInput();
}
return Redirect::route('currency.index');

View File

@ -291,7 +291,10 @@ class PiggyBankController extends Controller
}
/**
* @param PiggyBankFormRequest $request
* @param PiggyBankRepositoryInterface $repository
*
* @return $this|\Illuminate\Http\RedirectResponse
*/
public function store(PiggyBankFormRequest $request, PiggyBankRepositoryInterface $repository)
{

View File

@ -12,6 +12,7 @@ use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
use Redirect;
use Session;
use View;
use Input;
/**
* Class RepeatedExpenseController
@ -144,7 +145,10 @@ class RepeatedExpenseController extends Controller
}
/**
* @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind.
* @param PiggyBankFormRequest $request
* @param PiggyBankRepositoryInterface $repository
*
* @return \Illuminate\Http\RedirectResponse
*/
public function store(PiggyBankFormRequest $request, PiggyBankRepositoryInterface $repository)
{
@ -167,6 +171,11 @@ class RepeatedExpenseController extends Controller
Session::flash('success', 'Stored repeated expense "' . e($piggyBank->name) . '".');
if (intval(Input::get('create_another')) === 1) {
return Redirect::route('repeated.create', $request->input('what'))->withInput();
}
return Redirect::route('repeated.index');
}
@ -195,6 +204,10 @@ class RepeatedExpenseController extends Controller
$piggyBank = $repository->update($repeatedExpense, $piggyBankData);
if (intval(Input::get('return_to_edit')) === 1) {
return Redirect::route('repeated.edit', $piggyBank->id);
}
Session::flash('success', 'Updated repeated expense "' . e($piggyBank->name) . '".');
return Redirect::route('repeated.index');

View File

@ -236,6 +236,12 @@ class TransactionController extends Controller
);
}
/**
* @param JournalFormRequest $request
* @param JournalRepositoryInterface $repository
*
* @return $this|\Illuminate\Http\RedirectResponse
*/
public function store(JournalFormRequest $request, JournalRepositoryInterface $repository)
{
$journalData = [