mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 19:36:21 +00:00
rails ya soportaba deshabilitar durante el envío
This commit is contained in:
parent
9cf59d7137
commit
c9531af77b
2 changed files with 8 additions and 32 deletions
|
@ -1,15 +0,0 @@
|
||||||
import { Controller } from 'stimulus'
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Deshabilita el elemento que recibe el evento, para evitar que la
|
|
||||||
* acción se realice varias veces.
|
|
||||||
*
|
|
||||||
* <form data-controller="submit-once">
|
|
||||||
* <input type="submit" data-action="submit-once#disable" />
|
|
||||||
* </form>
|
|
||||||
*/
|
|
||||||
export default class extends Controller {
|
|
||||||
disable (event) {
|
|
||||||
event.target.disabled = true
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,18 +1,9 @@
|
||||||
- if policy(site).build?
|
- if policy(site).build?
|
||||||
- if site.enqueued?
|
= form_tag site_enqueue_path(site),
|
||||||
= render 'layouts/btn_with_tooltip',
|
method: :post,
|
||||||
tooltip: t('help.sites.enqueued'),
|
class: 'form-inline inline' do
|
||||||
text: t('sites.enqueued'),
|
= submit_tag site.enqueued? ? t('sites.enqueued') : t('sites.enqueue'),
|
||||||
type: 'secondary',
|
class: 'btn no-border-radius',
|
||||||
link: nil,
|
title: site.enqueued? ? t('help.sites.enqueued') : t('help.sites.enqueue'),
|
||||||
disabled: true
|
data: { disable_with: t('sites.enqueued') },
|
||||||
- else
|
disabled: site.enqueued?
|
||||||
= form_tag site_enqueue_path(site),
|
|
||||||
method: :post,
|
|
||||||
data: { controller: 'submit-once' },
|
|
||||||
class: 'form-inline inline' do
|
|
||||||
= button_tag type: 'submit',
|
|
||||||
class: 'btn no-border-radius',
|
|
||||||
title: t('help.sites.enqueue'),
|
|
||||||
data: { action: 'submit-once#disable' } do
|
|
||||||
= t('sites.enqueue')
|
|
||||||
|
|
Loading…
Reference in a new issue