Module: PhantomHelpers::ViewHelpers::ModalHelper

Defined in:
lib/phantom_helpers/view_helpers/modal_helper.rb

Instance Method Summary collapse

Instance Method Details

#index_modal_for(id, &block) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'lib/phantom_helpers/view_helpers/modal_helper.rb', line 30

def index_modal_for(id, &block)
   :div, class: "modal d-none", id: id, wmode: "opaque" do
     :div, class: "col-md-12 alert-dismissable" do
       :div, class: "panel panel-primary" do
        block.call
      end
    end
  end
end


40
41
42
43
44
# File 'lib/phantom_helpers/view_helpers/modal_helper.rb', line 40

def modal_body(&block)
  (:div, class: "panel-body") do
    block.call
  end
end


22
23
24
25
26
27
28
# File 'lib/phantom_helpers/view_helpers/modal_helper.rb', line 22

def modal_for(id, &block)
   :div, class: "modal d-none", id: id, wmode: "opaque" do
     :div, class: "col-md-12 alert-dismissable" do
      block.call
    end
  end
end


46
47
48
# File 'lib/phantom_helpers/view_helpers/modal_helper.rb', line 46

def modal_header(text)
  panel_title(text, modal_close_button)
end

#panel_for(id, type = 'default', &block) ⇒ Object



5
6
7
8
9
# File 'lib/phantom_helpers/view_helpers/modal_helper.rb', line 5

def panel_for(id, type='default', &block)
   :div, id: id, class: "panel panel-#{type}" do
    block.call
  end
end

#panel_header(text, object = nil) ⇒ Object



11
12
13
14
15
16
# File 'lib/phantom_helpers/view_helpers/modal_helper.rb', line 11

def panel_header(text, object=nil)
   :div, class: 'panel-heading clearfix' do
    concat((:h3, class: 'panel-title pull-left') { "#{text}"})
    concat((:h3, class: 'panel-title pull-right') { updated_at_text(object) }) if object
  end
end

#updated_at_text(object) ⇒ Object



18
19
20
# 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