Module: CamaleonCms::Frontend::SiteHelper

Included in:
ApplicationHelper
Defined in:
app/helpers/camaleon_cms/frontend/site_helper.rb

Instance Method Summary collapse

Instance Method Details

#is_ajax?Boolean

check if current section visited is for ajax

Returns:

  • (Boolean)


27
28
29
# File 'app/helpers/camaleon_cms/frontend/site_helper.rb', line 27

def is_ajax?
  camaleon_frontend_visited_state(:frontend_visited_ajax).present?
end

#is_category?Boolean

check if current section visited is for category

Returns:

  • (Boolean)


47
48
49
# File 'app/helpers/camaleon_cms/frontend/site_helper.rb', line 47

def is_category?
  camaleon_frontend_visited_state(:frontend_visited_category).present?
end

#is_home?Boolean

**************** section is a? ****************# check if current section visited is home page

Returns:

  • (Boolean)


17
18
19
# File 'app/helpers/camaleon_cms/frontend/site_helper.rb', line 17

def is_home?
  camaleon_frontend_visited_state(:frontend_visited_home).present?
end

#is_page?Boolean

check if current section visited is for post

Returns:

  • (Boolean)


22
23
24
# File 'app/helpers/camaleon_cms/frontend/site_helper.rb', line 22

def is_page?
  camaleon_frontend_visited_state(:frontend_visited_post).present?
end

#is_post_tag?Boolean

check if current section visited is for post tag

Returns:

  • (Boolean)


42
43
44
# File 'app/helpers/camaleon_cms/frontend/site_helper.rb', line 42

def 
  camaleon_frontend_visited_state(:frontend_visited_tag).present?
end

#is_post_type?Boolean

check if current section visited is for post type

Returns:

  • (Boolean)


37
38
39
# File 'app/helpers/camaleon_cms/frontend/site_helper.rb', line 37

def is_post_type?
  camaleon_frontend_visited_state(:frontend_visited_post_type).present?
end

#is_profile?Boolean

check if visited page is user profile (frontend)

Returns:

  • (Boolean)


52
53
54
# File 'app/helpers/camaleon_cms/frontend/site_helper.rb', line 52

def is_profile?
  camaleon_frontend_visited_state(:frontend_visited_profile) == true
end

#is_search?Boolean

check if current section visited is for search

Returns:

  • (Boolean)


32
33
34
# File 'app/helpers/camaleon_cms/frontend/site_helper.rb', line 32

def is_search?
  camaleon_frontend_visited_state(:frontend_visited_search).present?
end

#site_current_pathObject

return current url visited as path http://localhost:9001/category/cat-post-2 => /category/cat-post-2



11
12
13
# File 'app/helpers/camaleon_cms/frontend/site_helper.rb', line 11

def site_current_path
  CurrentRequest.frontend_site_current_path ||= site_current_url.sub(cama_root_url(locale: nil), '/')
end

#site_current_urlObject

return full current visited url



5
6
7
# File 'app/helpers/camaleon_cms/frontend/site_helper.rb', line 5

def site_current_url
  request.original_url
end

#the_head(seo_attrs = {}, _show_seo = true) ⇒ Object

show custom assets added by plugins show respond js and html5shiv seo_attrs: Custom attributes for seo in Hash format show_seo: (Boolean) control to append or not the seo attributes



62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'app/helpers/camaleon_cms/frontend/site_helper.rb', line 62

def the_head(seo_attrs = {}, _show_seo = true)
  js = javascript_tag("var ROOT_URL = #{cama_root_url.to_json}; var LANGUAGE = #{I18n.locale.to_s.to_json};")
  safe_join(
    [
      csrf_meta_tag.presence,
      display_meta_tags(cama_the_seo(seo_attrs)).presence,
      js,
      cama_draw_pre_asset_contents.presence,
      cama_draw_custom_assets.presence
    ].compact,
    "\n"
  )
end