Skip to content

Commit d05a9dc

Browse files
joedixonfaissaloux
andauthored
Upgrade Alpine to v3 (#764)
* update alpinejs to v3 * changes for alpinejs v3 * Fix buttons * Update number formatting * Refactor modal to blade component * Fix editor flash on new line * Fix spacing * Apply fixes from StyleCI * Upgrade vulnerabilities * Ignore vscode workspace Co-authored-by: faissaloux <fwahabali@gmail.com>
1 parent 29493ac commit d05a9dc

24 files changed

+328
-950
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88
/public/sitemap.xml
99
/storage/*.key
1010
/vendor
11+
/.vscode
1112
.env
1213
.phpunit.result.cache

app/View/Components/Modal.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
namespace App\View\Components;
4+
5+
use Illuminate\View\Component;
6+
7+
class Modal extends Component
8+
{
9+
public $identifier;
10+
11+
public $title;
12+
13+
public $action;
14+
15+
public $type;
16+
17+
public $submitLabel;
18+
19+
public function __construct(string $identifier, string $title, string $action, string $type = 'delete', string $submitLabel = null)
20+
{
21+
$this->identifier = $identifier;
22+
$this->title = $title;
23+
$this->action = $action;
24+
$this->type = $type;
25+
$this->submitLabel = $submitLabel ?: $this->title;
26+
}
27+
28+
public function render()
29+
{
30+
return view('components.modal');
31+
}
32+
33+
public function method()
34+
{
35+
switch ($this->type) {
36+
case 'delete':
37+
return 'delete';
38+
case 'update':
39+
return 'put';
40+
default:
41+
return 'post';
42+
}
43+
}
44+
}

0 commit comments

Comments
 (0)