Module: SeoUnpakt::ApplicationHelper

Defined in:
app/helpers/seo_unpakt/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#ajax_will_paginate(collection, options = {}) ⇒ Object



3
4
5
# File 'app/helpers/seo_unpakt/application_helper.rb', line 3

def ajax_will_paginate(collection, options = {})
   will_paginate(collection, options.merge(:renderer => WillPaginateHelper::WillPaginateAjaxLinkRenderer))
end

#get_state_code_by_name(state_name) ⇒ Object



21
22
23
# File 'app/helpers/seo_unpakt/application_helper.rb', line 21

def get_state_code_by_name state_name
   MoversByState.states_hash.to_a.select{|s| s[1] == "#{state_name}"}.first[0]
end

#living_in_info(city, state) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/helpers/seo_unpakt/application_helper.rb', line 7

def living_in_info city, state
  state_code = get_state_code_by_name(state)
  lif = LivingInInfo.where(state: state_code)
  if city.blank?
    lif = lif.where(info_type: "state")
    location = state
  else
    lif = lif.where(city: city)
    location = [city, state_code].join(", ")
  end
  # raise lif.inspect
  (lif.blank? or lif.first.body.blank?) ? LivingInInfo.default_body(location) : lif.first.body.html_safe
end

#news_heading(city, state) ⇒ Object



29
30
31
# File 'app/helpers/seo_unpakt/application_helper.rb', line 29

def news_heading city, state
  (!city.blank? && !state.blank?) ? "#{city}, #{get_state_code_by_name(state)} News" : "#{state} News"
end


25
26
27
# File 'app/helpers/seo_unpakt/application_helper.rb', line 25

def set_selected_admin_link url_suffix
  request.url.ends_with?(url_suffix) ? "selected" : ""
end

#widget_page_title(city, state) ⇒ Object



33
34
35
36
37
38
39
40
41
42
# File 'app/helpers/seo_unpakt/application_helper.rb', line 33

def widget_page_title city, state
  if city.blank? and state.blank?
    "<span>Movers by City Project</span>".html_safe
  elsif !city.blank?
    "#{city}, #{state} <span>Moving companies</span>".html_safe
  else
    "#{state} <span>Moving companies</span>".html_safe
  end

end