Sha256: ef7ce151d4609c3544edd18f2718d49d5c2eb086b87f6e590b0b34f741a2c988

Contents?: true

Size: 1.4 KB

Versions: 6

Compression:

Stored size: 1.4 KB

Contents

class Refinery::ApplicationController < ActionController::Base
	
	  helper_method :home_page?, :local_request?, :just_installed?, :from_dialog?, :admin?

	  protect_from_forgery # See ActionController::RequestForgeryProtection

	  include Crud # basic create, read, update and delete methods
	  include AuthenticatedSystem

	  before_filter :find_pages_for_menu, :show_welcome_page
	  rescue_from ActiveRecord::RecordNotFound, :with => :error_404
	  rescue_from ActionController::UnknownAction, :with => :error_404

	  def error_404
	    @page = Page.find_by_menu_match("^/404$", :include => [:parts, :slugs])
	    render :template => "/pages/show", :status => 404
	  end

	  def home_page?
	    params[:action] == "home" and params[:controller] == "pages"
	  end

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

	  def just_installed?
	    User.count == 0
	  end

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

		def admin?
			params[:controller] =~ /admin\/(.*)/
		end

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

	protected

	  def show_welcome_page
			render :template => "/welcome", :layout => "admin" if just_installed? and params[:controller] != "users"
	  end

	  def find_pages_for_menu
			@menu_pages = Page.top_level(include_children=true) unless admin?
	  end
	
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
refinerycms-0.9.5.13 vendor/plugins/refinery/lib/refinery/application_controller.rb
refinerycms-0.9.5.12 vendor/plugins/refinery/lib/refinery/application_controller.rb
refinerycms-0.9.5.11 vendor/plugins/refinery/lib/refinery/application_controller.rb
refinerycms-0.9.5.10 vendor/plugins/refinery/lib/refinery/application_controller.rb
refinerycms-0.9.5.9 vendor/plugins/refinery/lib/refinery/application_controller.rb
refinerycms-0.9.5.8 vendor/plugins/refinery/lib/refinery/application_controller.rb