Module: Lipstick::Helpers::LayoutHelper
- Defined in:
- lib/lipstick/helpers/layout_helper.rb
Instance Method Summary collapse
- #aaf_footer(&block) ⇒ Object
- #aaf_header(title:, environment: nil, auth: nil, &blk) ⇒ 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(_type = nil, options = {}) ⇒ Object
- #yes_no_string(boolean) ⇒ Object
Instance Method Details
#aaf_footer(&block) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/lipstick/helpers/layout_helper.rb', line 13 def (&block) content_tag('footer') do content_tag('div', class: 'footer-content') do concat(aaf_logo) 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) content_tag('div', class: 'aaf-header') do concat((title, environment, auth)) concat(capture(&blk)) end end |
#breadcrumbs(*links) ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/lipstick/helpers/layout_helper.rb', line 81 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)
56 57 58 59 60 61 62 63 |
# File 'lib/lipstick/helpers/layout_helper.rb', line 56 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
109 110 111 |
# 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) ⇒ Object
69 70 71 |
# File 'lib/lipstick/helpers/layout_helper.rb', line 69 def (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 content_tag('span', '', html_opts) end |
#info_message(title, &block) ⇒ Object
65 66 67 |
# File 'lib/lipstick/helpers/layout_helper.rb', line 65 def (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? 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) ⇒ 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) 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
73 74 75 |
# File 'lib/lipstick/helpers/layout_helper.rb', line 73 def (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 (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, = {}) [: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 |