Module: FacebookApp::ApplicationHelper

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

Instance Method Summary collapse

Instance Method Details

#current_domainObject



19
20
21
# File 'app/helpers/facebook_app/application_helper.rb', line 19

def current_domain
  current_url.split("/").first(3).join("/")
end

#current_urlObject



15
16
17
# File 'app/helpers/facebook_app/application_helper.rb', line 15

def current_url
  request.url
end

#google_analyticsObject



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

def google_analytics
   :script do
    %{ var _gaq = _gaq || []; _gaq.push(['_setAccount', '#{Configurable[:analytics_code]}']); _gaq.push(['_trackPageview']); (function() {var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);})(); }
  end
end

#hypenate(words) ⇒ Object



11
12
13
# File 'app/helpers/facebook_app/application_helper.rb', line 11

def hypenate(words)
  words.downcase.gsub(' ', "-")
end

#image_url(image_name) ⇒ Object



23
24
25
# File 'app/helpers/facebook_app/application_helper.rb', line 23

def image_url(image_name)
  current_domain + image_path(image_name)
end

#seo_descObject

Show the page seo_desc in your layouts



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

def seo_desc 
  given_seo_desc = content_for(:seo_desc)
  given_seo_desc.empty? ? "#{sitename} is just what you need" : given_seo_desc
end

#seo_desc=(seo_desc) ⇒ Object

Set the seo_desc from view file



34
35
36
# File 'app/helpers/facebook_app/application_helper.rb', line 34

def seo_desc=(seo_desc)
  content_for(:seo_desc, seo_desc.to_s)
end

#sitenameObject



44
45
46
# File 'app/helpers/facebook_app/application_helper.rb', line 44

def sitename
  Configurable[:app_name]
end

#titleObject

Show the page title in your layouts



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

def title 
  given_title = content_for(:title)
  given_title.empty? ? sitename : given_title + " | " + sitename
end

#title=(title) ⇒ Object

assumes you have called ApplicationController#login_with_facebook

Set the page title from view file



7
8
9
# File 'app/helpers/facebook_app/application_helper.rb', line 7

def title=(title)
  content_for(:title, title.to_s)
end