Sha256: f67a215b32473c000eecc9cc3a6669bb1fd299d758efad1b8424caee3c58dcb8

Contents?: true

Size: 1.82 KB

Versions: 14

Compression:

Stored size: 1.82 KB

Contents

module CamaleonCms::Frontend::SiteHelper
  # return full current visited url
  def site_current_url
    request.original_url
  end

  # return current url visited as path
  # http://localhost:9001/category/cat-post-2  => /category/cat-post-2
  def site_current_path
    @_site_current_path ||= site_current_url.sub(cama_root_url(locale: nil), "/")
  end

  #**************** section is a? ****************#
  # check if current section visited is home page
  def is_home?
    @cama_visited_home.present?
  end

  # check if current section visited is for post
  def is_page?
    @cama_visited_post.present?
  end

  # check if current section visited is for post
  def is_profile?
    @cama_visited_profile.present?
  end

  # check if current section visited is for ajax
  def is_ajax?
    @cama_visited_ajax.present?
  end

  # check if current section visited is for search
  def is_search?
    @cama_visited_search.present?
  end

  # check if current section visited is for post type
  def is_post_type?
    @cama_visited_post_type.present?
  end

  # check if current section visited is for post tag
  def is_post_tag?
    @cama_visited_tag.present?
  end

  # check if current section visited is for category
  def is_category?
    @cama_visited_category.present?
  end

  #**************** end section is a? ****************#

  # 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
  def the_head(seo_attrs = {}, show_seo = true)
    js = "<script>var ROOT_URL = '#{cama_root_url}'; var LANGUAGE = '#{I18n.locale}'; </script>".html_safe
    js += cama_draw_pre_asset_contents
    (csrf_meta_tag || "") + "\n" + display_meta_tags(cama_the_seo(seo_attrs)) + "\n" + js + "\n" + cama_draw_custom_assets
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
camaleon_cms-2.4.3 app/helpers/camaleon_cms/frontend/site_helper.rb
camaleon_cms-2.4.2 app/helpers/camaleon_cms/frontend/site_helper.rb
camaleon_cms-2.4.1 app/helpers/camaleon_cms/frontend/site_helper.rb
camaleon_cms-2.4.0 app/helpers/camaleon_cms/frontend/site_helper.rb
camaleon_cms-2.3.7.2 app/helpers/camaleon_cms/frontend/site_helper.rb
camaleon_cms-2.3.7.1 app/helpers/camaleon_cms/frontend/site_helper.rb
camaleon_cms-2.3.7 app/helpers/camaleon_cms/frontend/site_helper.rb
camaleon_cms-2.3.6 app/helpers/camaleon_cms/frontend/site_helper.rb
camaleon_cms-2.3.5 app/helpers/camaleon_cms/frontend/site_helper.rb
camaleon_cms-2.3.4 app/helpers/camaleon_cms/frontend/site_helper.rb
camaleon_cms-2.3.3 app/helpers/camaleon_cms/frontend/site_helper.rb
camaleon_cms-2.3.2 app/helpers/camaleon_cms/frontend/site_helper.rb
camaleon_cms-2.3.1 app/helpers/camaleon_cms/frontend/site_helper.rb
camaleon_cms-2.3.0 app/helpers/camaleon_cms/frontend/site_helper.rb