Module: Lipstick::Helpers::LayoutHelper

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

Instance Method Summary collapse

Instance Method Details



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

def aaf_footer
  ('footer') do
    ('div', class: 'footer-content') do
      concat()
      concat(capture { yield })
    end
  end
end

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



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

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


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

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)



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

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



107
108
109
# File 'lib/lipstick/helpers/layout_helper.rb', line 107

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

#error_message(title, &block) ⇒ Object



67
68
69
# File 'lib/lipstick/helpers/layout_helper.rb', line 67

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

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



44
45
46
47
48
# File 'lib/lipstick/helpers/layout_helper.rb', line 44

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



63
64
65
# File 'lib/lipstick/helpers/layout_helper.rb', line 63

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

#logged_in_user(user) ⇒ Object



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

def logged_in_user(user)
  return if user.nil?
  ('p') do
    concat('Logged in as: ')
    concat(('strong', user.name))
    concat(" (#{user.targeted_id})")
  end
end

#page_header(header, subheader = nil) ⇒ Object



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

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



71
72
73
# File 'lib/lipstick/helpers/layout_helper.rb', line 71

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

#warning_message(title, &block) ⇒ Object



75
76
77
# File 'lib/lipstick/helpers/layout_helper.rb', line 75

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

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



92
93
94
95
# File 'lib/lipstick/helpers/layout_helper.rb', line 92

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

#yes_no_string(boolean) ⇒ Object



40
41
42
# File 'lib/lipstick/helpers/layout_helper.rb', line 40

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