module PhantomHelpers::ViewHelpers::ModalHelper

Public Instance Methods

index_modal_for(id, &block) click to toggle source
# File lib/phantom_helpers/view_helpers/modal_helper.rb, line 30
def index_modal_for(id, &block)
  content_tag :div, class: "modal d-none", id: id, wmode: "opaque" do
    content_tag :div, class: "col-md-12 alert-dismissable" do
      content_tag :div, class: "panel panel-primary" do
        block.call
      end
    end
  end
end
modal_body(&block) click to toggle source
modal_for(id, &block) click to toggle source
modal_header(text) click to toggle source
panel_for(id, type='default', &block) click to toggle source
# File lib/phantom_helpers/view_helpers/modal_helper.rb, line 5
def panel_for(id, type='default', &block)
  content_tag :div, id: id, class: "panel panel-#{type}" do
    block.call
  end
end
panel_header(text, object=nil) click to toggle source
# File lib/phantom_helpers/view_helpers/modal_helper.rb, line 11
def panel_header(text, object=nil)
  content_tag :div, class: 'panel-heading clearfix' do
    concat(content_tag(:h3, class: 'panel-title pull-left') { "#{text}"})
    concat(content_tag(:h3, class: 'panel-title pull-right') { updated_at_text(object) }) if object
  end
end
updated_at_text(object) click to toggle source
# File lib/phantom_helpers/view_helpers/modal_helper.rb, line 18
def updated_at_text(object)
  "#{t(:'phantom_helpers.updated')}: #{time_ago_in_words(object.updated_at)} #{t(:'phantom_helpers.ago')}"
end

Private Instance Methods

modal_close_button() click to toggle source
panel_title(title, close_button) click to toggle source
# File lib/phantom_helpers/view_helpers/modal_helper.rb, line 52
def panel_title(title, close_button)
  content_tag :div, class: "panel-heading" do
    content_tag :h3, class: "panel-title" do
      concat close_button
      concat(title ||= ' ')
    end
  end
end