From c9531af77b2a378c5bc9e81952a038ed43f43580 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 21 Apr 2021 15:26:27 -0300 Subject: [PATCH] =?UTF-8?q?rails=20ya=20soportaba=20deshabilitar=20durante?= =?UTF-8?q?=20el=20env=C3=ADo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/submit_once_controller.js | 15 ----------- app/views/sites/_build.haml | 25 ++++++------------- 2 files changed, 8 insertions(+), 32 deletions(-) delete mode 100644 app/javascript/controllers/submit_once_controller.js diff --git a/app/javascript/controllers/submit_once_controller.js b/app/javascript/controllers/submit_once_controller.js deleted file mode 100644 index b47a33e..0000000 --- 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 d9d6be8..6bc4d11 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?