From c4c3d0f07fc331939195df6ee7f49bec97e0eece Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 13 Dec 2015 09:01:17 +0100 Subject: [PATCH] Some refactoring. --- app/Http/Controllers/ReportController.php | 12 +- resources/twig/reports/default.twig | 105 ------------------ .../twig/reports/{ => default}/month.twig | 25 +++-- .../twig/reports/{ => default}/year.twig | 8 +- .../partials}/accounts.twig | 0 .../reports => reports/partials}/balance.twig | 0 .../reports => reports/partials}/bills.twig | 0 .../reports => reports/partials}/budgets.twig | 0 .../partials}/categories.twig | 0 .../partials}/expenses.twig | 0 .../partials}/income-vs-expenses.twig | 0 .../reports => reports/partials}/income.twig | 0 12 files changed, 25 insertions(+), 125 deletions(-) delete mode 100644 resources/twig/reports/default.twig rename resources/twig/reports/{ => default}/month.twig (82%) rename resources/twig/reports/{ => default}/year.twig (95%) rename resources/twig/{partials/reports => reports/partials}/accounts.twig (100%) rename resources/twig/{partials/reports => reports/partials}/balance.twig (100%) rename resources/twig/{partials/reports => reports/partials}/bills.twig (100%) rename resources/twig/{partials/reports => reports/partials}/budgets.twig (100%) rename resources/twig/{partials/reports => reports/partials}/categories.twig (100%) rename resources/twig/{partials/reports => reports/partials}/expenses.twig (100%) rename resources/twig/{partials/reports => reports/partials}/income-vs-expenses.twig (100%) rename resources/twig/{partials/reports => reports/partials}/income.twig (100%) diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php index 19e5bcbe36..2113cf7329 100644 --- a/app/Http/Controllers/ReportController.php +++ b/app/Http/Controllers/ReportController.php @@ -68,7 +68,7 @@ class ReportController extends Controller * * @return View */ - public function year($report_type, Carbon $start, Carbon $end, Collection $accounts) + public function defaultYear($report_type, Carbon $start, Carbon $end, Collection $accounts) { $subTitle = trans('firefly.reportForYear', ['year' => $start->year]); $subTitleIcon = 'fa-bar-chart'; @@ -92,7 +92,7 @@ class ReportController extends Controller $accountIds = join(';', $accountIds); return view( - 'reports.year', + 'reports.default.year', compact( 'start', 'accountReport', 'incomes', 'report_type', 'accountIds', 'end', 'expenses', 'subTitle', 'subTitleIcon', 'incomeTopLength', 'expenseTopLength' @@ -109,7 +109,7 @@ class ReportController extends Controller * * @return View */ - public function month($report_type, Carbon $start, Carbon $end, Collection $accounts) + public function defaultMonth($report_type, Carbon $start, Carbon $end, Collection $accounts) { // some fields for translation: $subTitle = trans('firefly.reportForMonth', ['month' => $start->formatLocalized($this->monthFormat)]); @@ -136,7 +136,7 @@ class ReportController extends Controller // continue! return view( - 'reports.default', + 'reports.default.month', compact( 'start', 'end', 'report_type', 'subTitle', 'subTitleIcon', @@ -168,10 +168,10 @@ class ReportController extends Controller // more than two months date difference means year report. if ($start->diffInMonths($end) > 1) { - return $this->year($report_type, $start, $end, $accounts); + return $this->defaultYear($report_type, $start, $end, $accounts); } - return $this->month($report_type, $start, $end, $accounts); + return $this->defaultMonth($report_type, $start, $end, $accounts); } diff --git a/resources/twig/reports/default.twig b/resources/twig/reports/default.twig deleted file mode 100644 index d2347b4391..0000000000 --- a/resources/twig/reports/default.twig +++ /dev/null @@ -1,105 +0,0 @@ -{% extends "./layout/default.twig" %} - -{% block breadcrumbs %} - {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, start, shared) }} -{% endblock %} - -{% block content %} - -
-
-
-
-

{{ 'accountBalances'|_ }}

-
-
- {% if Config.get('firefly.chart') == 'google' %} -
- {% endif %} - {% if Config.get('firefly.chart') == 'chartjs' %} - - {% endif %} -
-
-
-
- -
-
- {% include 'partials/reports/accounts.twig' %} - {% include 'partials/reports/income-vs-expenses.twig' %} -
-
- - {% include 'partials/reports/income.twig' %} -
-
- - {% include 'partials/reports/expenses.twig' %} -
-
-
-
- - {% include 'partials/reports/budgets.twig' %} -
-
- - {% include 'partials/reports/categories.twig' %} -
-
-
-
- -
-
-
-
- {% include 'partials/reports/balance.twig' %} -
-
-
-
- {% include 'partials/reports/bills.twig' %} - -
-
-{% endblock %} -{% block styles %} - -{% endblock %} -{% block scripts %} - - - - - {% if Config.get('firefly.chart') == 'google' %} - - - {% endif %} - {% if Config.get('firefly.chart') == 'chartjs' %} - - - {% endif %} - - - -{% endblock %} diff --git a/resources/twig/reports/month.twig b/resources/twig/reports/default/month.twig similarity index 82% rename from resources/twig/reports/month.twig rename to resources/twig/reports/default/month.twig index 0b9111669b..6330b99266 100644 --- a/resources/twig/reports/month.twig +++ b/resources/twig/reports/default/month.twig @@ -26,26 +26,26 @@
- {% include 'partials/reports/accounts.twig' %} - {% include 'partials/reports/income-vs-expenses.twig' %} + {% include 'reports/partials/accounts.twig' %} + {% include 'reports/partials/income-vs-expenses.twig' %}
- {% include 'partials/reports/income.twig' %} + {% include 'reports/partials/income.twig' %}
- {% include 'partials/reports/expenses.twig' %} + {% include 'reports/partials/expenses.twig' %}
- {% include 'partials/reports/budgets.twig' %} + {% include 'reports/partials/budgets.twig' %}
- {% include 'partials/reports/categories.twig' %} + {% include 'reports/partials/categories.twig' %}
@@ -55,12 +55,12 @@
- {% include 'partials/reports/balance.twig' %} + {% include 'reports/partials/balance.twig' %}
- {% include 'partials/reports/bills.twig' %} + {% include 'reports/partials/bills.twig' %}
@@ -85,8 +85,13 @@