Module: Spree::Admin::ModalHelper

Defined in:
app/helpers/spree/admin/modal_helper.rb

Instance Method Summary collapse

Instance Method Details

render a close button for the modal

Returns:

  • (String)


18
19
20
# File 'app/helpers/spree/admin/modal_helper.rb', line 18

def modal_close_button
  button_tag('', type: 'button', class: 'btn-close', data: { dismiss: 'modal', aria_label: Spree.t(:close) }).html_safe
end

render a discard button for the modal

Returns:

  • (String)


24
25
26
27
28
# File 'app/helpers/spree/admin/modal_helper.rb', line 24

def modal_discard_button
  button_tag(type: 'button', class: 'btn btn-light mr-auto', data: { dismiss: 'modal' }) do
    Spree.t('actions.discard')
  end.html_safe
end

render a header for the modal

Parameters:

  • title (String, Proc)

    the title of the modal

Returns:

  • (String)


7
8
9
10
11
12
13
14
# File 'app/helpers/spree/admin/modal_helper.rb', line 7

def modal_header(title)
  Spree::Deprecation.warn('Bootstrap modals are deprecated and will be removed in Spree 5.5. Please use native dialogs with `dialog_header` helper.')

  title = capture(&title) if block_given?
  (:div, class: 'modal-header') do
    (:h5, title, class: 'modal-title') + modal_close_button
  end.html_safe
end