summaryrefslogtreecommitdiff
path: root/app/helpers/application_helper.rb
blob: 1e799901404f8682551c9cb866c7f0798f782f5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
module ApplicationHelper

  #
  # determine title for the page
  #
  def html_title
    if content_for?(:title)
      yield(:title)
    elsif @title
      [@title, ' - ', APP_CONFIG[:domain]].join
    else
      APP_CONFIG[:domain]
    end
  end

  #
  # markup for bootstrap icon
  #
  # http://twitter.github.io/bootstrap/base-css.html#icons
  #
  def icon(name, color=nil)
    if color.nil?
      color_class = nil
    elsif color == :black
      color_class = 'icon-black'
    elsif color == :white
      color_class = 'icon-white'
    end
    "<i class=\"icon-#{name} #{color_class}\"></i> ".html_safe
  end

  def big_icon(name, color=nil)
    "<i class=\"big-icon-#{name}\"></i> ".html_safe
  end

  def format_flash(msg)
    html_escape(msg).gsub('[b]', '<b>').gsub('[/b]', '</b>').html_safe
  end

end