Arreglar vistas

This commit is contained in:
f 2021-08-01 22:05:59 -03:00
parent 2be57ad3af
commit bb2697f63e
10 changed files with 21 additions and 33 deletions

View file

@ -4,6 +4,8 @@
class DeployJob < ApplicationJob
class DeployException < StandardError; end
attr_reader :site
# rubocop:disable Metrics/MethodLength
def perform(site, notify = true)
ActiveRecord::Base.connection_pool.with_connection do
@ -17,9 +19,9 @@ class DeployJob < ApplicationJob
@site.update status: 'building'
# Asegurarse que DeployLocal sea el primero!
@deployed = { deploy_local: deploy_locally }
@deployed = { deploy_local: site.deploy_local.deploy }
# No es opcional
# TODO: No es opcional?
unless @deployed[:deploy_local]
@site.update status: 'waiting'
notify_usuaries if notify
@ -37,14 +39,6 @@ class DeployJob < ApplicationJob
private
def deploy_local
@deploy_local ||= @site.deploys.find_by(type: 'DeployLocal')
end
def deploy_locally
deploy_local.deploy
end
def deploy_others
@site.deploys.where.not(type: 'DeployLocal').find_each do |d|
@deployed[d.type.underscore.to_sym] = d.deploy

View file

@ -13,7 +13,7 @@ class DeployMailer < ApplicationMailer
@usuarie = Usuarie.find(params[:usuarie])
@site = @usuarie.sites.find(params[:site])
@deploys = which_ones
@deploy_local = @site.deploys.find_by(type: 'DeployLocal')
@deploy_local = @site.deploy_local
# Informamos a cada quien en su idioma y damos una dirección de
# respuesta porque a veces les usuaries nos escriben

View file

@ -1,6 +1,6 @@
%h1= t('.hi')
= sanitize_markdown t('.explanation', fqdn: @deploy_local.site.hostname),
= sanitize_markdown t('.explanation', url: @site.deploy_local.url),
tags: %w[p a strong em]
%table

View file

@ -1,6 +1,6 @@
= '# ' + t('.hi')
\
= t('.explanation', fqdn: @deploy_local.site.hostname)
= t('.explanation', url: @site.deploy_local.url)
\
= Terminal::Table.new do |table|
- table << [t('.th.type'), t('.th.status')]

View file

@ -14,10 +14,9 @@
'0', '1'
= deploy.label :_destroy, class: 'custom-control-label' do
%h3= t('.title')
= sanitize_markdown t('.help', public_url: deploy.object.site.url),
= sanitize_markdown t('.help', public_url: site.deploy_local.url),
tags: %w[p strong em a]
- if deploy.object.fqdn
= sanitize_markdown t('.help_2', url: deploy.object.url),
tags: %w[p strong em a]
= sanitize_markdown t('.help_2', url: deploy.object.url),
tags: %w[p strong em a]
%hr/

View file

@ -6,7 +6,7 @@
.row
.col
%h3= t('.title')
= sanitize_markdown t('.help', fqdn: deploy.object.site.hostname),
= sanitize_markdown t('.help', url: deploy.object.url),
tags: %w[p strong em a]
= deploy.hidden_field :type

View file

@ -15,6 +15,6 @@
'0', '1'
= deploy.label :_destroy, class: 'custom-control-label' do
%h3= t('.title')
= sanitize_markdown t('.help', fqdn: deploy.object.fqdn),
= sanitize_markdown t('.help', url: deploy.object.url),
tags: %w[p strong em a]
%hr/

View file

@ -15,10 +15,5 @@
'0', '1'
= deploy.label :_destroy, class: 'custom-control-label' do
%h3= t('.title')
-# TODO: secar la generación de URLs
- name = site.name || t('.ejemplo')
= sanitize_markdown t('.help',
fqdn: deploy.object.site.hostname,
file: deploy.object.file || "#{name}.zip"),
tags: %w[p strong em a]
= sanitize_markdown t('.help', url: deploy.object.url), tags: %w[p strong em a]
%hr/

View file

@ -70,7 +70,7 @@ en:
hi: "Hi!"
explanation: |
This e-mail is to notify you that Sutty has built your site, which is
available at <https://%{fqdn}>.
available at <%{url}/>.
You'll find details below.
th:
@ -195,7 +195,7 @@ en:
deploy_local:
title: 'Host at Sutty'
help: |
The site will be available at <https://%{fqdn}/>.
The site will be available at <%{url}/>.
We're working out the details to allow you to use your own site
domains, you can [help us](https://sutty.nl/en/index.html#contact)!
@ -211,7 +211,7 @@ en:
title: 'Add www to the address'
help: |
When you enable this option, your site will also be available
under <https://%{fqdn}/>.
under <%{url}/>.
The www prefix has been a way of referring to
computers that are available on the World Wide Web. Since
@ -222,7 +222,7 @@ en:
help: |
ZIP files contain and compress all your site's files. With
this option you can download and also share your entire site
through the <https://%{fqdn}/%{file}> address, keep it as backup
through the <%{url}> address, keep it as backup
or have a strategy of solidary hosting, where many people
share a copy of your site.

View file

@ -70,7 +70,7 @@ es:
hi: "¡Hola!"
explanation: |
Este correo es para notificarte que Sutty ha generado tu sitio y
ya está disponible en la dirección <https://%{fqdn}>.
ya está disponible en la dirección <%{url}>.
A continuación encontrarás el detalle de lo que hicimos.
th:
@ -197,7 +197,7 @@ es:
deploy_local:
title: 'Alojar en Sutty'
help: |
El sitio estará disponible en <https://%{fqdn}/>.
El sitio estará disponible en <%{url}/>.
Estamos desarrollando la posibilidad de agregar tus propios
dominios, ¡ayudanos!
@ -213,7 +213,7 @@ es:
title: 'Agregar www a la dirección'
help: |
Cuando habilitas esta opción, tu sitio también estará disponible
como <https://%{fqdn}/>.
como <%{url}/>.
El prefijo www para las direcciones web ha sido una forma de
referirse a las computadoras que están disponibles en la _World
@ -226,7 +226,7 @@ es:
help: |
Los archivos ZIP contienen y comprimen todos los archivos de tu
sitio. Con esta opción podrás descargar y compartir tu sitio
entero a través de la dirección <https://%{fqdn}/%{file}> y
entero a través de la dirección <%{url}> y
guardarla como copia de seguridad o una estrategia de
alojamiento solidario, donde muchas personas comparten una copia
de tu sitio.