Module: AmaLayoutContentHelper

Includes:
AmaLayoutPartialHelper
Defined in:
app/helpers/ama_layout_content_helper.rb

Instance Method Summary collapse

Methods included from AmaLayoutPartialHelper

#ama_layout_partial, #ama_layout_partial_version

Instance Method Details

#active_domain(domain) ⇒ Object



26
27
28
# File 'app/helpers/ama_layout_content_helper.rb', line 26

def active_domain(domain)
  'active' if request.url.include?(domain)
end

#active_page(*path) ⇒ Object



22
23
24
# File 'app/helpers/ama_layout_content_helper.rb', line 22

def active_page(*path)
  'activepage' if path.include?(request.fullpath) || path.include?(request.url)
end

#active_section(nav_item) ⇒ Object



16
17
18
19
20
# File 'app/helpers/ama_layout_content_helper.rb', line 16

def active_section(nav_item)
  paths = [nav_item.link]
  paths += nav_item.sub_nav.map(&:link)
  active_page(*paths)
end

#alert(alert) ⇒ Object



64
65
66
# File 'app/helpers/ama_layout_content_helper.rb', line 64

def alert(alert)
  render partial: ama_layout_partial('alert'), locals: { message: alert } if alert
end


42
43
44
45
46
# File 'app/helpers/ama_layout_content_helper.rb', line 42

def dropdown_menu(logged_in, greeting)
  return '' unless logged_in

  render partial: ama_layout_partial('dropdown_menu'), locals: { logged_in: logged_in, greeting: greeting }
end

#gift_or_pricing_path(logged_in) ⇒ Object



36
37
38
39
40
# File 'app/helpers/ama_layout_content_helper.rb', line 36

def gift_or_pricing_path(logged_in)
  return '' if logged_in

  link_to('Gift Membership', 'http://www.ama.ab.ca/membership-rewards/ama-gift-membership', target: '_blank')
end

#greetingObject



8
9
10
# File 'app/helpers/ama_layout_content_helper.rb', line 8

def greeting
  cookies['logged_in_meta']
end

#notice(notice) ⇒ Object



60
61
62
# File 'app/helpers/ama_layout_content_helper.rb', line 60

def notice(notice)
  render partial: ama_layout_partial('notice'), locals: { message: notice } if notice
end

#renew_or_join_path(logged_in) ⇒ Object



30
31
32
33
34
# File 'app/helpers/ama_layout_content_helper.rb', line 30

def renew_or_join_path(logged_in)
  return '' if logged_in

  link_to('Become a Member', 'http://www.ama.ab.ca/membership/join-ama-online', target: '_blank')
end

#success_message(success) ⇒ Object



68
69
70
# File 'app/helpers/ama_layout_content_helper.rb', line 68

def success_message(success)
  render partial: ama_layout_partial('success'), locals: { message: success } if success
end

#tablet_menu(logged_in, greeting) ⇒ Object



48
49
50
51
52
# File 'app/helpers/ama_layout_content_helper.rb', line 48

def tablet_menu(logged_in, greeting)
  return '' unless logged_in

  render partial: ama_layout_partial('tablet_menu'), locals: { logged_in: logged_in, greeting: greeting }
end

#tablet_signout(logged_in) ⇒ Object



54
55
56
57
58
# File 'app/helpers/ama_layout_content_helper.rb', line 54

def tablet_signout(logged_in)
  return '' unless logged_in

  render ama_layout_partial('tablet_signout')
end

#utm_sourceObject



12
13
14
# File 'app/helpers/ama_layout_content_helper.rb', line 12

def utm_source
  Rails.configuration.site_name.downcase.gsub(/\W/, '')
end