Module: AmaLayoutContentHelper

Defined in:
app/helpers/ama_layout_content_helper.rb

Instance Method Summary collapse

Instance Method Details

#active_domain(domain) ⇒ Object



20
21
22
# File 'app/helpers/ama_layout_content_helper.rb', line 20

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

#active_page(*path) ⇒ Object



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

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

#active_section(nav_item) ⇒ Object



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

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

#alert(alert) ⇒ Object



53
54
55
# File 'app/helpers/ama_layout_content_helper.rb', line 53

def alert(alert)
  render "ama_layout/alert" if alert
end


34
35
36
37
# File 'app/helpers/ama_layout_content_helper.rb', line 34

def dropdown_menu(logged_in, greeting)
  return "" unless logged_in
  render partial: "ama_layout/dropdown_menu", locals: { logged_in: logged_in, greeting: greeting }
end

#gift_or_pricing_path(logged_in) ⇒ Object



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

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



2
3
4
# File 'app/helpers/ama_layout_content_helper.rb', line 2

def greeting
  cookies["logged_in_meta"]
end

#notice(notice) ⇒ Object



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

def notice(notice)
  render "ama_layout/notice" if notice
end

#renew_or_join_path(logged_in) ⇒ Object



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

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

#tablet_menu(logged_in, greeting) ⇒ Object



39
40
41
42
# File 'app/helpers/ama_layout_content_helper.rb', line 39

def tablet_menu(logged_in, greeting)
  return "" unless logged_in
  render partial: "ama_layout/tablet_menu", locals: { logged_in: logged_in, greeting: greeting }
end

#tablet_signout(logged_in) ⇒ Object



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

def tablet_signout(logged_in)
  return "" unless logged_in
  render "ama_layout/tablet_signout"
end

#utm_sourceObject



6
7
8
# File 'app/helpers/ama_layout_content_helper.rb', line 6

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