Module: PagesCms::ApplicationHelper
- Included in:
- ContactsController
- Defined in:
- app/helpers/pages_cms/application_helper.rb
Instance Method Summary collapse
- #account ⇒ Object
-
#blog_path(current_site, search = '') ⇒ Object
redirects to the blog with a search.
- #current_account ⇒ Object
- #current_site ⇒ Object
- #insert_html_breaks(string) ⇒ Object
- #meta_description ⇒ Object
- #meta_tags ⇒ Object
-
#slugged_path(page) ⇒ Object
added by PagesCMS.
Instance Method Details
#account ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'app/helpers/pages_cms/application_helper.rb', line 4 def account account = Account.first if account account 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_account ⇒ Object
13 14 15 16 17 18 19 |
# File 'app/helpers/pages_cms/application_helper.rb', line 13 def current_account if Account.exists?(session[:current_account]) Account.find(session[:current_account]) else false end end |
#current_site ⇒ Object
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_description ⇒ Object
51 52 53 |
# File 'app/helpers/pages_cms/application_helper.rb', line 51 def end |
#meta_tags ⇒ Object
47 48 49 |
# File 'app/helpers/pages_cms/application_helper.rb', line 47 def 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.account.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 |