Module: EffectivePagesHelper
- Defined in:
- app/helpers/effective_pages_helper.rb
Instance Method Summary collapse
- #application_root_to_effective_pages_slug ⇒ Object
- #effective_pages_body_classes ⇒ Object
- #effective_pages_header_tags ⇒ Object
- #effective_pages_meta_description_tag ⇒ Object
- #effective_pages_site_title ⇒ Object
Instance Method Details
#application_root_to_effective_pages_slug ⇒ Object
32 33 34 |
# File 'app/helpers/effective_pages_helper.rb', line 32 def application_root_to_effective_pages_slug Rails.application.routes.routes.find { |r| r.name == 'root' and r.defaults[:controller] == 'Effective::Pages' and r.defaults[:action] == 'show' }.defaults[:id] rescue nil end |
#effective_pages_body_classes ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'app/helpers/effective_pages_helper.rb', line 3 def effective_pages_body_classes [ params[:controller].parameterize, params[:action], ((user_signed_in? ? 'signed-in' : 'not-signed-in') rescue nil), (@page.template rescue nil), @body_classes ].compact.join(' ') end |
#effective_pages_header_tags ⇒ Object
13 14 15 16 17 18 |
# File 'app/helpers/effective_pages_helper.rb', line 13 def [ content_tag(:title, effective_pages_site_title), ].compact.join("\n").html_safe end |
#effective_pages_meta_description_tag ⇒ Object
24 25 26 27 28 29 30 |
# File 'app/helpers/effective_pages_helper.rb', line 24 def if @meta_description.present? "<meta content='#{truncate(@meta_description, :length => 150)}' name='description' />" elsif @page.try(:meta_description).present? "<meta content='#{@page.}' name='description' />" end end |
#effective_pages_site_title ⇒ Object
20 21 22 |
# File 'app/helpers/effective_pages_helper.rb', line 20 def effective_pages_site_title (@page_title ? @page_title.to_s : "#{params[:controller].try(:titleize)} #{params[:action].try(:titleize)}") + EffectivePages.site_title_suffix.to_s end |