Sha256: 6371c8c3143cdcf5401948df295cbc9f77cb8d7fd892800c77f0db0d947a480a

Contents?: true

Size: 1.33 KB

Versions: 3

Compression:

Stored size: 1.33 KB

Contents

require_dependency 'radiant'

class ApplicationController < ActionController::Base
  include LoginSystem
  include Radiant::LegacyRoutes
  
  filter_parameter_logging :password, :password_confirmation
  
  protect_from_forgery
  
  before_filter :set_current_user
  before_filter :set_javascripts_and_stylesheets
  
  attr_accessor :config, :cache
  
  def initialize
    super
    @config = Radiant::Config
    @cache = ResponseCache.instance
  end
  
  # helpers to include additional assets from actions or views
  helper_method :include_stylesheet, :include_javascript
  
  def include_stylesheet(sheet)
    @stylesheets << sheet
  end
  
  def include_javascript(script)
    @javascripts << script
  end
  
  def rescue_action_in_public(exception)
    case exception
      when ActiveRecord::RecordNotFound, ActionController::UnknownController, ActionController::UnknownAction, ActionController::RoutingError
        render :template => "site/not_found", :status => 404
      else
        super
    end
  end
  
  private
  
    def set_current_user
      UserActionObserver.current_user = current_user
    end
  
    def set_javascripts_and_stylesheets
      @stylesheets ||= []
      @stylesheets.concat %w(admin/main)
      @javascripts ||= []
      @javascripts.concat %w(prototype string effects admin/tabcontrol admin/ruledtable admin/admin)
    end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
radiant-0.7.2 app/controllers/application.rb
radiant-0.7.0 app/controllers/application.rb
radiant-0.7.1 app/controllers/application.rb