mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-23 05:26:22 +00:00
feat: desde el modal, tener interfaz para agregar un artículo nuevo
This commit is contained in:
parent
71b87bfc0b
commit
71a15ae693
1 changed files with 23 additions and 1 deletions
|
@ -5,6 +5,7 @@
|
|||
name = "#{base}[#{attribute}][]"
|
||||
form_id = "form-#{Nanoid.generate}"
|
||||
modal_id = "modal-#{Nanoid.generate}"
|
||||
post_form_id = "post-form-#{Nanoid.generate}"
|
||||
|
||||
%div{ id: modal_id, data: { controller: 'modal array', 'array-original-value': metadata.value.to_json, 'array-new-array-value': site_posts_new_related_post_path(site) } }
|
||||
.form-group
|
||||
|
@ -39,7 +40,28 @@
|
|||
.mb-2{ data: { target: 'array.item', 'searchable-value': value.remove_diacritics.downcase, value: uuid } }
|
||||
= render 'bootstrap/custom_checkbox', name: name, id: "value-#{Nanoid.generate}", value: uuid, checked: metadata.value.include?(uuid), content: value
|
||||
|
||||
-#
|
||||
Según la definición del campo, si hay un filtro, tenemos que poder
|
||||
elegir qué tipo de esquema queremos o si hay uno solo, siempre
|
||||
vamos a enviar ese. Si no hay ninguno, tendríamos que poder elegir
|
||||
entre todos los esquemas.
|
||||
|
||||
- content_for :"#{id}_footer" do
|
||||
.flex-grow-1
|
||||
- layout = metadata.filter[:layout]
|
||||
- if layout.is_a?(String)
|
||||
%input{ type: 'hidden', name: 'layout', value: layout, form: post_form_id }
|
||||
= render 'bootstrap/btn', content: t('.add', layout: site.layouts[layout].humanized_name), form: post_form_id, type: 'submit', class: 'm-0 mr-1'
|
||||
- else
|
||||
- layouts = layout&.map { |x| site.layouts[x] }
|
||||
- layouts ||= site.layouts.values
|
||||
.input-group.w-auto.flex-grow-1.my-0
|
||||
%select.form-control{ form: post_form_id, name: 'layout' }
|
||||
- layouts.each do |layout|
|
||||
%option{ value: layout.name }= layout.humanized_name
|
||||
.input-group-append
|
||||
= render 'bootstrap/btn', content: t('.add', layout: ''), form: post_form_id, type: 'submit', class: 'mb-0 mr-0'
|
||||
= render 'bootstrap/btn', content: t('.accept'), action: 'array#accept modal#hide', class: 'm-0 mr-1'
|
||||
= render 'bootstrap/btn', content: t('.cancel'), action: 'array#cancel modal#hide', class: 'm-0'
|
||||
|
||||
- content_for :post_form do
|
||||
%form{ id: post_form_id }
|
||||
|
|
Loading…
Reference in a new issue