Module: PagesCms::ApplicationHelper

Included in:
ContactsController
Defined in:
app/helpers/pages_cms/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#accountObject



4
5
6
7
8
9
10
11
# File 'app/helpers/pages_cms/application_helper.rb', line 4

def 
   = Account.first
  if 
    
  else
    false
  end
end

#blog_path(current_site, search = '') ⇒ Object

redirects to the blog with a search



36
37
38
39
40
41
# File 'app/helpers/pages_cms/application_helper.rb', line 36

def blog_path(current_site, search = '')
  blog = current_site.pages.find_by(slug: 'blog')
  unless blog.nil?
    "#{slugged_path(blog)}?search=#{search}"
  end
end

#current_accountObject



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

def 
  if Account.exists?(session[:current_account])
    Account.find(session[:current_account])
  else
    false
  end
end

#current_siteObject



55
56
57
58
59
60
61
62
63
# File 'app/helpers/pages_cms/application_helper.rb', line 55

def current_site
  if params[:account]
    Account.where(id: params[:account]).first
  elsif session[:current_account]
    Account.where(id: session[:current_account]).first
  else
    false
  end
end

#insert_html_breaks(string) ⇒ Object



43
44
45
# File 'app/helpers/pages_cms/application_helper.rb', line 43

def insert_html_breaks(string)
  string.gsub(/\n/, '<br />')
end

#meta_descriptionObject



51
52
53
# File 'app/helpers/pages_cms/application_helper.rb', line 51

def meta_description

end

#meta_tagsObject



47
48
49
# File 'app/helpers/pages_cms/application_helper.rb', line 47

def meta_tags

end

#slugged_path(page) ⇒ Object

added by PagesCMS. Use this helper to link to user created pages.



22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/helpers/pages_cms/application_helper.rb', line 22

def slugged_path(page)
  if page.class == String
    "/#{page}"
  else
    mount = page..mount_location
    if page.parent.nil?
      "#{'/' unless mount == '/'}#{mount unless mount == '/'}/#{page.slug}"
    else
      "#{'/' unless mount == '/'}#{mount unless mount == '/'}/#{page.parent.slug}/#{page.slug}"
    end
  end
end