module RocketCMS::Models::Page

Public Instance Methods

clean_regexp() click to toggle source
# File lib/rocket_cms/models/page.rb, line 61
def clean_regexp
  if regexp.blank?
    /^#{regexp_prefix}#{Regexp.escape(fullpath)}$/
  else
    begin
      /#{regexp}/
    rescue
      # not a valid regexp - treat as literal search string
      /#{Regexp.escape(regexp)}/
    end
  end
end
get_fullpath() click to toggle source
# File lib/rocket_cms/models/page.rb, line 26
def get_fullpath
  redirect.blank? ? fullpath : redirect
end
has_content?() click to toggle source
# File lib/rocket_cms/models/page.rb, line 30
def has_content?
  @content_used.nil? && !content.blank?
end
is_current?(url) click to toggle source
# File lib/rocket_cms/models/page.rb, line 49
def is_current?(url)
  if fullpath == '/'
    url == '/'
  else
    url.match(clean_regexp)
  end
end
nav_options() click to toggle source
page_content() click to toggle source
# File lib/rocket_cms/models/page.rb, line 34
def page_content
  if @content_used.nil?
    @content_used = true
    if content.nil?
      ''
    else
      content.gsub(/\{\{(.*?)\}\}/) do
        Settings.get($1).val
      end
    end
  else
    ''
  end
end
regexp_prefix() click to toggle source
# File lib/rocket_cms/models/page.rb, line 57
def regexp_prefix
  ""
end