From 97d3bd68ed11f11379463bf210e7629fe4294e45 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 2 May 2015 22:12:26 +0200 Subject: [PATCH] Show balance act tags. --- app/Support/Twig/Journal.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/app/Support/Twig/Journal.php b/app/Support/Twig/Journal.php index 80cc28d0d3..2fc2999d3d 100644 --- a/app/Support/Twig/Journal.php +++ b/app/Support/Twig/Journal.php @@ -3,11 +3,12 @@ namespace FireflyIII\Support\Twig; +use App; use FireflyIII\Models\TransactionJournal; use Twig_Extension; use Twig_SimpleFilter; use Twig_SimpleFunction; -use App; + /** * Class Journal * @@ -65,10 +66,21 @@ class Journal extends Twig_Extension $functions[] = new Twig_SimpleFunction( 'relevantTags', function (TransactionJournal $journal) { - if($journal->tags->count() == 0) { + if ($journal->tags->count() == 0) { return App::make('amount')->formatJournal($journal); } - return 'TODO: '.$journal->amount; + foreach ($journal->tags as $tag) { + if ($tag->tagMode == 'balanceAct') { + // return tag formatted for a "balance act". + $amount = App::make('amount')->formatJournal($journal, false); + + return ' ' . $tag->tag . ''; + } + } + + + return 'TODO: ' . $journal->amount; } );