From 307e6a2337db6874d7ee165d00cafc827b5e2216 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 11 Jun 2016 06:36:46 +0200 Subject: [PATCH] Renamed fields #267 --- app/Http/Middleware/Range.php | 8 +++++--- public/js/ff/firefly.js | 16 ++++++++-------- resources/views/layout/default.twig | 6 +++--- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/app/Http/Middleware/Range.php b/app/Http/Middleware/Range.php index 5277610f79..3d6345563c 100644 --- a/app/Http/Middleware/Range.php +++ b/app/Http/Middleware/Range.php @@ -94,12 +94,14 @@ class Range private function datePicker() { + + $current = Carbon::now()->formatLocalized('%B %Y'); $next = Carbon::now()->endOfMonth()->addDay()->formatLocalized('%B %Y'); $prev = Carbon::now()->startOfMonth()->subDay()->formatLocalized('%B %Y'); - View::share('currentMonthName', $current); - View::share('previousMonthName', $prev); - View::share('nextMonthName', $next); + View::share('currentPeriodName', $current); + View::share('previousPeriodName', $prev); + View::share('nextPeriodName', $next); } } diff --git a/public/js/ff/firefly.js b/public/js/ff/firefly.js index 5ce868262a..eb8ce819b6 100644 --- a/public/js/ff/firefly.js +++ b/public/js/ff/firefly.js @@ -6,14 +6,14 @@ $(function () { $('.currency-option').click(currencySelect); var ranges = {}; - // range for the current month: - ranges[dateRangeConfig.currentMonth] = [moment().startOf('month'), moment().endOf('month')]; + // range for the current period: + ranges[dateRangeConfig.currentPeriod] = [moment().startOf('month'), moment().endOf('month')]; - // range for the previous month: - ranges[dateRangeConfig.previousMonth] = [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]; + // range for the previous period: + ranges[dateRangeConfig.previousPeriod] = [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]; - // range for the next month: - ranges[dateRangeConfig.nextMonth] = [moment().add(1, 'month').startOf('month'), moment().add(1, 'month').endOf('month')]; + // range for the next period: + ranges[dateRangeConfig.nextPeriod] = [moment().add(1, 'month').startOf('month'), moment().add(1, 'month').endOf('month')]; // range for everything: ranges[dateRangeConfig.everything] = [dateRangeConfig.firstDate, moment()]; @@ -48,10 +48,10 @@ $(function () { label: label, _token: token }).done(function () { - console.log('Succesfully sent new date range.'); + console.log('Succesfully sent new date range [' + start.format('YYYY-MM-DD') + '-' + end.format('YYYY-MM-DD') + '].'); window.location.reload(true); }).fail(function () { - console.log('Could not send new date range.'); + console.log('Could not send new date range [' + start.format('YYYY-MM-DD') + '-' + end.format('YYYY-MM-DD') + ']'); alert('Could not change date range'); }); diff --git a/resources/views/layout/default.twig b/resources/views/layout/default.twig index 16ee742cef..3e7aee50da 100644 --- a/resources/views/layout/default.twig +++ b/resources/views/layout/default.twig @@ -172,9 +172,9 @@ linkTitle: "{{ Session.get('start').formatLocalized(monthAndDayFormat) }} - {{ Session.get('end').formatLocalized(monthAndDayFormat) }}", URL: "{{ route('daterange') }}", firstDate: moment("{{ Session.get('first').format('Y-m-d') }}"), - currentMonth: "{{ currentMonthName }}", - previousMonth: "{{ previousMonthName }}", - nextMonth: "{{ nextMonthName }}", + currentPeriod: "{{ currentPeriodName }}", + previousPeriod: "{{ previousPeriodName }}", + nextPeriod: "{{ nextPeriodName }}", everything: '{{ 'everything'|_ }}', customRangeLabel: '{{ 'customRange'|_ }}', applyLabel: '{{ 'apply'|_ }}',