5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-15 02:31:42 +00:00
panel/app/views/sites/_form.haml

165 lines
5.4 KiB
Text
Raw Normal View History

- unless site.errors.empty?
.alert.alert-info
%h4= t('.errors.title')
%p.lead= t('.errors.help')
%ul
- site.errors.messages.each_pair do |attr, error|
- attr = attr.to_s
- error.each do |e|
%li= link_to t('activerecord.attributes.site.' + attr) + ' ' + e, '#' + attr
2019-07-31 20:55:34 +00:00
= form_for site, html: { class: form_class(site) } do |f|
- unless site.persisted?
.form-group#name
%h2= f.label :name
%p.lead= sanitize_markdown t('.help.name'), tags: %w[strong]
-#
El dominio contiene letras y números
No puede empezar ni terminar con guiones
No puede estar compuesto solo de números
2019-07-31 20:55:34 +00:00
= f.text_field :name,
class: form_control(site, :name),
required: true,
pattern: '^([a-z0-9][a-z0-9\-]*)?[a-z0-9\.]$',
minlength: 1,
maxlength: 63
- if invalid? site, :name
.invalid-feedback= site.errors.messages[:name].join(', ')
2019-08-01 18:15:31 +00:00
.form-group#title
2019-07-31 20:55:34 +00:00
%h2= f.label :title
%p.lead= t('.help.title')
= f.text_field :title, class: form_control(site, :title),
required: true
- if invalid? site, :title
.invalid-feedback= site.errors.messages[:title].join(', ')
2019-08-01 18:15:31 +00:00
.form-group#description
2019-07-31 20:55:34 +00:00
%h2= f.label :description
%p.lead= t('.help.description')
= f.text_area :description, class: form_control(site, :description),
maxlength: 160, minlength: 50, required: true
- if invalid? site, :description
.invalid-feedback= site.errors.messages[:description].join(', ')
2019-08-01 18:15:31 +00:00
%hr/
.form-group#design_id
2019-07-17 22:18:48 +00:00
%h2= t('.design.title')
%p.lead= t('.help.design')
- if invalid? site, :design_id
.alert.alert-info
= t('activerecord.errors.models.site.attributes.design_id.layout_incompatible.help',
layouts: site.incompatible_layouts.to_sentence)
2020-03-31 21:30:09 +00:00
.row.designs
2019-07-17 22:18:48 +00:00
-# Demasiado complejo para un f.collection_radio_buttons
2020-03-31 21:30:09 +00:00
- Design.all.find_each do |design|
.design.col-md-4.d-flex.flex-column
.custom-control.custom-radio
2019-07-17 22:18:48 +00:00
= f.radio_button :design_id, design.id,
checked: design.id == site.design_id,
disabled: design.disabled,
2020-03-31 21:30:09 +00:00
required: true, class: 'custom-control-input'
= f.label "design_id_#{design.id}", design.name,
class: 'custom-control-label'
.flex-fill
= sanitize_markdown design.description,
tags: %w[p a strong em]
2019-07-17 22:18:48 +00:00
.btn-group{ role: 'group', 'aria-label': t('.design.actions') }
- if design.url
= link_to t('.design.url'), design.url,
2019-09-12 16:55:20 +00:00
target: '_blank', class: 'btn'
2019-07-17 22:18:48 +00:00
- if design.license
= link_to t('.design.license'), design.license,
2019-09-12 16:55:20 +00:00
target: '_blank', class: 'btn'
2019-08-01 18:15:31 +00:00
%hr/
.form-group.licenses#license_id
2019-07-20 00:33:10 +00:00
%h2= t('.licencia.title')
%p.lead= t('.help.licencia')
2020-03-31 21:40:21 +00:00
- Licencia.all.find_each do |licencia|
.row.license
2019-07-20 00:33:10 +00:00
.col
2020-03-31 21:40:21 +00:00
.media.mt-1
= image_tag licencia.icons, alt: licencia.name, class: 'mr-3 mt-4'
.media-body
.custom-control.custom-radio
= f.radio_button :licencia_id, licencia.id,
checked: licencia.id == site.licencia_id,
required: true, class: 'custom-control-input'
= f.label "licencia_id_#{licencia.id}", class: 'custom-control-label' do
= licencia.name
= sanitize_markdown licencia.description,
tags: %w[p a strong em ul ol li h1 h2 h3 h4 h5 h6]
= link_to t('.licencia.url'), licencia.url,
target: '_blank', class: 'btn'
2019-07-20 00:33:10 +00:00
%hr/
2019-08-01 18:15:31 +00:00
.form-group
%h2= t('.privacidad.title')
%p.lead= sanitize_markdown t('.help.privacidad'), tags: %w[a]
%hr/
2020-11-11 21:15:58 +00:00
.form-group#tienda
%h2= t('.tienda.title')
%p.lead
- if site.tienda?
= t('.tienda.help')
- else
= t('.tienda.first_time_html')
.row
.col
.form-group
= f.label :tienda_url
= f.url_field :tienda_url, class: 'form-control'
.col
.form-group
= f.label :tienda_api_key
= f.text_field :tienda_api_key, class: 'form-control'
%hr/
2020-02-19 21:48:22 +00:00
- if site.persisted?
.form-group#contact
2020-06-25 20:06:37 +00:00
%h2= t('.contact.title')
%p.lead= t('.contact.help')
.custom-control.custom-switch
= f.check_box :contact, class: 'custom-control-input'
= f.label :contact, class: 'custom-control-label'
2020-08-22 20:56:37 +00:00
.form-group#acepta_invitades
%h2= t('.acepta_invitades.title')
%p.lead= t('.acepta_invitades.help')
.custom-control.custom-switch
= f.check_box :acepta_invitades, class: 'custom-control-input'
= f.label :acepta_invitades, class: 'custom-control-label'
.form-group#colaboracion_anonima
%h2= t('.colaboracion_anonima.title')
%p.lead= t('.colaboracion_anonima.help')
.custom-control.custom-switch
= f.check_box :colaboracion_anonima, class: 'custom-control-input'
= f.label :colaboracion_anonima, class: 'custom-control-label'
.form-group
%h2= t('.deploys.title')
%p.lead= t('.help.deploys')
= f.fields_for :deploys do |deploy|
= render "deploys/#{deploy.object.type.underscore}",
deploy: deploy, site: site
2020-02-19 21:48:22 +00:00
- else
= f.fields_for :deploys do |deploy|
= deploy.hidden_field :type
2019-07-13 00:20:36 +00:00
.form-group
2019-09-12 16:55:20 +00:00
= f.submit submit, class: 'btn btn-lg btn-block'