Module: PagesCms::ApplicationHelper
- Included in:
- ContactsController
- Defined in:
- app/helpers/pages_cms/application_helper.rb
Instance Method Summary collapse
-
#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
- #pages_cms_auth_exists? ⇒ Boolean
-
#slugged_path(page) ⇒ Object
added by PagesCMS.
Instance Method Details
#blog_path(current_site, search = '') ⇒ Object
redirects to the blog with a search
27 28 29 30 31 32 |
# File 'app/helpers/pages_cms/application_helper.rb', line 27 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
4 5 6 7 8 9 10 |
# File 'app/helpers/pages_cms/application_helper.rb', line 4 def current_account if Account.exists?(session[:current_account]) Account.find(session[:current_account]) else false end end |
#current_site ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'app/helpers/pages_cms/application_helper.rb', line 46 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
34 35 36 |
# File 'app/helpers/pages_cms/application_helper.rb', line 34 def insert_html_breaks(string) string.gsub(/\n/, '<br />') end |
#meta_description ⇒ Object
42 43 44 |
# File 'app/helpers/pages_cms/application_helper.rb', line 42 def end |
#meta_tags ⇒ Object
38 39 40 |
# File 'app/helpers/pages_cms/application_helper.rb', line 38 def end |
#pages_cms_auth_exists? ⇒ Boolean
56 57 58 |
# File 'app/helpers/pages_cms/application_helper.rb', line 56 def pages_cms_auth_exists? defined?(PagesCmsAuth) == 'constant' end |
#slugged_path(page) ⇒ Object
added by PagesCMS. Use this helper to link to user created pages.
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/helpers/pages_cms/application_helper.rb', line 13 def slugged_path(page) if page.class == String "/#{page}" # if passes a string, just add a slash else mount = page.account.mount_location if mount == '/' "/#{page.slug}" # don't want the link to look like this '///home' else "/#{mount}/#{page.slug}" # if the mount location is normal. ie. '/site/home' end end end |