Class: Refinery::ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Includes:
AuthenticatedSystem, Crud
Defined in:
vendor/plugins/refinery/lib/refinery/application_controller.rb

Direct Known Subclasses

ApplicationController

Instance Method Summary collapse

Methods included from Crud

append_features

Instance Method Details

#admin?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'vendor/plugins/refinery/lib/refinery/application_controller.rb', line 39

def admin?
  controller_name =~ /^admin\//
end

#error_404Object



13
14
15
16
17
18
19
20
21
# File 'vendor/plugins/refinery/lib/refinery/application_controller.rb', line 13

def error_404
  if (@page = Page.find_by_menu_match("^/404$", :include => [:parts, :slugs])).present?
    # render the application's custom 404 page with layout.
    render :template => "/pages/show", :status => 404
  else
    # fallback to the default 404.html page.
    render :file => Rails.root.join("public", "404.html"), :layout => false, :status => 404
  end
end

#from_dialog?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'vendor/plugins/refinery/lib/refinery/application_controller.rb', line 35

def from_dialog?
  params[:dialog] == "true" or params[:modal] == "true"
end

#home_page?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'vendor/plugins/refinery/lib/refinery/application_controller.rb', line 23

def home_page?
  action_name == "home" and controller_name == "pages"
end

#just_installed?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'vendor/plugins/refinery/lib/refinery/application_controller.rb', line 31

def just_installed?
  !User.exists?
end

#local_request?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'vendor/plugins/refinery/lib/refinery/application_controller.rb', line 27

def local_request?
  ENV["RAILS_ENV"] == "development" or request.remote_ip =~ /(::1)|(127.0.0.1)|((192.168).*)/
end

#wymiframeObject



43
44
45
# File 'vendor/plugins/refinery/lib/refinery/application_controller.rb', line 43

def wymiframe
  render :template => "/wymiframe", :layout => false
end