Module: Lipstick::Helpers::LayoutHelper

Defined in:
lib/lipstick/helpers/layout_helper.rb

Instance Method Summary collapse

Instance Method Details



13
14
15
16
17
18
19
20
# File 'lib/lipstick/helpers/layout_helper.rb', line 13

def aaf_footer(&block)
  ('footer') do
    ('div', class: 'footer-content') do
      concat()
      concat(capture(&block))
    end
  end
end

#aaf_header(title:, environment: nil, auth: nil, &blk) ⇒ Object



6
7
8
9
10
11
# File 'lib/lipstick/helpers/layout_helper.rb', line 6

def aaf_header(title:, environment: nil, auth: nil, &blk)
  ('div', class: 'aaf-header') do
    concat(aaf_banner(title, environment, auth))
    concat(capture(&blk))
  end
end


81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/lipstick/helpers/layout_helper.rb', line 81

def breadcrumbs(*links)
  ('ol', class: 'breadcrumb') do
    last = links.pop

    links.each do |link|
      concat(('li', breadcrumb_link(link)))
    end

    concat(('li', breadcrumb_link(last),
                       class: 'active'))
  end
end

button_link_to(url_opts) { ‘Link Text’ } button_link_to(url_opts, html_opts) { ‘Link Text’ } button_link_to(‘Link Text’, url_opts) button_link_to(‘Link Text’, url_opts, html_opts)



56
57
58
59
60
61
62
63
# File 'lib/lipstick/helpers/layout_helper.rb', line 56

def button_link_to(*args, &block)
  args.unshift(capture(&block)) if block_given?
  text, url_opts, html_opts = args
  html_opts ||= {}
  html_opts[:class] ||= 'btn-default'
  html_opts[:class] = "#{html_opts[:class]} btn".strip
  link_to(text, url_opts, html_opts)
end

#disable_animationsObject



109
110
111
# File 'lib/lipstick/helpers/layout_helper.rb', line 109

def disable_animations
  ('style', DISABLE_ANIMATIONS_CSS, type: 'text/css')
end

#error_message(title, &block) ⇒ Object



69
70
71
# File 'lib/lipstick/helpers/layout_helper.rb', line 69

def error_message(title, &block)
  alert_block(title, 'danger', &block)
end

#icon_tag(icon_class, html_opts = {}) ⇒ Object



46
47
48
49
50
# File 'lib/lipstick/helpers/layout_helper.rb', line 46

def icon_tag(icon_class, html_opts = {})
  html_opts[:class] =
    "#{html_opts[:class]} glyphicon glyphicon-#{icon_class}".strip
  ('span', '', html_opts)
end

#info_message(title, &block) ⇒ Object



65
66
67
# File 'lib/lipstick/helpers/layout_helper.rb', line 65

def info_message(title, &block)
  alert_block(title, 'info', &block)
end

#logged_in_user(user) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/lipstick/helpers/layout_helper.rb', line 22

def logged_in_user(user)
  return if user.nil?

  ('p') do
    concat('Logged in as: ')
    concat(('strong', user.name))
    concat(" (#{user.try(:targeted_id)})") if user.try(:targeted_id)
  end
end

#page_header(header, subheader = nil) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/lipstick/helpers/layout_helper.rb', line 32

def page_header(header, subheader = nil)
  ('div', class: 'page-header') do
    ('h1') do
      concat(header)
      concat(' ')
      concat(('small', subheader)) if subheader
    end
  end
end

#success_message(title, &block) ⇒ Object



73
74
75
# File 'lib/lipstick/helpers/layout_helper.rb', line 73

def success_message(title, &block)
  alert_block(title, 'success', &block)
end

#warning_message(title, &block) ⇒ Object



77
78
79
# File 'lib/lipstick/helpers/layout_helper.rb', line 77

def warning_message(title, &block)
  alert_block(title, 'warning', &block)
end

#will_paginate(_type = nil, options = {}) ⇒ Object



94
95
96
97
# File 'lib/lipstick/helpers/layout_helper.rb', line 94

def will_paginate(_type = nil, options = {})
  options[:renderer] ||= Lipstick::Helpers::PaginationLinkRenderer
  super
end

#yes_no_string(boolean) ⇒ Object



42
43
44
# File 'lib/lipstick/helpers/layout_helper.rb', line 42

def yes_no_string(boolean)
  boolean ? 'Yes' : 'No'
end