Module: Refinery::Admin::BaseController::InstanceMethods

Defined in:
lib/refinery/admin/base_controller.rb

Instance Method Summary collapse

Instance Method Details

#admin?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/refinery/admin/base_controller.rb', line 25

def admin?
  true # we're in the admin base controller, so always true.
end

#error_404(exception = nil) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/refinery/admin/base_controller.rb', line 33

def error_404(exception=nil)
  if (@page = Page.find_by_menu_match("^/404$", :include => [:parts, :slugs])).present?
    params[:action] = 'error_404'
    # change any links in the copy to the admin_root_path
    # and any references to "home page" to "Dashboard"
    part_symbol = Page.default_parts.first.to_sym
    @page[part_symbol] = @page[part_symbol].to_s.gsub(
                           /href=(\'|\")\/(\'|\")/, "href='#{admin_root_path}'"
                         ).gsub("home page", "Dashboard")

    render :template => "/pages/show",
           :layout => layout?,
           :status => 404
  else
    # fallback to the default 404.html page.
    render :file => Rails.root.join("public", "404.html").cleanpath.to_s,
           :layout => false,
           :status => 404
  end
end

#searching?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/refinery/admin/base_controller.rb', line 29

def searching?
  params[:search].present?
end