Fixed user default view
This commit is contained in:
parent
9cf8ed2ae0
commit
c4ca9dc962
3 changed files with 7 additions and 4 deletions
|
@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
## [Unreleased]
|
||||
### Fixed
|
||||
- Formatting error on the check for updates.
|
||||
- Fixed default view for normal users
|
||||
|
||||
## [3.3.0] - 2020-11-12
|
||||
### Added
|
||||
|
|
|
@ -52,8 +52,10 @@ class DashboardController extends Controller
|
|||
break;
|
||||
}
|
||||
|
||||
$isAdmin = (bool) $this->session->get('admin', false);
|
||||
|
||||
/** @var MediaQuery $query */
|
||||
$query = make(MediaQuery::class, ['isAdmin' => (bool) $this->session->get('admin', false)])
|
||||
$query = make(MediaQuery::class, ['isAdmin' => $isAdmin])
|
||||
->orderBy($order, param($request, 'order', 'DESC'))
|
||||
->withUserId($this->session->get('user_id'))
|
||||
->search(param($request, 'search', null))
|
||||
|
@ -61,13 +63,13 @@ class DashboardController extends Controller
|
|||
->run($page);
|
||||
|
||||
$tags = make(TagQuery::class, [
|
||||
'isAdmin' => (bool) $this->session->get('admin', false),
|
||||
'isAdmin' => $isAdmin,
|
||||
'userId' => $this->session->get('user_id')
|
||||
])->all();
|
||||
|
||||
return view()->render(
|
||||
$response,
|
||||
($this->session->get('gallery_view', true)) ? 'dashboard/list.twig' : 'dashboard/grid.twig',
|
||||
($this->session->get('gallery_view', $isAdmin)) ? 'dashboard/list.twig' : 'dashboard/grid.twig',
|
||||
[
|
||||
'medias' => $query->getMedia(),
|
||||
'next' => $page < floor($query->getPages()),
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
{% endif %}
|
||||
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="{{ route('switchView') }}"><i class="fas fa-fw fa-sync"></i> {{ lang('switch_to') }}: {{ session.get('gallery_view') is null or session.get('gallery_view') ? lang('gallery') : lang('table') }}</a>
|
||||
<a class="dropdown-item" href="{{ route('switchView') }}"><i class="fas fa-fw fa-sync"></i> {{ lang('switch_to') }}: {{ (session.get('gallery_view') is null and session.get('admin')) or session.get('gallery_view') ? lang('gallery') : lang('table') }}</a>
|
||||
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="{{ route('profile') }}"><i class="fas fa-fw fa-user"></i> {{ lang('profile') }}</a>
|
||||
|
|
Loading…
Reference in a new issue