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
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_auth_link(auth)
click to toggle source
# File lib/lipstick/helpers/layout_helper.rb, line 152 def aaf_auth_link(auth) return if auth.nil? text = ' Log In' text = ' Log Out' if auth == :logout icon = 'log-in' icon = 'log-out' if auth == :logout content_tag('a', href: "/auth/#{auth}") do concat(icon_tag(icon)) 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
aaf_home_link()
click to toggle source
# File lib/lipstick/helpers/layout_helper.rb, line 138 def aaf_home_link content_tag('a', href: 'https://aaf.edu.au') do concat(icon_tag('aaf')) concat(' AAF Home') end end
aaf_links(auth)
click to toggle source
# File lib/lipstick/helpers/layout_helper.rb, line 130 def aaf_links(auth) content_tag('div', class: 'aaf-links pull-right') do concat(aaf_home_link) concat(aaf_support_link) concat(aaf_auth_link(auth)) end end
aaf_logo()
click to toggle source
# File lib/lipstick/helpers/layout_helper.rb, line 126 def aaf_logo content_tag('span', '', class: 'pull-right logo hidden-xs hidden-sm') end
aaf_support_link()
click to toggle source
# File lib/lipstick/helpers/layout_helper.rb, line 145 def aaf_support_link content_tag('a', href: 'https://support.aaf.edu.au') do concat(icon_tag('user')) concat(' Support') end 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