From cfba11e9ca171aca337e0b46f3c906212ee5e92a Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 11 Mar 2018 13:26:11 +0100 Subject: [PATCH] Code for #1244 --- app/Http/Controllers/AccountController.php | 3 ++- public/js/ff/charts.js | 4 ++-- resources/views/accounts/show.twig | 7 +++++++ resources/views/index.twig | 1 - resources/views/javascript/variables.twig | 1 + 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index 585aec7ee4..da103a5bde 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -304,6 +304,7 @@ class AccountController extends Controller throw new FireflyException('End is after start!'); // @codeCoverageIgnore } + $today = new Carbon; $subTitleIcon = config('firefly.subIconsByIdentifier.' . $account->accountType->type); $page = intval($request->get('page')); $pageSize = intval(Preferences::get('listPageSize', 50)->data); @@ -327,7 +328,7 @@ class AccountController extends Controller return view( 'accounts.show', - compact('account', 'currency', 'periods', 'subTitleIcon', 'transactions', 'subTitle', 'start', 'end', 'chartUri') + compact('account', 'currency','today', 'periods', 'subTitleIcon', 'transactions', 'subTitle', 'start', 'end', 'chartUri') ); } diff --git a/public/js/ff/charts.js b/public/js/ff/charts.js index ac1c391d94..6bb9c509be 100644 --- a/public/js/ff/charts.js +++ b/public/js/ff/charts.js @@ -312,8 +312,8 @@ function drawAChart(URI, container, chartType, options, colorData) { fontSize: 12, fontColor: "#333", position: "right", - xAdjust: 0, - yAdjust: -120, + xAdjust: -20, + yAdjust: -125, enabled: true, content: todayText } diff --git a/resources/views/accounts/show.twig b/resources/views/accounts/show.twig index c137e6e45f..eb584a5c2d 100644 --- a/resources/views/accounts/show.twig +++ b/resources/views/accounts/show.twig @@ -149,8 +149,15 @@ var expenseBudgetUri = '{{ route('chart.account.expense-budget', [account.id, start.format('Ymd'), end.format('Ymd')]) }}'; {% endif %} + var drawVerticalLine = ''; + {# render vertical line with text "today" #} + {% if start.lte(today) and end.gte(today) %} + drawVerticalLine = '{{ today.formatLocalized(monthAndDayFormat) }}'; + {% endif %} + + diff --git a/resources/views/index.twig b/resources/views/index.twig index ca085b5163..adab358376 100644 --- a/resources/views/index.twig +++ b/resources/views/index.twig @@ -188,7 +188,6 @@ var accountRevenueUri = '{{ route('chart.account.revenue') }}'; var accountExpenseUri = '{{ route('chart.account.expense') }}'; var piggyInfoUri = '{{ route('json.fp.piggy-banks') }}'; - var todayText = ' {{ trans('firefly.today')|escape('js') }}'; var drawVerticalLine = ''; {# render vertical line with text "today" #} {% if start.lte(today) and end.gte(today) %} diff --git a/resources/views/javascript/variables.twig b/resources/views/javascript/variables.twig index 9818cee9ec..847068f7e4 100644 --- a/resources/views/javascript/variables.twig +++ b/resources/views/javascript/variables.twig @@ -39,6 +39,7 @@ var accountingConfig = {{ accounting|json_encode|raw }}; var token = '{{ csrf_token() }}'; var sessionStart = '{{ session('start').format('Y-m-d') }}'; var sessionEnd = '{{ session('end').format('Y-m-d') }}'; +var todayText = ' {{ trans('firefly.today')|escape('js') }}'; // some formatting stuff: var month_and_day_js = "{{ trans('config.month_and_day_js') }}";