Updated view toggle to store date

Also added test for user list order preferences
This commit is contained in:
Dan Brown
2019-04-14 13:01:51 +01:00
parent 01be72d5e2
commit 9406b4d4c9
11 changed files with 155 additions and 20 deletions

View File

@ -20,6 +20,7 @@
@include('partials.custom-styles')
@include('partials.custom-head')
@stack('head')
</head>
<body class="@yield('body-class')">

View File

@ -9,10 +9,7 @@
<h5>{{ trans('common.actions') }}</h5>
<div class="icon-list text-primary">
@include('partials.view-toggle', ['view' => $view, 'type' => 'book'])
<a expand-toggle=".entity-list.compact .entity-item-snippet" class="icon-list-item">
<span>@icon('expand-text')</span>
<span>{{ trans('common.toggle_details') }}</span>
</a>
@include('components.expand-toggle', ['target' => '.entity-list.compact .entity-item-snippet', 'key' => 'home-details'])
</div>
</div>

View File

@ -8,10 +8,7 @@
<div class="actions mb-xl">
<h5>{{ trans('common.actions') }}</h5>
<div class="icon-list text-primary">
<a expand-toggle=".entity-list.compact .entity-item-snippet" class="icon-list-item">
<span>@icon('expand-text')</span>
<span>{{ trans('common.toggle_details') }}</span>
</a>
@include('components.expand-toggle', ['target' => '.entity-list.compact .entity-item-snippet', 'key' => 'home-details'])
</div>
</div>

View File

@ -9,10 +9,7 @@
<h5>{{ trans('common.actions') }}</h5>
<div class="icon-list text-primary">
@include('partials.view-toggle', ['view' => $view, 'type' => 'shelf'])
<a expand-toggle=".entity-list.compact .entity-item-snippet" class="icon-list-item">
<span>@icon('expand-text')</span>
<span>{{ trans('common.toggle_details') }}</span>
</a>
@include('components.expand-toggle', ['target' => '.entity-list.compact .entity-item-snippet', 'key' => 'home-details'])
</div>
</div>

View File

@ -1,10 +1,11 @@
@extends('simple-layout')
@section('body')
<div class="container px-xl py-l">
<a expand-toggle=".entity-list.compact .entity-item-snippet" class="text-muted">@icon('expand-text'){{ trans('common.toggle_details') }}</a>
<div class="container px-xl py-s">
<div class="icon-list inline block">
@include('components.expand-toggle', ['target' => '.entity-list.compact .entity-item-snippet', 'key' => 'home-details'])
</div>
</div>
<div class="container" id="home-default">

View File

@ -0,0 +1,19 @@
{{--
$target - CSS selector of items to expand
$key - Unique key for checking existing stored state.
--}}
<?php $isOpen = setting()->getForCurrentUser('section_expansion#'. $key); ?>
<a expand-toggle="{{ $target }}"
expand-toggle-update-endpoint="{{ baseUrl('/settings/users/'. auth()->user()->id .'/update-expansion-preference/' . $key) }}"
expand-toggle-is-open="{{ $isOpen ? 'yes' : 'no' }}"
class="text-muted icon-list-item text-primary">
<span>@icon('expand-text')</span>
<span>{{ trans('common.toggle_details') }}</span>
</a>
@if($isOpen)
@push('head')
<style>
{{ $target }} {display: block;}
</style>
@endpush
@endif