v0.10.9 - Added pagination onto guides, washing-reservations, events and news

This commit is contained in:
Neerholt 2020-08-19 09:54:26 +02:00
parent 4233a35e66
commit 6934c2d992
10 changed files with 169 additions and 5 deletions

View File

@ -31,7 +31,7 @@ class NewsController extends Controller
*/
public function index(Request $request)
{
$news = News::query()->paginate($request->input("limit", 20));
$news = News::query()->orderBy('id', 'asc')->paginate(2);
return Response::detect("news.index", [ "news" => $news ]);
}

View File

@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use App\News;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
@ -14,9 +15,20 @@ class RootController extends Controller
}
public function index() {
if(auth()->user()->can('admin.panel.show'))
$perPage = 2;
if(auth()->user()->can('admin.panel.show')) {
if(Response::detect("root.index")->name() == "admin.root.index")
return Response::detect("root.index");
else
return view('app.root.index');
else {
$news = News::query()->orderBy('id', 'asc')->paginate($perPage);
return Response::detect("root.index", ["news" => $news]);
}
}
else {
$news = News::query()->orderBy('id', 'asc')->paginate($perPage);
return view('app.root.index', ["news" => $news]);
}
}
}

View File

@ -157,6 +157,42 @@ input.appinput {
cursor: pointer;
}
nav > .pagination {
display: flex;
list-style: none;
-webkit-padding-start: unset;
padding-inline-start: unset;
justify-content: center;
}
.pagination > .page-item {
display: block;
list-style: none;
padding-right: 8px;
font-size: 1.5rem;
color: black;
}
.pagination > .page-item:last-child {
padding: 0;
}
.pagination > .page-item.disabled {
color: darkgrey;
}
.pagination > .page-item.active {
font-weight: bold;
}
.page-item.active > span {
font-size: 24px;
}
.pagination > .page-item.disabled > .page-link {
font-size: 24px;
}
.text-white {
color: #ffffff;
}

View File

@ -157,6 +157,42 @@ input.appinput {
cursor: pointer;
}
nav > .pagination {
display: flex;
list-style: none;
-webkit-padding-start: unset;
padding-inline-start: unset;
justify-content: center;
}
.pagination > .page-item {
display: block;
list-style: none;
padding-right: 8px;
font-size: 1.5rem;
color: black;
}
.pagination > .page-item:last-child {
padding: 0;
}
.pagination > .page-item.disabled {
color: darkgrey;
}
.pagination > .page-item.active {
font-weight: bold;
}
.page-item.active > span {
font-size: 24px;
}
.pagination > .page-item.disabled > .page-link {
font-size: 24px;
}
.text-white {
color: #ffffff;
}

View File

@ -157,6 +157,42 @@ input.appinput {
cursor: pointer;
}
nav > .pagination {
display: flex;
list-style: none;
-webkit-padding-start: unset;
padding-inline-start: unset;
justify-content: center;
}
.pagination > .page-item {
display: block;
list-style: none;
padding-right: 8px;
font-size: 1.5rem;
color: black;
}
.pagination > .page-item:last-child {
padding: 0;
}
.pagination > .page-item.disabled {
color: darkgrey;
}
.pagination > .page-item.active {
font-weight: bold;
}
.page-item.active > span {
font-size: 24px;
}
.pagination > .page-item.disabled > .page-link {
font-size: 24px;
}
.text-white {
color: #ffffff;
}

View File

@ -27,3 +27,40 @@
.cursor-pointer {
cursor: pointer;
}
nav > .pagination {
display: flex;
list-style: none;
padding-inline-start: unset;
justify-content: center;
}
.pagination > .page-item {
display: block;
list-style: none;
padding-right: 8px;
font-size: 1.5rem;
color: black;
}
.pagination > .page-item:last-child {
padding: 0;
}
.pagination > .page-item.disabled {
color: darkgrey;
}
.pagination > .page-item.active {
font-weight: bold;
}
.page-item.active > span {
font-size: 24px;
}
.pagination > .page-item.disabled > .page-link {
font-size: 24px;
}

View File

@ -79,6 +79,7 @@
</div>
</div>
@endforeach
{{ $events->links() }}
@else
<p class="text-center" style="margin-bottom: auto">{{__('msg.dereringenaktiviteter')}}!</p>
@endif

View File

@ -54,6 +54,7 @@
</div>
</div>
@endforeach
{{ $guides->links() }}
@else
<p style="margin: 0 18px; margin-bottom: auto; text-align: center">{{__('msg.dereringenvejledninger')}}.</p>
@endif

View File

@ -69,8 +69,11 @@
@endforeach
@if(count(\App\News::query()->orderBy("created_at", "desc")->get()) == 0)
<p class="text-center">{{__('msg.ingennyheder')}}</p>
@else
{{ $news->links() }}
@endif
<div id="snackbar"></div>
</main>
@endsection
@section("scripts")

View File

@ -22,6 +22,8 @@
@endforeach
@if(count($reservations) < 1)
<p style="margin: 0 18px;">{{__('msg.duharingenreservationer')}}.</p>
@else
{{ $reservations->links() }}
@endif
<a href="{{ route("washing-reservations.create") }}" class="btn btn-sde-blue mt-auto mb-1">{{__('msg.reservervaskemaskine')}}</a>
</main>