diff --git a/app/javascript/controllers/submit_once_controller.js b/app/javascript/controllers/submit_once_controller.js deleted file mode 100644 index b47a33e2..00000000 --- a/app/javascript/controllers/submit_once_controller.js +++ /dev/null @@ -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. - * - *
- */ -export default class extends Controller { - disable (event) { - event.target.disabled = true - } -} diff --git a/app/views/sites/_build.haml b/app/views/sites/_build.haml index d9d6be83..6bc4d11b 100644 --- a/app/views/sites/_build.haml +++ b/app/views/sites/_build.haml @@ -1,18 +1,9 @@ - if policy(site).build? - - if site.enqueued? - = render 'layouts/btn_with_tooltip', - tooltip: t('help.sites.enqueued'), - text: t('sites.enqueued'), - type: 'secondary', - link: nil, - disabled: true - - else - = 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') + = form_tag site_enqueue_path(site), + method: :post, + class: 'form-inline inline' do + = submit_tag site.enqueued? ? t('sites.enqueued') : t('sites.enqueue'), + class: 'btn no-border-radius', + title: site.enqueued? ? t('help.sites.enqueued') : t('help.sites.enqueue'), + data: { disable_with: t('sites.enqueued') }, + disabled: site.enqueued?