Module: PhantomHelpers::ViewHelpers::ModalHelper
- Defined in:
- lib/phantom_helpers/view_helpers/modal_helper.rb
Instance Method Summary collapse
- #index_modal_for(id, &block) ⇒ Object
- #modal_body(&block) ⇒ Object
- #modal_for(id, &block) ⇒ Object
- #modal_header(text) ⇒ Object
- #panel_for(id, type = 'default', &block) ⇒ Object
- #panel_header(text, object = nil) ⇒ Object
- #updated_at_text(object) ⇒ Object
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) 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) ⇒ Object
40 41 42 43 44 |
# File 'lib/phantom_helpers/view_helpers/modal_helper.rb', line 40 def modal_body(&block) content_tag(:div, class: "panel-body") do block.call end end |
#modal_for(id, &block) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/phantom_helpers/view_helpers/modal_helper.rb', line 22 def 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 block.call end end end |
#modal_header(text) ⇒ Object
46 47 48 |
# File 'lib/phantom_helpers/view_helpers/modal_helper.rb', line 46 def modal_header(text) panel_title(text, ) 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) content_tag :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) 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) ⇒ 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 |