Skip to content

Commit

Permalink
Fixar för händelsebaren
Browse files Browse the repository at this point in the history
  • Loading branch information
bonny committed Apr 23, 2024
1 parent c207669 commit 2892cfa
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 13 deletions.
4 changes: 2 additions & 2 deletions app/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

/**
Expand Down
14 changes: 10 additions & 4 deletions public/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion resources/views/layouts/web.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function gtag() {

<body class="@if ($shared_notification_bar_contents) has-notification-bar @endif {{ $noAdsReason }}">
@include('parts.notificationbar')
@include('parts.bar-mostread')
@include('parts.bar-events')
@include('parts.siteheader')

<div class="container">
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
<div class="sitebar__mostread">
<ul class="sitebar__mostreadItems">
<div class="sitebar__Events">
<ul class="sitebar__EventsItems">
@foreach ($shared_latest_events as $mostViewedItem)
<li class="sitebar__mostreadItem">
<a class="sitebar__mostreadItemLink" href="{{ $mostViewedItem->getPermalink() }}">
<li class="sitebar__EventsItem">
<a class="sitebar__EventsItemLink" href="{{ $mostViewedItem->getPermalink() }}">
{{ $mostViewedItem->getParsedDateInFormat('%H:%M') }}
{{ $mostViewedItem->title_alt_1 ? $mostViewedItem->title_alt_1 : $mostViewedItem->getSingleEventTitleShort() }}
</a>
Expand Down

0 comments on commit 2892cfa

Please sign in to comment.