Skip to content

Commit 84492f7

Browse files
authored
Fix post views bugs (#167)
1 parent bf2c3fd commit 84492f7

File tree

7 files changed

+10
-11
lines changed

7 files changed

+10
-11
lines changed

app/Http/Controllers/ArticlesController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function show(Article $article): View
2828
/** @var User $user */
2929
$user = Auth::user();
3030

31-
views($article)->record();
31+
views($article)->cooldown(now()->addHours(2))->record();
3232

3333
/** @var Article $article */
3434
$article = Cache::remember('post-'.$article->id, now()->addHour(), fn () => $article);
@@ -66,4 +66,4 @@ public function edit(Article $article): View
6666

6767
return view('articles.edit', compact('article'));
6868
}
69-
}
69+
}

app/Http/Livewire/Discussions/AddComment.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ public function saveComment(): void
5151
->duration(5000)
5252
->send();
5353

54-
$this->reset();
54+
$this->reset('body');
5555
}
5656

5757
public function render(): View
5858
{
5959
return view('livewire.discussions.add-comment');
6060
}
61-
}
61+
}

resources/views/articles/show.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
<div>
7070
<h2 class="text-xs leading-5 font-medium tracking-wide uppercase text-skin-base">Article suivant</h2>
7171
<a href="{{ route('articles.show', $next) }}" class="mt-3 flex items-start space-x-2">
72-
<img class="h-8 w-8 object-cover shadow-lg rounded-md" src="{{ $next->getFirstMediaUrl('media') }}" alt="{{ $next->slug }}">
72+
<img class="h-8 w-8 object-cover shadow-lg rounded-md" src="{{ $next->getFirstMediaUrl('media') }}" alt="{{ $next->slug }}" onerror="this.onerror=null;this.src='{{ asset('images/socialcard.png') }}'">
7373
<span class="text-sm font-medium leading-4 text-skin-inverted hover:text-skin-primary-hover line-clamp-2">{{ $next->title }}</span>
7474
</a>
7575
</div>

resources/views/components/articles/card-with-author.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
{!! $article->excerpt(175) !!}
2525
</p>
2626
<div class="relative h-96 overflow-hidden">
27-
<img class="w-full h-full object-cover shadow-lg rounded-lg group-hover:opacity-75" src="{{ $article->getFirstMediaUrl('media') }}" alt="{{ $article->title }}" />
27+
<img class="w-full h-full object-cover shadow-lg rounded-lg group-hover:opacity-75" src="{{ $article->getFirstMediaUrl('media') }}" alt="{{ $article->title }}">
2828
</div>
2929
<div class="flex justify-between space-x-8">
3030
<div class="flex space-x-6">

resources/views/components/articles/card.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
>
1313
<a href="{{ route('articles.show', $article) }}" class="group">
1414
<div class="aspect-w-3 aspect-h-2">
15-
<img class="object-cover shadow-lg rounded-lg group-hover:opacity-75" src="{{ $article->getFirstMediaUrl('media') }}" alt="{{ $article->title }}" />
15+
<img class="object-cover shadow-lg rounded-lg group-hover:opacity-75" src="{{ $article->getFirstMediaUrl('media') }}" alt="{{ $article->title }}">
1616
</div>
1717
</a>
1818
<div

resources/views/components/articles/overview.blade.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
<div class="aspect-w-3 aspect-h-2">
66
<img class="object-cover shadow-lg rounded-lg group-hover:opacity-75"
77
src="{{ $article->getFirstMediaUrl('media') }}"
8-
alt="{{ $article->title }}"
9-
/>
8+
alt="{{ $article->title }}">
109
</div>
1110
</a>
1211
<div class="sm:col-span-2">

resources/views/livewire/articles/_form.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
{{ __('Enregistrer') }}
2323
</button>
2424
<span x-data="{ open: false }" @keydown.escape.stop="open = false;" @click.away="open = false" class="-ml-px relative block">
25-
<button type="button" class="relative inline-flex items-center px-2 py-2 rounded-r-md border border-transparent text-sm font-medium text-white text-white bg-green-600 hover:bg-green-700 focus:z-10 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-body focus:ring-green-500"
25+
<button type="button" class="relative inline-flex items-center px-2 py-2 rounded-r-md border border-transparent text-sm font-medium text-white bg-green-600 hover:bg-green-700 focus:z-10 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-body focus:ring-green-500"
2626
id="option-menu-button"
2727
x-ref="button"
2828
@click="open = !open"
@@ -253,7 +253,7 @@ class="flex items-center justify-center text-sm leading-none text-center rounded
253253
wire:model="title"
254254
name="title"
255255
id="title"
256-
class="block w-full h-auto px-0 py-4 text-3xl sm:text-4xl font-bold placeholder-skin-input focus:placeholder-skin-input-focus font-normal text-skin-inverted bg-transparent border-0 leading-normal border-0 appearance-none focus:ring-0 shadow-none"
256+
class="block w-full h-auto px-0 py-4 text-3xl sm:text-4xl font-bold placeholder-skin-input focus:placeholder-skin-input-focus font-normal text-skin-inverted bg-transparent leading-normal border-0 appearance-none focus:ring-0 shadow-none"
257257
placeholder="Titre de votre article..."
258258
autofocus
259259
autocomplete="off"

0 commit comments

Comments
 (0)