module Lipstick::Helpers::LayoutHelper

Constants

DISABLE_ANIMATIONS_CSS

Public Instance Methods

aaf_header(title:, environment: nil, auth: nil, &blk) click to toggle source
# File lib/lipstick/helpers/layout_helper.rb, line 6
def aaf_header(title:, environment: nil, auth: nil, &blk)
  content_tag('div', class: 'aaf-header') do
    concat(aaf_banner(title, environment, auth))
    concat(capture(&blk))
  end
end
breadcrumbs(*links) click to toggle source
disable_animations() click to toggle source
# File lib/lipstick/helpers/layout_helper.rb, line 109
def disable_animations
  content_tag('style', DISABLE_ANIMATIONS_CSS, type: 'text/css')
end
error_message(title, &block) click to toggle source
# 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 = {}) click to toggle source
# 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
  content_tag('span', '', html_opts)
end
info_message(title, &block) click to toggle source
# File lib/lipstick/helpers/layout_helper.rb, line 65
def info_message(title, &block)
  alert_block(title, 'info', &block)
end
logged_in_user(user) click to toggle source
# File lib/lipstick/helpers/layout_helper.rb, line 22
def logged_in_user(user)
  return if user.nil?

  content_tag('p') do
    concat('Logged in as: ')
    concat(content_tag('strong', user.name))
    concat(" (#{user.try(:targeted_id)})") if user.try(:targeted_id)
  end
end
page_header(header, subheader = nil) click to toggle source
# File lib/lipstick/helpers/layout_helper.rb, line 32
def page_header(header, subheader = nil)
  content_tag('div', class: 'page-header') do
    content_tag('h1') do
      concat(header)
      concat(' ')
      concat(content_tag('small', subheader)) if subheader
    end
  end
end
success_message(title, &block) click to toggle source
# File lib/lipstick/helpers/layout_helper.rb, line 73
def success_message(title, &block)
  alert_block(title, 'success', &block)
end
warning_message(title, &block) click to toggle source
# 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 = {}) click to toggle source
Calls superclass method
# 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) click to toggle source
# File lib/lipstick/helpers/layout_helper.rb, line 42
def yes_no_string(boolean)
  boolean ? 'Yes' : 'No'
end

Private Instance Methods

aaf_banner(title, environment, auth) click to toggle source
# File lib/lipstick/helpers/layout_helper.rb, line 115
def aaf_banner(title, environment, auth)
  capture do
    text = content_tag('header') do
      concat(aaf_links(auth))
      concat(title)
      concat(aaf_environment_string(environment))
    end
    concat(text)
  end
end
aaf_environment_string(environment) click to toggle source
# File lib/lipstick/helpers/layout_helper.rb, line 167
def aaf_environment_string(environment)
  return unless environment&.present?

  content_tag('span', environment, class: 'environment')
end
alert_block(title, color_class, &block) click to toggle source
# File lib/lipstick/helpers/layout_helper.rb, line 173
def alert_block(title, color_class, &block)
  opts = { class: "alert alert-#{color_class}", role: 'alert' }
  content_tag('div', opts) do
    concat(content_tag('h4', title))
    concat(capture(&block))
  end
end