mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-15 04:11:41 +00:00
poder especificar las columnas
This commit is contained in:
parent
b3518aa6db
commit
4330393b3a
2 changed files with 12 additions and 4 deletions
|
@ -84,6 +84,14 @@ class Post
|
|||
end
|
||||
end
|
||||
|
||||
def cols
|
||||
complex? && contents.dig('cols')
|
||||
end
|
||||
|
||||
def align
|
||||
complex? && contents.dig('align')
|
||||
end
|
||||
|
||||
# El campo es requerido si es complejo y se especifica que lo sea
|
||||
def required?
|
||||
complex? && contents.dig('required')
|
||||
|
|
|
@ -27,10 +27,10 @@
|
|||
= fa_icon 'close', title: t('posts.row.del', group: template.key.humanize)
|
||||
= t('posts.row.del', group: template.key.humanize)
|
||||
-# Separar los campos en dos columnas
|
||||
- template.nested_fields.each_slice(2).to_a.each do |col|
|
||||
.form-row
|
||||
- template.nested_fields.each_slice(template.cols || 2).to_a.each do |col|
|
||||
.form-row{class: "align-items-#{template.align || 'start'}"}
|
||||
- col.each do |nf|
|
||||
.col
|
||||
.col-md
|
||||
-# Si el template es un array, quiere decir que esperamos un array de hashes.
|
||||
-# El valor vacío luego es reemplazado por un id temporal
|
||||
- if template.array?
|
||||
|
@ -51,4 +51,4 @@
|
|||
.extra-groups
|
||||
- if template.array?
|
||||
.clearfix
|
||||
%button.btn.btn-success.btn-block.add-group= t('posts.row.add', group: template.key.humanize)
|
||||
%button.btn.btn-success.btn-block.add-group{data: { group: template.key }}= t('posts.row.add', group: template.key.humanize)
|
||||
|
|
Loading…
Reference in a new issue