Module: Noa::Layout::BaseHelper
- Defined in:
- app/helpers/noa/layout/base_helper.rb
Instance Method Summary collapse
- #layout_copyright(author = nil, href = nil) ⇒ Object
- #layout_flash ⇒ Object
- #layout_logo ⇒ Object
- #layout_page_title ⇒ Object
- #layout_title ⇒ Object
Instance Method Details
#layout_copyright(author = nil, href = nil) ⇒ Object
30 31 32 33 34 35 36 |
# File 'app/helpers/noa/layout/base_helper.rb', line 30 def layout_copyright( = nil, href = nil) ||= noa_application_name content_tag(:div, id: "copyright") do "© #{Time.now.year} ".html_safe + (href ? link_to(, href) : ) end end |
#layout_flash ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'app/helpers/noa/layout/base_helper.rb', line 38 def layout_flash if defined?(Twitter::Bootstrap::Rails) html = Array.new flash.each do |key, msg| case key.to_s when "alert" flash_class = "alert-error" when "notice" flash_class = "alert-info" else flash_class = key.to_s end = '<button type="button" class="close" data-dismiss="alert">×</button>' html << content_tag(:div, .html_safe + ' ' + msg.html_safe, class: ["alert", flash_class, "fade", "in"] ) end html.join.html_safe else html = Array.new flash.each do |name, msg| html << content_tag(:div, msg, class: name) end html.join("\n").html_safe end end |
#layout_logo ⇒ Object
12 13 14 15 16 17 18 |
# File 'app/helpers/noa/layout/base_helper.rb', line 12 def layout_logo content_tag(:h1) do link_to_unless_current(noa_application_name, root_path) do noa_application_name end end end |
#layout_page_title ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'app/helpers/noa/layout/base_helper.rb', line 20 def layout_page_title unless @title.blank? if defined?(Twitter::Bootstrap::Rails) content_tag(:div, content_tag(:h1, @title), class: "page-header") else content_tag(:h1, @title) end end end |
#layout_title ⇒ Object
4 5 6 7 8 9 10 |
# File 'app/helpers/noa/layout/base_helper.rb', line 4 def layout_title if @title.blank? noa_application_name else "#{@title} | #{noa_application_name}" end end |