Skip to content

Commit

Permalink
added some item counts to the dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
CaffeineSheep committed Mar 23, 2023
1 parent 8147bdf commit 000b712
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 23 deletions.
32 changes: 11 additions & 21 deletions app/Http/Controllers/HomeController.php
Expand Up @@ -23,7 +23,7 @@ public function index(Request $request, ActivityQueries $activities)
$newSymbols = Page::getVisiblePagesInBookshelf('symbols')
->orderBy('created_at', 'desc')
->take(10)
// ->select(Page::$listAttributes)
// ->select(Page::$listAtt ributes)
->get();

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

$latestDraftHelp = Page::getVisiblePagesInBookshelf('contribute')
// ->where('book_id', '=', '5')
$draftHelp = Page::getVisiblePagesInBookshelf('contribute')
->where('book_id', '=', Book::getBySlug('draft-help', true)->id)
->orderBy('created_at', 'desc')
->take(3)
// ->select(Page::$listAttributes)
->get();
->orderBy('created_at', 'desc');

$latestCommunityReviews = Page::getVisiblePagesInBookshelf('contribute')
// ->where('book_id', '=', '5')
$communityReviews = Page::getVisiblePagesInBookshelf('contribute')
->where('book_id', '=', Book::getBySlug('community-review', true)->id)
->orderBy('created_at', 'desc')
->take(3)
// ->select(Page::$listAttributes)
->get();
->orderBy('created_at', 'desc');


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

// $test = Book::getBySlug('drafts', true);

// $recentUpdates = Page::getAllVisiblePages()
// ->orderBy('created_at', 'desc')
// ->take(2)
// ->get();
$recentUpdates = Page::getVisiblePagesInBookshelf('symbols')
->orderBy('updated_at', 'desc')
->where('revision_count', '>', 1)
Expand All @@ -77,11 +64,14 @@ public function index(Request $request, ActivityQueries $activities)
$homepageOption = 'default';
}


$commonData = [
'activeUsers' => $activeUsers,
'latestDrafts' => $latestDrafts,
'latestCommunityReviews' => $latestCommunityReviews,
'latestDraftHelp' => $latestDraftHelp,
'latestCommunityReviews' => $communityReviews->take(3)->get(),
'numCommunityReviews' => $communityReviews->count(),
'latestDraftHelp' => $draftHelp->take(3)->get(),
'numDraftHelp' => $draftHelp->count(),
'newSymbols' => $newSymbols,
'quickLinks' => $quickLinks,
'symbolTypesList' => $symbolTypesList,
Expand Down
5 changes: 3 additions & 2 deletions resources/views/home/default.blade.php
Expand Up @@ -70,7 +70,8 @@ class="card-footer-link">{{ trans('common.view_all') }}</a>
])
</div>
<a href="{{ url('/books/community-review') }}"
class="card-footer-link">{{ trans('common.view_all') }}</a>
class="card-footer-link">{{ trans('common.view_all').' ('.$numCommunityReviews.')' }}</a>
{{-- class="card-footer-link">{{ trans('common.view_all').' ('.$latestCommunityReviews.total().')' }}</a> --}}
</div>
<div id="recent-pages" class="card mb-xl">
<h3 class="card-title">Looking for help 🙋‍♂️</h3>
Expand All @@ -82,7 +83,7 @@ class="card-footer-link">{{ trans('common.view_all') }}</a>
])
</div>
<a href="{{ url('/books/draft-help') }}"
class="card-footer-link">{{ trans('common.view_all') }}</a>
class="card-footer-link">{{ trans('common.view_all').' ('.$numDraftHelp.')' }}</a>
</div>
</div>
<div>
Expand Down

0 comments on commit 000b712

Please sign in to comment.