Module: EffectivePagesHelper

Defined in:
app/helpers/effective_pages_helper.rb

Instance Method Summary collapse

Instance Method Details

#application_root_to_effective_pages_slugObject



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_classesObject



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_tagsObject



13
14
15
16
17
18
# File 'app/helpers/effective_pages_helper.rb', line 13

def effective_pages_header_tags
  [
    (:title, effective_pages_site_title),
    effective_pages_meta_description_tag
  ].compact.join("\n").html_safe
end

#effective_pages_meta_description_tagObject



24
25
26
27
28
29
30
# File 'app/helpers/effective_pages_helper.rb', line 24

def effective_pages_meta_description_tag
  if @meta_description.present?
    "<meta content='#{truncate(@meta_description, :length => 150)}' name='description' />"
  elsif @page.try(:meta_description).present?
    "<meta content='#{@page.meta_description}' name='description' />"
  end
end

#effective_pages_site_titleObject



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