Module: FacebookApp::ApplicationHelper
- Defined in:
- app/helpers/facebook_app/application_helper.rb
Instance Method Summary collapse
- #current_domain ⇒ Object
- #current_url ⇒ Object
- #google_analytics ⇒ Object
- #hypenate(words) ⇒ Object
- #image_url(image_name) ⇒ Object
-
#seo_desc ⇒ Object
Show the page seo_desc in your layouts.
-
#seo_desc=(seo_desc) ⇒ Object
Set the seo_desc from view file.
- #sitename ⇒ Object
-
#title ⇒ Object
Show the page title in your layouts.
-
#title=(title) ⇒ Object
assumes you have called ApplicationController#login_with_facebook.
Instance Method Details
#current_domain ⇒ Object
19 20 21 |
# File 'app/helpers/facebook_app/application_helper.rb', line 19 def current_domain current_url.split("/").first(3).join("/") end |
#current_url ⇒ Object
15 16 17 |
# File 'app/helpers/facebook_app/application_helper.rb', line 15 def current_url request.url end |
#google_analytics ⇒ Object
48 49 50 51 52 |
# File 'app/helpers/facebook_app/application_helper.rb', line 48 def google_analytics content_tag :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_desc ⇒ Object
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 |
#sitename ⇒ Object
44 45 46 |
# File 'app/helpers/facebook_app/application_helper.rb', line 44 def sitename Configurable[:app_name] end |
#title ⇒ Object
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 |