Module: Tungsten::NoticeHelper
- Defined in:
- app/helpers/tungsten/notice_helper.rb
Instance Method Summary collapse
- #card_notice(title = nil, options = {}, &block) ⇒ Object
- #card_warning_notice(title = nil, options = {}, &block) ⇒ Object
- #inline_notice(title = nil, options = {}, &block) ⇒ Object
- #inline_warning_notice(title = nil, options = {}, &block) ⇒ Object
- #notice(title = nil, options = {}, &block) ⇒ Object
- #warning_notice(title = nil, options = {}, &block) ⇒ Object
Instance Method Details
#card_notice(title = nil, options = {}, &block) ⇒ Object
18 19 20 21 |
# File 'app/helpers/tungsten/notice_helper.rb', line 18 def card_notice( title=nil, ={}, &block ) [:type] = :'card-notice' notice( title, , &block ) end |
#card_warning_notice(title = nil, options = {}, &block) ⇒ Object
23 24 25 26 |
# File 'app/helpers/tungsten/notice_helper.rb', line 23 def card_warning_notice( title=nil, ={}, &block ) [:type] = :'card-warning-notice' notice( title, , &block ) end |
#inline_notice(title = nil, options = {}, &block) ⇒ Object
8 9 10 11 |
# File 'app/helpers/tungsten/notice_helper.rb', line 8 def inline_notice( title=nil, ={}, &block ) [:type] = :'inline-notice' notice( title, , &block ) end |
#inline_warning_notice(title = nil, options = {}, &block) ⇒ Object
13 14 15 16 |
# File 'app/helpers/tungsten/notice_helper.rb', line 13 def inline_warning_notice( title=nil, ={}, &block ) [:type] = :'inline-warning-notice' notice( title, , &block ) end |
#notice(title = nil, options = {}, &block) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/helpers/tungsten/notice_helper.rb', line 28 def notice( title=nil, ={}, &block ) if title.is_a? Hash = title title = nil end [:class] = "notice #{[:class]}".strip [:class] << " #{[:type]}" if [:type] header = content_tag( :h4, class: 'notice-title' ) { title } if .delete(:dismiss) [:id] = "notice-#{SecureRandom.hex(5)}" header = content_tag( :header, class: 'notice-header' ) { concat header concat 'x-circle', class: 'dismiss-notice', toggle: "##{[:id]}", clear: true } end content_tag( :div, ) { concat header concat content_tag( :div, class: 'notice-content' ) { capture(&block).html_safe if block_given? } } end |
#warning_notice(title = nil, options = {}, &block) ⇒ Object
3 4 5 6 |
# File 'app/helpers/tungsten/notice_helper.rb', line 3 def warning_notice( title=nil, ={}, &block ) [:type] = :warning notice( title, , &block ) end |