Module: Refinery::ApplicationController::InstanceMethods
- Defined in:
- lib/refinery/application_controller.rb
Instance Method Summary collapse
- #admin? ⇒ Boolean
- #error_404(exception = nil) ⇒ Object
- #from_dialog? ⇒ Boolean
- #home_page? ⇒ Boolean
- #just_installed? ⇒ Boolean
- #local_request? ⇒ Boolean
- #login? ⇒ Boolean
Instance Method Details
#admin? ⇒ Boolean
46 47 48 |
# File 'lib/refinery/application_controller.rb', line 46 def admin? controller_name =~ %r{^admin/} end |
#error_404(exception = nil) ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/refinery/application_controller.rb', line 50 def error_404(exception=nil) # fallback to the default 404.html page. file = Rails.root.join('public', '404.html') file = Refinery.roots('core').join('public', '404.html') unless file.exist? render :file => file.cleanpath.to_s, :layout => false, :status => 404 end |
#from_dialog? ⇒ Boolean
59 60 61 |
# File 'lib/refinery/application_controller.rb', line 59 def from_dialog? params[:dialog] == "true" or params[:modal] == "true" end |
#home_page? ⇒ Boolean
63 64 65 |
# File 'lib/refinery/application_controller.rb', line 63 def home_page? root_path == request.path end |
#just_installed? ⇒ Boolean
67 68 69 |
# File 'lib/refinery/application_controller.rb', line 67 def just_installed? Role[:refinery].users.empty? end |
#local_request? ⇒ Boolean
71 72 73 |
# File 'lib/refinery/application_controller.rb', line 71 def local_request? Rails.env.development? or request.remote_ip =~ /(::1)|(127.0.0.1)|((192.168).*)/ end |
#login? ⇒ Boolean
75 76 77 |
# File 'lib/refinery/application_controller.rb', line 75 def login? (controller_name =~ /^(user|session)(|s)/ and not admin?) or just_installed? end |