mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 15:56:20 +00:00
44 lines
1.7 KiB
Text
44 lines
1.7 KiB
Text
-#
|
|
# Modal
|
|
|
|
@see {https://getbootstrap.com/docs/4.6/components/modal/}
|
|
@see {https://github.com/bullet-train-co/nice_partials/issues/99}
|
|
@param :id [String] El ID del modal
|
|
@param :modal_content_attributes [Hash] Atributos para el contenido del modal
|
|
@param :hide_actions [Array<String>] Acciones al ocultar el modal
|
|
@yield :ID_body Contenido
|
|
@yield :ID_header Contenido del header (opcional)
|
|
@yield :ID_footer Contenido del pie (opcional)
|
|
@example
|
|
= render 'bootstrap/modal', id: 'algo' do |partial|
|
|
- content_for :algo_header do
|
|
= 'título'
|
|
- content_for :algo_body do
|
|
= 'contenido'
|
|
- content_for :algo_footer do
|
|
= 'pie'
|
|
|
|
:ruby
|
|
local_assigns[:hide_actions] ||= []
|
|
local_assigns[:hide_actions] << 'click->modal#hide'
|
|
local_assigns[:keydown_actions] ||= []
|
|
local_assigns[:keydown_actions] << 'keydown->modal#hideWithEscape'
|
|
local_assigns[:modal_content_attributes] ||= {}
|
|
|
|
-# XXX: Necesario para poder generar todas las demás
|
|
= yield
|
|
|
|
.modal.fade{ tabindex: -1, aria: { hidden: 'true' }, data: { 'modal-target': 'modal', action: local_assigns[:keydown_actions].join(' ') } }
|
|
.modal-backdrop.fade{ data: { 'modal-target': 'backdrop', action: local_assigns[:hide_actions].join(' ') } }
|
|
.modal-dialog.modal-dialog-scrollable.modal-dialog-centered.modal-lg
|
|
.modal-content{ **local_assigns[:modal_content_attributes] }
|
|
- if (header = yield(:"#{id}_header")).present?
|
|
.modal-header= header
|
|
|
|
.modal-body= yield(:"#{id}_body")
|
|
|
|
.modal-footer.flex-nowrap
|
|
- if (footer = yield(:"#{id}_footer"))
|
|
= footer
|
|
- else
|
|
%button.btn.btn-secondary.m-0{ type: 'button', data: { action: 'modal#hide' } }= t('.close')
|