Skip to content

Commit

Permalink
imp: Add submit feedback on autosubmit forms
Browse files Browse the repository at this point in the history
  • Loading branch information
marienfressinaud committed Nov 13, 2024
1 parent d2b23f3 commit 61fcba8
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/assets/javascripts/controllers/autosubmit_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ export default class extends Controller {
timeout: Number,
};

static get targets () {
return ['actionButton'];
}

connect () {
if (this.modeValue === 'timeout') {
let timeout;
Expand All @@ -23,5 +27,9 @@ export default class extends Controller {

submit () {
this.element.submit();

if (this.hasActionButtonTarget) {
this.actionButtonTarget.disabled = true;
}
}
};
1 change: 1 addition & 0 deletions src/views/_layouts/not_connected.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
id="locale"
name="locale"
data-action="autosubmit#submit"
data-autosubmit-target="actionButton"
>
<?php foreach ($available_locales as $locale_value => $locale_name): ?>
<option
Expand Down
1 change: 1 addition & 0 deletions src/views/collections/images/edit.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
type="button"
class="button--primary"
data-action="form-file#openFile"
data-autosubmit-target="actionButton"
aria-describedby="file-desc"
>
<?= _('Upload an image') ?>
Expand Down
1 change: 1 addition & 0 deletions src/views/importations/opml/show.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
class="button--primary"
data-action="form-file#openFile"
aria-describedby="opml-desc"
data-autosubmit-target="actionButton"
>
<?= _('Import a file') ?>
</button>
Expand Down
6 changes: 5 additions & 1 deletion src/views/links/searches/show.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@
aria-describedby="url-desc"
/>

<button type="submit" class="button--primary no-mobile">
<button
type="submit"
class="button--primary no-mobile"
data-autosubmit-target="actionButton"
>
<?= _('Search') ?>
</button>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/views/my/profile/edit.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
type="button"
class="button--small"
data-action="form-file#openFile"
data-autosubmit-target="actionButton"
aria-describedby="avatar-desc"
>
<?= _('Upload a photo') ?>
Expand Down
1 change: 1 addition & 0 deletions src/views/onboarding/step1.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
id="locale"
name="locale"
data-action="autosubmit#submit"
data-autosubmit-target="actionButton"
>
<?php foreach ($available_locales as $locale_value => $locale_name): ?>
<option
Expand Down

0 comments on commit 61fcba8

Please sign in to comment.