Skip to content

Commit 000b712

Browse files
author
CaffeineSheep
committed
added some item counts to the dashboard
1 parent 8147bdf commit 000b712

File tree

2 files changed

+14
-23
lines changed

2 files changed

+14
-23
lines changed

app/Http/Controllers/HomeController.php

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function index(Request $request, ActivityQueries $activities)
2323
$newSymbols = Page::getVisiblePagesInBookshelf('symbols')
2424
->orderBy('created_at', 'desc')
2525
->take(10)
26-
// ->select(Page::$listAttributes)
26+
// ->select(Page::$listAtt ributes)
2727
->get();
2828

2929
$latestDrafts = Page::getVisiblePagesInBookshelf('contribute')
@@ -33,21 +33,14 @@ public function index(Request $request, ActivityQueries $activities)
3333
// ->select(Page::$listAttributes)
3434
->get();
3535

36-
$latestDraftHelp = Page::getVisiblePagesInBookshelf('contribute')
37-
// ->where('book_id', '=', '5')
36+
$draftHelp = Page::getVisiblePagesInBookshelf('contribute')
3837
->where('book_id', '=', Book::getBySlug('draft-help', true)->id)
39-
->orderBy('created_at', 'desc')
40-
->take(3)
41-
// ->select(Page::$listAttributes)
42-
->get();
38+
->orderBy('created_at', 'desc');
4339

44-
$latestCommunityReviews = Page::getVisiblePagesInBookshelf('contribute')
45-
// ->where('book_id', '=', '5')
40+
$communityReviews = Page::getVisiblePagesInBookshelf('contribute')
4641
->where('book_id', '=', Book::getBySlug('community-review', true)->id)
47-
->orderBy('created_at', 'desc')
48-
->take(3)
49-
// ->select(Page::$listAttributes)
50-
->get();
42+
->orderBy('created_at', 'desc');
43+
5144

5245
$quickLinks = collect([
5346
new BasicListItem('/shelves/symbols', 'All Symbols', 'See all of the official symbols', 'star-circle'),
@@ -56,12 +49,6 @@ public function index(Request $request, ActivityQueries $activities)
5649
...Bookshelf::getBySlug('contribute')->visibleBooks()->get()->all(),
5750
]);
5851

59-
// $test = Book::getBySlug('drafts', true);
60-
61-
// $recentUpdates = Page::getAllVisiblePages()
62-
// ->orderBy('created_at', 'desc')
63-
// ->take(2)
64-
// ->get();
6552
$recentUpdates = Page::getVisiblePagesInBookshelf('symbols')
6653
->orderBy('updated_at', 'desc')
6754
->where('revision_count', '>', 1)
@@ -77,11 +64,14 @@ public function index(Request $request, ActivityQueries $activities)
7764
$homepageOption = 'default';
7865
}
7966

67+
8068
$commonData = [
8169
'activeUsers' => $activeUsers,
8270
'latestDrafts' => $latestDrafts,
83-
'latestCommunityReviews' => $latestCommunityReviews,
84-
'latestDraftHelp' => $latestDraftHelp,
71+
'latestCommunityReviews' => $communityReviews->take(3)->get(),
72+
'numCommunityReviews' => $communityReviews->count(),
73+
'latestDraftHelp' => $draftHelp->take(3)->get(),
74+
'numDraftHelp' => $draftHelp->count(),
8575
'newSymbols' => $newSymbols,
8676
'quickLinks' => $quickLinks,
8777
'symbolTypesList' => $symbolTypesList,

resources/views/home/default.blade.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ class="card-footer-link">{{ trans('common.view_all') }}</a>
7070
])
7171
</div>
7272
<a href="{{ url('/books/community-review') }}"
73-
class="card-footer-link">{{ trans('common.view_all') }}</a>
73+
class="card-footer-link">{{ trans('common.view_all').' ('.$numCommunityReviews.')' }}</a>
74+
{{-- class="card-footer-link">{{ trans('common.view_all').' ('.$latestCommunityReviews.total().')' }}</a> --}}
7475
</div>
7576
<div id="recent-pages" class="card mb-xl">
7677
<h3 class="card-title">Looking for help 🙋‍♂️</h3>
@@ -82,7 +83,7 @@ class="card-footer-link">{{ trans('common.view_all') }}</a>
8283
])
8384
</div>
8485
<a href="{{ url('/books/draft-help') }}"
85-
class="card-footer-link">{{ trans('common.view_all') }}</a>
86+
class="card-footer-link">{{ trans('common.view_all').' ('.$numDraftHelp.')' }}</a>
8687
</div>
8788
</div>
8889
<div>

0 commit comments

Comments
 (0)