Module: Noa::Layout::BaseHelper

Defined in:
app/helpers/noa/layout/base_helper.rb

Instance Method Summary collapse

Instance Method Details



30
31
32
33
34
35
36
# File 'app/helpers/noa/layout/base_helper.rb', line 30

def layout_copyright(author = nil, href = nil)
  author ||= noa_application_name
  (:div, id: "copyright") do
    "© #{Time.now.year} ".html_safe + 
    (href ? link_to(author, href) : author)
  end
end

#layout_flashObject



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
      close_button =
        '<button type="button" class="close" data-dismiss="alert">&times;</button>'
      html << (:div,
        close_button.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 << (:div, msg, class: name)
    end
    html.join("\n").html_safe
  end
end

#layout_logoObject



12
13
14
15
16
17
18
# File 'app/helpers/noa/layout/base_helper.rb', line 12

def 
  (:h1) do
    link_to_unless_current(noa_application_name, root_path) do
      noa_application_name
    end
  end
end

#layout_page_titleObject



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)
      (:div, (:h1, @title), class: "page-header")
    else
      (:h1, @title)
    end
  end
end

#layout_titleObject



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