Skip to content

Commit a5ea96d

Browse files
committed
wip
1 parent cbdedc5 commit a5ea96d

File tree

7 files changed

+27
-20
lines changed

7 files changed

+27
-20
lines changed

app/Actions/Forum/DeleteThreadAction.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public function execute(Thread $thread): void
1515
DB::beginTransaction();
1616

1717
undoPoint(new ThreadCreated($thread));
18+
1819
$thread->delete();
1920

2021
DB::commit();

lang/en/global.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@
8888
'launch_modal' => [
8989
'forum_action' => 'Create thread',
9090
'forum_description' => 'Do you have a question? Ask it in the forum',
91-
'post_action' => 'Writing an article',
92-
'post_description' => 'Share your discoveries with thousands of developers',
91+
'article_action' => 'Writing an article',
92+
'article_description' => 'Share your discoveries with thousands of developers',
9393
'discussion_action' => 'Start a discussion',
9494
'discussion_description' => 'Discuss and debate different themes and ideas',
9595
],

lang/en/pages/article.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
'next_article' => 'Next article',
1212
'prev_article' => 'Previous article',
1313
'share_article' => 'Share',
14-
'new_article' => 'Write a new article',
1514
'advice' => [
1615
'title' => 'Important advices for articles',
1716
'content' => 'Submit your article to the Laravel.cm portal. We\'re looking for high quality articles revolving around Laravel, PHP, JavaScript, CSS, and related topics. Articles can\'t be promotional in nature and should be educational and informative. We reserve the right to decline articles that don\'t meet our quality standards.',
@@ -28,7 +27,7 @@
2827
'draft_help' => 'Putting an article in draft allows you to update it later.',
2928
'unpublished' => 'This article has not yet been published.',
3029
'draft' => 'Draft',
31-
'your_article' => 'Your Articles',
30+
'my_article' => 'My articles',
3231
'not_article_created' => "You haven't created any articles yet",
3332

3433
];

lang/fr/pages/article.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
'next_article' => 'Article suivant',
1212
'prev_article' => 'Article précédent',
1313
'share_article' => 'Partager',
14-
'new_article' => 'Rédiger un article',
1514
'advice' => [
1615
'title' => 'Conseils importants concernant les articles',
1716
'content' => 'Soumettez votre article au site Laravel.cm. Nous recherchons des articles de haute qualité autour de Laravel, PHP, JavaScript, CSS et autres sujets connexes. Les articles ne peuvent pas être de nature promotionnelle et doivent être éducatifs et informatifs. Nous nous réservons le droit de refuser les articles qui ne répondent pas à nos critères de qualité.',
@@ -28,7 +27,7 @@
2827
'draft_help' => 'Mettre en article en brouillon vous donne la possibilité de le modifier plus tard',
2928
'unpublished' => 'Cet article n\'a pas encore été publié.',
3029
'draft' => 'Brouillon',
31-
'your_article' => 'Vos articles',
30+
'my_article' => 'Mes articles',
3231
'not_article_created' => "Vous n'avez pas encore créé d'articles",
3332

3433
];

resources/views/livewire/components/account/articles.blade.php

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
33
declare(strict_types=1);
44
5-
use App\Actions\Article\ArticleDeleteAction;
65
use App\Models\Article;
7-
use Filament\Actions\Action;
6+
use Filament\Actions\Action,
87
use Filament\Actions\Concerns\InteractsWithActions;
98
use Filament\Actions\Contracts\HasActions;
109
use Filament\Forms\Concerns\InteractsWithForms;
@@ -17,11 +16,12 @@
1716
use Illuminate\Support\Facades\Auth;
1817
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
1918
20-
new class extends Component implements HasForms, HasActions {
21-
22-
use WithPagination, WithoutUrlPagination;
19+
new class extends Component implements HasForms, HasActions
20+
{
2321
use InteractsWithActions;
2422
use InteractsWithForms;
23+
use WithPagination;
24+
use WithoutUrlPagination;
2525
2626
#[Computed]
2727
public function articles(): LengthAwarePaginator
@@ -42,7 +42,7 @@ public function editAction(): Action
4242
fn (array $arguments) => $this->dispatch(
4343
'openPanel',
4444
component: 'components.slideovers.article-form',
45-
arguments: ['articleId' => $arguments['article']]
45+
arguments: ['articleId' => $arguments['id']]
4646
)
4747
);
4848
}
@@ -52,16 +52,19 @@ public function deleteAction(): Action
5252
return Action::make('delete')
5353
->label(__('actions.delete'))
5454
->color('danger')
55+
->badge()
5556
->requiresConfirmation()
5657
->action(function (array $arguments): void {
57-
$article = Article::query()->find($arguments['article']);
58+
$article = Article::query()->find($arguments['id']);
59+
60+
$this->authorize('delete', $article);
5861
5962
$article->delete();
6063
6164
Notification::make()
62-
->success()
63-
->title(__('notifications.article.deleted'))
64-
->send();
65+
->success()
66+
->title(__('notifications.article.deleted'))
67+
->send();
6568
});
6669
}
6770
};
@@ -76,10 +79,11 @@ public function deleteAction(): Action
7679
</h2>
7780
</div>
7881
<div class="mt-4 flex md:ml-4 md:mt-0">
79-
<x-buttons.primary class="justify-items-center" type="button"
80-
onclick="Livewire.dispatch('openPanel', { component: 'components.slideovers.article-form' })">
81-
<x-untitledui-message-text-square class="size-5 mr-2" aria-hidden="true" />
82-
{{ __('pages/article.new_article') }}
82+
<x-buttons.primary
83+
class="justify-items-center" type="button"
84+
wire:click="$dispatch('openPanel', { component: 'components.slideovers.article-form' })"
85+
>
86+
{{ __('global.launch_modal.article_action') }}
8387
</x-buttons.primary>
8488
</div>
8589
</div>

resources/views/livewire/components/account/discussions.blade.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22
3+
declare(strict_types=1);
4+
35
use App\Actions\Article\ArticleDeleteAction;
46
use App\Actions\Discussion\DeleteDiscussionAction;
57
use App\Models\Discussion;

resources/views/livewire/components/account/threads.blade.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22
3+
declare(strict_types=1);
4+
35
use App\Actions\Forum\DeleteThreadAction;
46
use App\Models\Thread;
57
use Livewire\Volt\Component;

0 commit comments

Comments
 (0)