From 2892cfad583265561da07e6da898e057b127f9bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A4r=20Thernstr=C3=B6m?= Date: Tue, 23 Apr 2024 13:10:59 +0200 Subject: [PATCH] =?UTF-8?q?Fixar=20f=C3=B6r=20h=C3=A4ndelsebaren?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Helper.php | 4 ++-- app/Providers/AppServiceProvider.php | 2 +- public/css/styles.css | 14 ++++++++++---- resources/views/layouts/web.blade.php | 2 +- ...bar-mostread.blade.php => bar-events.blade.php} | 10 +++++----- 5 files changed, 19 insertions(+), 13 deletions(-) rename resources/views/parts/{bar-mostread.blade.php => bar-events.blade.php} (58%) diff --git a/app/Helper.php b/app/Helper.php index 376ca91a..6694f1b1 100644 --- a/app/Helper.php +++ b/app/Helper.php @@ -1104,11 +1104,11 @@ public static function getLatestEvents(int $count = 5) { return $events; } - public static function getLatestEventsByPubdate(int $count = 5) { + public static function getLatestEventsByParsedDate(int $count = 5) { $cacheKey = __METHOD__ . ":{$count}"; $events = Cache::remember($cacheKey, 2 * 60, function () use ($count) { - $events = CrimeEvent::orderBy("pubdate_iso8601", "desc") + $events = CrimeEvent::orderBy("parsed_date", "desc") ->with('locations') ->limit($count) ->get(); diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index bc6cd4ea..7cb8862d 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -40,7 +40,7 @@ public function boot() { \View::share('shared_most_viewed_events', \App\Helper::getMostViewedEvents(Carbon::now(), 10)); // Nyaste. - \View::share('shared_latest_events', \App\Helper::getLatestEventsByPubdate()); + \View::share('shared_latest_events', \App\Helper::getLatestEventsByParsedDate(10)); } /** diff --git a/public/css/styles.css b/public/css/styles.css index f2e2ef42..ff79c73c 100644 --- a/public/css/styles.css +++ b/public/css/styles.css @@ -1630,11 +1630,11 @@ h2.widget__title { border: 0; } -.sitebar__mostread { +.sitebar__Events { font-size: var(--font-size-small); } -.sitebar__mostreadItems { +.sitebar__EventsItems { list-style-type: none; margin: 0; padding: 0; @@ -1643,13 +1643,19 @@ h2.widget__title { scroll-snap-type: x proximity; } -.sitebar__mostreadItem { +.sitebar__EventsItem { flex: 1 0 80%; scroll-snap-align: start; overflow: hidden; } -.sitebar__mostreadItemLink { +@media only screen and (min-width: 667px) { + .sitebar__EventsItem { + flex: 1 0 20%; + } +} + +.sitebar__EventsItemLink { display: block; overflow: hidden; white-space: nowrap; diff --git a/resources/views/layouts/web.blade.php b/resources/views/layouts/web.blade.php index b4559647..0b28ec98 100644 --- a/resources/views/layouts/web.blade.php +++ b/resources/views/layouts/web.blade.php @@ -135,7 +135,7 @@ function gtag() { @include('parts.notificationbar') - @include('parts.bar-mostread') + @include('parts.bar-events') @include('parts.siteheader')
diff --git a/resources/views/parts/bar-mostread.blade.php b/resources/views/parts/bar-events.blade.php similarity index 58% rename from resources/views/parts/bar-mostread.blade.php rename to resources/views/parts/bar-events.blade.php index 1de918f2..a2625d11 100644 --- a/resources/views/parts/bar-mostread.blade.php +++ b/resources/views/parts/bar-events.blade.php @@ -1,10 +1,10 @@ -{{-- Visar de mest lästa händelserna i en "slider". --}} +{{-- Visar en "notification bar" med händelser i en "slider". --}} @if ($shared_latest_events->count() > 0) -