Optimize view [skip ci]

This commit is contained in:
James Cole 2016-12-28 06:19:18 +01:00
parent 05a93a2426
commit 61014d45f4
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
3 changed files with 9 additions and 60 deletions

View File

@ -177,11 +177,12 @@ class CategoryController extends Controller
}
/**
* @param Category $category
* @param JournalCollectorInterface $collector
* @param Category $category
*
* @return View
*/
public function show(Category $category)
public function show(JournalCollectorInterface $collector, Category $category)
{
$range = Preferences::get('viewRange', '1M')->data;
$start = session('start', Navigation::startOfPeriod(new Carbon, $range));
@ -192,9 +193,7 @@ class CategoryController extends Controller
$subTitle = $category->name;
$subTitleIcon = 'fa-bar-chart';
// use journal collector
$collector = app(JournalCollectorInterface::class);
$collector->setLimit($pageSize)->setPage($page)->setAllAssetAccounts()->setRange($start, $end)->setCategory($category);
$collector->setLimit($pageSize)->setPage($page)->setAllAssetAccounts()->setRange($start, $end)->setCategory($category)->withBudgetInformation();
$journals = $collector->getPaginatedJournals();
$journals->setPath('categories/show/' . $category->id);
@ -224,9 +223,9 @@ class CategoryController extends Controller
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
$showAll = true;
// new collector:
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class);
$collector->setLimit($pageSize)->setPage($page)->setAllAssetAccounts()->setCategory($category);
$collector->setLimit($pageSize)->setPage($page)->setAllAssetAccounts()->setCategory($category)->withBudgetInformation();
$journals = $collector->getPaginatedJournals();
$journals->setPath('categories/show/' . $category->id . '/all');
@ -251,9 +250,9 @@ class CategoryController extends Controller
$page = intval(Input::get('page')) === 0 ? 1 : intval(Input::get('page'));
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
// new collector:
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class);
$collector->setLimit($pageSize)->setPage($page)->setAllAssetAccounts()->setRange($start, $end)->setCategory($category);
$collector->setLimit($pageSize)->setPage($page)->setAllAssetAccounts()->setRange($start, $end)->setCategory($category)->withBudgetInformation();
$journals = $collector->getPaginatedJournals();
$journals->setPath('categories/show/' . $category->id . '/' . $date);

View File

@ -1,50 +0,0 @@
{% extends "./layout/default" %}
{% block breadcrumbs %}
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, category, carbon) }}
{% endblock %}
{% block content %}
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'overview'|_ }} (period)</h3>
</div>
<div class="box-body">
<canvas id="period-specific-period" style="width:100%;height:350px;" height="350"></canvas>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<p><a href="{{ route('categories.show',[category.id]) }}">Back to all periods</a></p>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'transactions'|_ }}</h3>
</div>
<div class="box-body">
{% include 'list.journals-tasker' %}
</div>
</div>
</div>
</div>
{% endblock %}
{% block scripts %}
<script type="text/javascript">
var specific = '{{ route('chart.category.specific', [category.id, carbon.format('Ymd')]) }}';
</script>
<script type="text/javascript" src="js/lib/Chart.bundle.min.js"></script>
<script type="text/javascript" src="js/ff/charts.defaults.js"></script>
<script type="text/javascript" src="js/ff/charts.js"></script>
<script type="text/javascript" src="js/ff/categories/show-by-date.js"></script>
<script type="text/javascript" src="js/ff/transactions/list.js"></script>
{% endblock %}

View File

@ -64,7 +64,7 @@
<h3 class="box-title">{{ 'transactions'|_ }}</h3>
</div>
<div class="box-body">
{% include 'list.journals-tasker' %}
{% include 'list.journals-tasker' with {hideCategories: true} %}
{% if entries %}
<p>
<i class="fa fa-calendar" aria-hidden="true"></i>