From 1e76a5fc3f696c644f151532559fc1083cc5f7dc Mon Sep 17 00:00:00 2001 From: Sander Dorigo Date: Wed, 8 Oct 2014 21:04:31 +0200 Subject: [PATCH] New buttons. --- app/controllers/TransactionController.php | 12 ++++++++++++ app/lib/Firefly/Form/Form.php | 8 ++++++++ app/views/index.blade.php | 19 +++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/app/controllers/TransactionController.php b/app/controllers/TransactionController.php index a2b385c330..798ca809ae 100644 --- a/app/controllers/TransactionController.php +++ b/app/controllers/TransactionController.php @@ -67,6 +67,18 @@ class TransactionController extends BaseController $piggies = $toolkit->makeSelectList($piggyRepository->get()); $piggies[0] = '(no piggy bank)'; + /* + * respond to a possible given values in the URL. + */ + $prefilled = Session::has('prefilled') ? Session::get('prefilled') : []; + $respondTo = ['account_id', 'account_from_id']; + foreach ($respondTo as $r) { + if (!is_null(Input::get($r))) { + $prefilled[$r] = Input::get($r); + } + } + Session::put('prefilled', $prefilled); + return View::make('transactions.create')->with('accounts', $assetAccounts)->with('budgets', $budgets)->with( 'what', $what )->with('piggies', $piggies)->with('subTitle', 'Add a new ' . $what); diff --git a/app/lib/Firefly/Form/Form.php b/app/lib/Firefly/Form/Form.php index fbb2f2b2fb..9673ea9172 100644 --- a/app/lib/Firefly/Form/Form.php +++ b/app/lib/Firefly/Form/Form.php @@ -190,6 +190,14 @@ class Form */ $options['placeholder'] = ucfirst($name); + /* + * Get prefilled value: + */ + if(\Session::has('prefilled')) { + $prefilled = \Session::get('prefilled'); + $value = isset($prefilled[$name]) ? $prefilled[$name] : null; + } + /* * Get the value. */ diff --git a/app/views/index.blade.php b/app/views/index.blade.php index 82e261d62f..de32cdf79a 100644 --- a/app/views/index.blade.php +++ b/app/views/index.blade.php @@ -82,6 +82,25 @@
{{{$data[1]->name}}} + + + +
+
+ + +
+
+ + +
@include('transactions.journals-small-index',['transactions' => $data[0],'account' => $data[1]])