Skip to content

Commit d709adf

Browse files
committed
update: use html popover api for javascript-less dialogs
1 parent 729028e commit d709adf

File tree

24 files changed

+283
-258
lines changed

24 files changed

+283
-258
lines changed

resources/views/Staff/application/show.blade.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,17 +118,17 @@
118118
@else
119119
<h2 class="panel__heading">{{ __('common.action') }}</h2>
120120
<div class="panel__body">
121-
<div x-data="dialog">
121+
<div>
122122
<p class="form__group form__group--horizontal">
123123
<button
124124
class="form__button form__button--filled form__button--centered"
125-
x-bind="showDialog"
125+
popovertarget="dialog-approve"
126126
>
127127
<i class="{{ config('other.font-awesome') }} fa-check"></i>
128128
{{ __('request.approve') }}
129129
</button>
130130
</p>
131-
<dialog class="dialog" x-bind="dialogElement">
131+
<dialog id="dialog-approve" class="dialog" popover>
132132
<h3 class="dialog__heading">
133133
{{ __('request.approve') }}
134134
{{ __('common.this') }}
@@ -165,27 +165,27 @@ class="form__textarea"
165165
{{ __('request.approve') }}
166166
</button>
167167
<button
168-
formmethod="dialog"
169-
formnovalidate
170168
class="form__button form__button--outlined"
169+
type="button"
170+
popovertarget="dialog-approve"
171171
>
172172
{{ __('common.cancel') }}
173173
</button>
174174
</p>
175175
</form>
176176
</dialog>
177177
</div>
178-
<div x-data="dialog">
178+
<div>
179179
<p class="form__group form__group--horizontal">
180180
<button
181181
class="form__button form__button--filled form__button--centered"
182-
x-bind="showDialog"
182+
popovertarget="dialog-reject"
183183
>
184184
<i class="{{ config('other.font-awesome') }} fa-times"></i>
185185
{{ __('request.reject') }}
186186
</button>
187187
</p>
188-
<dialog class="dialog" x-bind="dialogElement">
188+
<dialog id="dialog-reject" class="dialog" popover>
189189
<h3 class="dialog__heading">
190190
{{ __('request.reject') }}
191191
{{ __('common.this') }}
@@ -217,9 +217,9 @@ class="dialog__form"
217217
{{ __('request.reject') }}
218218
</button>
219219
<button
220-
formmethod="dialog"
221-
formnovalidate
222220
class="form__button form__button--outlined"
221+
type="button"
222+
popovertarget="dialog-reject"
223223
>
224224
{{ __('common.cancel') }}
225225
</button>

resources/views/Staff/giveaway/edit.blade.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,16 @@ class="form__button form__button--outlined"
125125
<header class="panel__header">
126126
<h2 class="panel__heading">{{ __('event.prizes') }}</h2>
127127
<div class="panel__actions">
128-
<div class="panel__action" x-data="dialog">
129-
<button class="form__button form__button--text" x-bind="showDialog">
128+
<div class="panel__action">
129+
<button class="form__button form__button--text" popovertarget="prize-add">
130130
{{ __('common.add') }}
131131
</button>
132-
<dialog class="dialog" x-bind="dialogElement">
132+
<dialog id="prize-add" class="dialog" popover>
133133
<h3 class="dialog__heading">{{ __('event.add-prize') }}</h3>
134134
<form
135135
class="dialog__form"
136136
method="POST"
137137
action="{{ route('staff.giveaways.prizes.store', ['giveaway' => $giveaway]) }}"
138-
x-bind="dialogForm"
139138
>
140139
@csrf
141140
<input type="hidden" name="giveaway_id" value="{{ $giveaway->id }}" />
@@ -199,9 +198,9 @@ class="form__text"
199198
{{ __('common.add') }}
200199
</button>
201200
<button
202-
formmethod="dialog"
203-
formnovalidate
204201
class="form__button form__button--outlined"
202+
type="button"
203+
popovertarget="prize-add"
205204
>
206205
{{ __('common.cancel') }}
207206
</button>
@@ -240,22 +239,25 @@ class="form__button form__button--outlined"
240239
<td>{{ $prize->weight }}</td>
241240
<td>
242241
<menu class="data-table__actions">
243-
<li class="data-table__action" x-data="dialog">
242+
<li class="data-table__action">
244243
<button
245244
class="form__button form__button--text"
246-
x-bind="showDialog"
245+
popovertarget="prize-edit-{{ $prize->id }}"
247246
>
248247
{{ __('common.edit') }}
249248
</button>
250-
<dialog class="dialog" x-bind="dialogElement">
249+
<dialog
250+
id="prize-edit-{{ $prize->id }}"
251+
class="dialog"
252+
popover
253+
>
251254
<h3 class="dialog__heading">
252255
{{ __('event.edit-prize') }}
253256
</h3>
254257
<form
255258
class="dialog__form"
256259
method="POST"
257260
action="{{ route('staff.giveaways.prizes.update', ['giveaway' => $giveaway, 'prize' => $prize]) }}"
258-
x-bind="dialogForm"
259261
>
260262
@csrf
261263
@method('PATCH')
@@ -355,9 +357,9 @@ class="form__button form__button--filled"
355357
{{ __('common.edit') }}
356358
</button>
357359
<button
358-
formmethod="dialog"
359-
formnovalidate
360360
class="form__button form__button--outlined"
361+
type="button"
362+
popovertarget="prize-edit-{{ $prize->id }}"
361363
>
362364
{{ __('common.cancel') }}
363365
</button>

resources/views/Staff/internals/edit.blade.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,16 @@ class="form__text"
7979
<header class="panel__header">
8080
<h2 class="panel__heading">{{ __('common.members') }}</h2>
8181
<div class="panel__actions">
82-
<div class="panel__action" x-data="dialog">
83-
<button class="form__button form__button--text" x-bind="showDialog">
82+
<div class="panel__action">
83+
<button class="form__button form__button--text" popovertarget="user-add">
8484
{{ __('common.add') }}
8585
</button>
86-
<dialog class="dialog" x-bind="dialogElement">
86+
<dialog id="user-add" class="dialog" popover>
8787
<h3 class="dialog__heading">Add user to {{ $internal->name }}</h3>
8888
<form
8989
class="dialog__form"
9090
method="POST"
9191
action="{{ route('staff.internal_users.store') }}"
92-
x-bind="dialogForm"
9392
>
9493
@csrf
9594
<input type="hidden" name="internal_id" value="{{ $internal->id }}" />
@@ -126,9 +125,9 @@ class="form__text"
126125
{{ __('common.add') }}
127126
</button>
128127
<button
129-
formmethod="dialog"
130-
formnovalidate
131128
class="form__button form__button--outlined"
129+
type="button"
130+
popovertarget="user-add"
132131
>
133132
{{ __('common.cancel') }}
134133
</button>
@@ -163,20 +162,23 @@ class="form__button form__button--outlined"
163162
</td>
164163
<td>
165164
<menu class="data-table__actions">
166-
<li class="data-table__action" x-data="dialog">
165+
<li class="data-table__action">
167166
<button
168167
class="form__button form__button--text"
169-
x-bind="showDialog"
168+
popovertarget="user-edit-{{ $user->username }}"
170169
>
171170
{{ __('common.edit') }}
172171
</button>
173-
<dialog class="dialog" x-bind="dialogElement">
172+
<dialog
173+
id="user-edit-{{ $user->username }}"
174+
class="dialog"
175+
popover
176+
>
174177
<h3 class="dialog__heading">Edit internal user</h3>
175178
<form
176179
class="dialog__form"
177180
method="POST"
178181
action="{{ route('staff.internal_users.update', ['internalUser' => $user->pivot->id]) }}"
179-
x-bind="dialogForm"
180182
>
181183
@csrf
182184
@method('PATCH')
@@ -211,9 +213,9 @@ class="form__button form__button--filled"
211213
{{ __('common.add') }}
212214
</button>
213215
<button
214-
formmethod="dialog"
215-
formnovalidate
216216
class="form__button form__button--outlined"
217+
type="button"
218+
popovertarget="user-edit-{{ $user->username }}"
217219
>
218220
{{ __('common.cancel') }}
219221
</button>

resources/views/Staff/moderation/partials/_delete-dialog.blade.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
<li class="data-table__action" x-data="dialog">
2-
<button class="form__button form__button--filled" x-bind="showDialog">
1+
<li class="data-table__action">
2+
<button
3+
class="form__button form__button--filled"
4+
popovertarget="torrent-delete-{{ $torrent->id }}"
5+
>
36
<i class="{{ config('other.font-awesome') }} fa-thumbs-down"></i>
47
{{ __('common.delete') }}
58
</button>
6-
<dialog class="dialog" x-bind="dialogElement">
9+
<dialog id="torrent-delete-{{ $torrent->id }}" class="dialog" popover>
710
<h4 class="dialog__heading">
811
{{ __('common.delete') }} {{ __('torrent.torrent') }}: {{ $torrent->name }}
912
</h4>
1013
<form
1114
class="dialog__form"
1215
method="POST"
1316
action="{{ route('torrents.destroy', ['id' => $torrent->id]) }}"
14-
x-bind="dialogForm"
1517
>
1618
@csrf
1719
@method('DELETE')
@@ -30,9 +32,9 @@ class="dialog__form"
3032
{{ __('common.delete') }}
3133
</button>
3234
<button
33-
formmethod="dialog"
34-
formnovalidate
3535
class="form__button form__button--outlined"
36+
type="button"
37+
popovertarget="torrent-delete-{{ $torrent->id }}"
3638
>
3739
{{ __('common.cancel') }}
3840
</button>

resources/views/Staff/moderation/partials/_postpone-dialog.blade.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
<li class="data-table__action" x-data="dialog">
2-
<button class="form__button form__button--filled" x-bind="showDialog">
1+
<li class="data-table__action">
2+
<button
3+
class="form__button form__button--filled"
4+
popovertarget="torrent-postpone-{{ $torrent->id }}"
5+
>
36
<i class="{{ config('other.font-awesome') }} fa-pause"></i>
47
{{ __('common.moderation-postpone') }}
58
</button>
6-
<dialog class="dialog" x-bind="dialogElement">
9+
<dialog id="torrent-postpone-{{ $torrent->id }}" class="dialog" popover>
710
<h4 class="dialog__heading">
811
{{ __('common.moderation-postpone') }} {{ __('torrent.torrent') }}:
912
{{ $torrent->name }}
@@ -12,7 +15,6 @@
1215
class="dialog__form"
1316
method="POST"
1417
action="{{ route('staff.moderation.update', ['id' => $torrent->id]) }}"
15-
x-bind="dialogForm"
1618
>
1719
@csrf
1820
<input type="hidden" name="type" value="{{ __('torrent.torrent') }}" />
@@ -36,9 +38,9 @@ class="dialog__form"
3638
{{ __('common.moderation-postpone') }}
3739
</button>
3840
<button
39-
formmethod="dialog"
40-
formnovalidate
4141
class="form__button form__button--outlined"
42+
type="button"
43+
popovertarget="torrent-postpone-{{ $torrent->id }}"
4244
>
4345
{{ __('common.cancel') }}
4446
</button>

resources/views/Staff/moderation/partials/_reject-dialog.blade.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
<li class="data-table__action" x-data="dialog">
2-
<button class="form__button form__button--filled" x-bind="showDialog">
1+
<li class="data-table__action">
2+
<button
3+
class="form__button form__button--filled"
4+
popovertarget="torrent-reject-{{ $torrent->id }}"
5+
>
36
<i class="{{ config('other.font-awesome') }} fa-thumbs-down"></i>
47
{{ __('common.moderation-reject') }}
58
</button>
6-
<dialog class="dialog" x-bind="dialogElement">
9+
<dialog id="torrent-reject-{{ $torrent->id }}" class="dialog" popover>
710
<h3 class="dialog__heading">
811
{{ __('common.moderation-reject') }} {{ __('torrent.torrent') }}:
912
{{ $torrent->name }}
@@ -12,7 +15,6 @@
1215
class="dialog__form"
1316
method="POST"
1417
action="{{ route('staff.moderation.update', ['id' => $torrent->id]) }}"
15-
x-bind="dialogForm"
1618
>
1719
@csrf
1820
<input id="type" type="hidden" name="type" value="{{ __('torrent.torrent') }}" />
@@ -36,9 +38,9 @@ class="dialog__form"
3638
{{ __('common.moderation-reject') }}
3739
</button>
3840
<button
39-
formmethod="dialog"
40-
formnovalidate
4141
class="form__button form__button--outlined"
42+
type="button"
43+
popovertarget="torrent-reject-{{ $torrent->id }}"
4244
>
4345
{{ __('common.cancel') }}
4446
</button>

resources/views/Staff/region/index.blade.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,18 @@ class="form__button form__button--text"
5656
{{ __('common.edit') }}
5757
</a>
5858
</li>
59-
<li class="data-table__action" x-data="dialog">
59+
<li class="data-table__action">
6060
<button
6161
class="form__button form__button--text"
62-
x-bind="showDialog"
62+
popovertarget="region-delete-{{ $region->id }}"
6363
>
6464
{{ __('common.delete') }}
6565
</button>
66-
<dialog class="dialog" x-bind="dialogElement">
66+
<dialog
67+
id="region-delete-{{ $region->id }}"
68+
class="dialog"
69+
popover
70+
>
6771
<h4 class="dialog__heading">
6872
Delete torrent region:
6973
{{ $region->name . ' (' . __('regions.' . $region->name) . ')' }}
@@ -72,7 +76,6 @@ class="form__button form__button--text"
7276
class="dialog__form"
7377
method="POST"
7478
action="{{ route('staff.regions.destroy', ['region' => $region]) }}"
75-
x-bind="dialogForm"
7679
>
7780
@csrf
7881
@method('DELETE')
@@ -115,9 +118,9 @@ class="form__button form__button--filled"
115118
{{ __('common.delete') }}
116119
</button>
117120
<button
118-
formmethod="dialog"
119-
formnovalidate
120121
class="form__button form__button--outlined"
122+
type="button"
123+
popovertarget="region-delete-{{ $region->id }}"
121124
>
122125
{{ __('common.cancel') }}
123126
</button>

0 commit comments

Comments
 (0)