mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 19:26:21 +00:00
feat: recargar el botón de publicar por separado #16180
This commit is contained in:
parent
5e1def1028
commit
5f0672bcae
7 changed files with 23 additions and 11 deletions
|
@ -22,6 +22,12 @@ class SitesController < ApplicationController
|
||||||
render('sites/status', layout: false) if stale? site
|
render('sites/status', layout: false) if stale? site
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def button
|
||||||
|
authorize site
|
||||||
|
|
||||||
|
render('sites/build', layout: false)
|
||||||
|
end
|
||||||
|
|
||||||
# No tenemos propiedades de un sitio aún, así que vamos al listado de
|
# No tenemos propiedades de un sitio aún, así que vamos al listado de
|
||||||
# artículos
|
# artículos
|
||||||
def show
|
def show
|
||||||
|
|
|
@ -61,6 +61,10 @@ class SitePolicy
|
||||||
show? && usuarie?
|
show? && usuarie?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def button?
|
||||||
|
show?
|
||||||
|
end
|
||||||
|
|
||||||
def enqueue?
|
def enqueue?
|
||||||
build?
|
build?
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
= render 'sites/header', site: @site
|
= render 'sites/header', site: @site
|
||||||
|
|
||||||
= render 'sites/status', site: @site
|
= render 'sites/status', site: @site
|
||||||
|
= render 'sites/build', site: @site, class: 'btn-block'
|
||||||
|
|
||||||
%h3= t('posts.new')
|
%h3= t('posts.new')
|
||||||
%table.table.table-sm.mb-3
|
%table.table.table-sm.mb-3
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
- if policy(site).build?
|
- if policy(site).build?
|
||||||
= form_tag site_enqueue_path(site),
|
%div{ 'hx-get': site_button_path(site, class: local_assigns[:class]), 'hx-trigger': 'every 10s', 'hx-swap': 'outerHTML' }
|
||||||
method: :post,
|
= form_tag site_enqueue_path(site),
|
||||||
class: 'form-inline inline' do
|
method: :post,
|
||||||
= submit_tag site.enqueued? ? t('sites.enqueued') : t('sites.enqueue'),
|
class: 'form-inline inline' do
|
||||||
class: "btn btn-secondary #{local_assigns[:class]}",
|
= submit_tag site.enqueued? ? t('sites.enqueued') : t('sites.enqueue'),
|
||||||
title: site.enqueued? ? t('help.sites.enqueued') : t('help.sites.enqueue'),
|
class: "btn btn-secondary #{local_assigns[:class]}",
|
||||||
data: { disable_with: t('sites.enqueued') },
|
title: site.enqueued? ? t('help.sites.enqueued') : t('help.sites.enqueue'),
|
||||||
disabled: !site.waiting?
|
data: { disable_with: t('sites.enqueued') },
|
||||||
|
disabled: !site.waiting?
|
||||||
|
|
|
@ -18,9 +18,7 @@
|
||||||
- message = t('.available')
|
- message = t('.available')
|
||||||
- link = true
|
- link = true
|
||||||
|
|
||||||
-# TODO: Calcular cada cuanto sería óptimo recargar
|
-# TODO: Calcular cada cuánto sería óptimo recargar
|
||||||
%div{ 'hx-get': site_status_path(site), 'hx-trigger': 'every 10s', 'hx-swap': 'outerHTML' }
|
%div{ 'hx-get': site_status_path(site), 'hx-trigger': 'every 10s', 'hx-swap': 'outerHTML' }
|
||||||
= render 'bootstrap/alert' do
|
= render 'bootstrap/alert' do
|
||||||
= link_to_if link, message.html_safe, site_build_stats_path(site), class: 'alert-link'
|
= link_to_if link, message.html_safe, site_build_stats_path(site), class: 'alert-link'
|
||||||
|
|
||||||
= render 'sites/build', site: site, class: 'btn-block'
|
|
||||||
|
|
1
app/views/sites/build.haml
Normal file
1
app/views/sites/build.haml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
= render 'sites/build', site: @site, class: params.permit(:class)[:class]
|
|
@ -38,6 +38,7 @@ Rails.application.routes.draw do
|
||||||
post 'pull', to: 'sites#merge'
|
post 'pull', to: 'sites#merge'
|
||||||
|
|
||||||
get 'status', to: 'sites#status'
|
get 'status', to: 'sites#status'
|
||||||
|
get 'button', to: 'sites#button'
|
||||||
|
|
||||||
# Gestionar usuaries
|
# Gestionar usuaries
|
||||||
get 'usuaries/invite', to: 'usuaries#invite'
|
get 'usuaries/invite', to: 'usuaries#invite'
|
||||||
|
|
Loading…
Reference in a new issue