Sha256: f67648d5eb3304e908193622da2471b591c056663d36029e10e436c02d1716da

Contents?: true

Size: 1.48 KB

Versions: 6

Compression:

Stored size: 1.48 KB

Contents

format :html do
  view :modal_link do |args|
    path_opts = args[:path_opts] || {}
    path_opts.merge!(layout: :modal)
    html_args = args[:html_args] || {}
    html_args.merge!('data-target' => '#modal-main-slot',
                     'data-toggle' => 'modal')
    link_to(args[:text] || _render_title(args), path(path_opts), html_args)
  end

  view :modal_slot do |args|
    id = "modal-#{args[:modal_id] || 'main-slot'}"
    wrap_with(:div, class: 'modal fade', role: 'dialog', id: id) do
      wrap_with(:div, class: 'modal-dialog') do
        content_tag :div, class: 'modal-content' do
          ''
        end
      end
    end
  end

  view :modal_menu, tags: :unknown_ok do
    popout_params = {}
    popout_params[:view] = params[:view] if params[:view]
    # we probably want to pass on a lot more params than just view,
    # but not all of them
    # (eg we don't want layout, id, controller...)
    wrap_with :div, class: 'modal-menu' do
      [
        link_to(glyphicon('remove'), '',
                class: 'close-modal pull-right close',
                'data-dismiss' => 'modal'),
        link_to(glyphicon('new-window'), popout_params,
                class: 'pop-out-modal pull-right close ')
      ]
    end
  end

  view :modal_footer, tags: :unknown_ok do |args|
    args[:buttons] || ''
  end

  def default_modal_footer_args args
    args[:buttons] ||=
      button_tag 'Close',
                 class: 'btn-xs close-modal pull-right',
                 'data-dismiss' => 'modal'
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
card-1.17.4 mod/05_standard/set/all/rich_html/modal.rb
card-1.17.3 mod/05_standard/set/all/rich_html/modal.rb
card-1.17.2 mod/05_standard/set/all/rich_html/modal.rb
card-1.17.1 mod/05_standard/set/all/rich_html/modal.rb
card-1.17.0 mod/05_standard/set/all/rich_html/modal.rb
card-1.16.15 mod/05_standard/set/all/rich_html/modal.rb