diff --git a/skolehjem/app/Http/Controllers/NewsController.php b/skolehjem/app/Http/Controllers/NewsController.php index ae8a7ff..4f5f491 100644 --- a/skolehjem/app/Http/Controllers/NewsController.php +++ b/skolehjem/app/Http/Controllers/NewsController.php @@ -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 ]); } diff --git a/skolehjem/app/Http/Controllers/RootController.php b/skolehjem/app/Http/Controllers/RootController.php index 28112ee..f6f6283 100644 --- a/skolehjem/app/Http/Controllers/RootController.php +++ b/skolehjem/app/Http/Controllers/RootController.php @@ -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')) - return Response::detect("root.index"); - else - return view('app.root.index'); + $perPage = 2; + + if(auth()->user()->can('admin.panel.show')) { + if(Response::detect("root.index")->name() == "admin.root.index") + return Response::detect("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]); + } } } diff --git a/skolehjem/public/css/admin.css b/skolehjem/public/css/admin.css index 020f5d2..cc83d34 100644 --- a/skolehjem/public/css/admin.css +++ b/skolehjem/public/css/admin.css @@ -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; } diff --git a/skolehjem/public/css/webapp.css b/skolehjem/public/css/webapp.css index 48bd4a0..eb7351b 100644 --- a/skolehjem/public/css/webapp.css +++ b/skolehjem/public/css/webapp.css @@ -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; } diff --git a/skolehjem/public/css/webappdark.css b/skolehjem/public/css/webappdark.css index 238bd99..957eae4 100644 --- a/skolehjem/public/css/webappdark.css +++ b/skolehjem/public/css/webappdark.css @@ -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; } diff --git a/skolehjem/resources/sass/app/general/_displays.scss b/skolehjem/resources/sass/app/general/_displays.scss index 453b071..4145325 100644 --- a/skolehjem/resources/sass/app/general/_displays.scss +++ b/skolehjem/resources/sass/app/general/_displays.scss @@ -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; +} diff --git a/skolehjem/resources/views/admin/locations/show.blade.php b/skolehjem/resources/views/admin/locations/show.blade.php index 8ddf93c..5451d7e 100644 --- a/skolehjem/resources/views/admin/locations/show.blade.php +++ b/skolehjem/resources/views/admin/locations/show.blade.php @@ -13,22 +13,27 @@
Lokation: {{ $location->name }}