Sha256: bf2c85a7c55755ca3f5dd28b619d74fd379c0a9d550263b4828697b0c633a498

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

require_dependency 'radiant'

class ApplicationController < ActionController::Base
  include LoginSystem
  
  filter_parameter_logging :password, :password_confirmation
  
  before_filter :set_current_user
  before_filter :set_javascripts_and_stylesheets
  
  attr_accessor :config
  
  def initialize
    super
    @config = Radiant::Config
  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 = %w(admin/main)
      @javascripts = %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.6.5.1 app/controllers/application.rb
radiant-0.6.5 app/controllers/application.rb
radiant-0.6.6 app/controllers/application.rb