Module: Lipstick::Helpers::LayoutHelper
- Defined in:
- lib/lipstick/helpers/layout_helper.rb
Instance Method Summary collapse
- #aaf_footer ⇒ Object
- #aaf_header(title:, environment: nil, auth: nil, &bl) ⇒ Object
- #breadcrumbs(*links) ⇒ Object
-
#button_link_to(*args, &block) ⇒ Object
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).
- #disable_animations ⇒ Object
- #error_message(title, &block) ⇒ Object
- #icon_tag(icon_class, html_opts = {}) ⇒ Object
- #info_message(title, &block) ⇒ Object
- #logged_in_user(user) ⇒ Object
- #page_header(header, subheader = nil) ⇒ Object
- #success_message(title, &block) ⇒ Object
- #warning_message(title, &block) ⇒ Object
- #will_paginate(_ = nil, options = {}) ⇒ Object
- #yes_no_string(boolean) ⇒ Object
Instance Method Details
#aaf_footer ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/lipstick/helpers/layout_helper.rb', line 12 def content_tag('footer') do content_tag('div', class: 'footer-content') do concat(aaf_logo) 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) content_tag('div', class: 'aaf-header') do concat((title, environment, auth)) concat(capture(&bl)) end end |
#breadcrumbs(*links) ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/lipstick/helpers/layout_helper.rb', line 79 def (*links) content_tag('ol', class: 'breadcrumb') do last = links.pop links.each do |link| concat(content_tag('li', (link))) end concat(content_tag('li', (last), class: 'active')) end end |
#button_link_to(*args, &block) ⇒ Object
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 (*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_animations ⇒ Object
107 108 109 |
# File 'lib/lipstick/helpers/layout_helper.rb', line 107 def disable_animations content_tag('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 (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 content_tag('span', '', html_opts) end |
#info_message(title, &block) ⇒ Object
63 64 65 |
# File 'lib/lipstick/helpers/layout_helper.rb', line 63 def (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? content_tag('p') do concat('Logged in as: ') concat(content_tag('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) 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) ⇒ Object
71 72 73 |
# File 'lib/lipstick/helpers/layout_helper.rb', line 71 def (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 (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, = {}) [: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 |