Add toggle by rows/by cards
This commit is contained in:
@@ -18,9 +18,10 @@ class CategoryController extends Controller
|
||||
return $dataTable->render('Shop.Categories.list');
|
||||
}
|
||||
|
||||
public function show($category_id)
|
||||
public function show(Request $request, $category_id)
|
||||
{
|
||||
$data = self::init();
|
||||
$data['display_by_rows'] = $request->input('by_rows') ?? false;
|
||||
$data['category'] = Categories::getFull($category_id);
|
||||
$data['articles'] = Articles::getArticlesToSell($category_id);
|
||||
$data['tags'] = TagGroups::getWithTagsAndCountOffers();
|
||||
|
||||
@@ -25,9 +25,7 @@
|
||||
|
||||
<div class="wrapper">
|
||||
<main>
|
||||
|
||||
@include("Shop.layout.partials.header")
|
||||
|
||||
<div class="content-wrapper">
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
@@ -35,13 +33,10 @@
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
@include("Shop.layout.partials.footer")
|
||||
|
||||
</main>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript" src="/js/site.min.js" ></script>
|
||||
|
||||
@stack('scripts')
|
||||
|
||||
@@ -15,9 +15,31 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
Il y a {{ count($articles) ?? 0 }} article(s) dans la liste
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
@include('components.form.button', ['id' => 'by_cards', 'icon' => 'fa-th', 'class' => 'btn-success'])
|
||||
@include('components.form.button', ['id' => 'by_rows', 'icon' => 'fa-list', 'class' => 'btn-success'])
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<form name="product_sorting">
|
||||
<label>Trier par</label>
|
||||
@include('components.form.select', ['name' => 'sorting', 'list' => ['Pertinence']])
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
$('#by_rows').click(function() {
|
||||
var url = "{{ url()->current() }}" + '?by_rows=1';
|
||||
window.location = url;
|
||||
})
|
||||
$('#by_cards').click(function() {
|
||||
var url = "{{ url()->current() }}";
|
||||
window.location = url;
|
||||
})
|
||||
</script>
|
||||
@endpush
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="row bg-green">
|
||||
|
||||
<div class="col-4 col-md-2 form-inline pl-4">
|
||||
<img src="/img/logo.jpg" class="img-responvive pull-left">
|
||||
<a href="/"><img src="/img/logo.jpg" class="img-responvive pull-left"></a>
|
||||
</div>
|
||||
|
||||
<div class="col-8 col-md-6 form-inline">
|
||||
|
||||
@@ -17,7 +17,11 @@
|
||||
@include('Shop.layout.partials.category_add')
|
||||
</div>
|
||||
</div>
|
||||
@if ($display_by_rows ?? false)
|
||||
@include('Shop.layout.partials.category_articles_rows')
|
||||
@else
|
||||
@include('Shop.layout.partials.category_articles')
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user