5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 21:36:21 +00:00
panel/app/views/sites/_form.haml
2019-09-12 13:55:20 -03:00

97 lines
3 KiB
Text

= form_for site, html: { class: form_class(site) } do |f|
.form-group
%h2= f.label :name
%p.lead= t('.help.name')
-#
El dominio contiene letras y números
No puede empezar ni terminar con guiones
No puede estar compuesto solo de números
= 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(', ')
.form-group
%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(', ')
.form-group
%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(', ')
%hr/
.form-group
%h2= t('.design.title')
%p.lead= t('.help.design')
.row
-# Demasiado complejo para un f.collection_radio_buttons
- Design.all.each do |design|
.col
%h3
= f.radio_button :design_id, design.id,
checked: design.id == site.design_id,
disabled: design.disabled
= f.label "design_id_#{design.id}", design.name
= sanitize_markdown design.description,
tags: %w[p a strong em]
.btn-group{ role: 'group', 'aria-label': t('.design.actions') }
- if design.url
= link_to t('.design.url'), design.url,
target: '_blank', class: 'btn'
- if design.license
= link_to t('.design.license'), design.license,
target: '_blank', class: 'btn'
%hr/
.form-group
%h2= t('.licencia.title')
%p.lead= t('.help.licencia')
- Licencia.all.each do |licencia|
.row
.col
%h3
= f.radio_button :licencia_id, licencia.id,
checked: licencia.id == site.licencia_id
= f.label "licencia_id_#{licencia.id}" do
= image_tag licencia.icons, alt: licencia.name
= licencia.name
= sanitize_markdown licencia.description,
tags: %w[p a strong em ul ol li h1 h2 h3 h4 h5 h6]
.btn-group{ role: 'group', 'aria-label': t('.licencia.actions') }
= link_to t('.licencia.url'), licencia.url,
target: '_blank', class: 'btn'
%hr/
.form-group
%h2= t('.privacidad.title')
%p.lead= sanitize_markdown t('.help.privacidad'), tags: %w[a]
%hr/
.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
%hr/
.form-group
= f.submit submit, class: 'btn btn-lg btn-block'