Sha256: a0f1058f282aa6bb057ecf31e43f0c185519bc6e9a355320705a627848d593ff

Contents?: true

Size: 1.58 KB

Versions: 13

Compression:

Stored size: 1.58 KB

Contents

class ApplicationController < ActionController::Base
  protect_from_forgery
  rescue_from CanCan::AccessDenied, :with => :render_403
  rescue_from ActiveRecord::RecordNotFound, :with => :render_404

  private
  def render_403
    return if performed?
    if user_signed_in?
      respond_to do |format|
        format.html {render :file => "#{Rails.root}/public/404", :status => 403}
        format.xml
        format.json
      end
    else
      respond_to do |format|
        format.html {redirect_to new_user_session_url}
        format.xml  {render :status => 403}
        format.json
      end
    end
  end

  def render_404
    return if performed?
    respond_to do |format|
      format.html {render :file => "#{Rails.root}/public/404", :status => 404}
      format.xml
      format.json
    end
  end

  def get_work
    @work = Manifestation.find(params[:work_id]) if params[:work_id]
    authorize! :show, @work if @work
  end

  def get_subject_heading_type
    @subject_heading_type = SubjectHeadingType.find(params[:subject_heading_type_id]) if params[:subject_heading_type_id]
  end

  def get_subject
    @subject = Subject.find(params[:subject_id]) if params[:subject_id]
  end

  def get_classification
    @classification = Classification.find(params[:classification_id]) if params[:classification_id]
  end

  def solr_commit
    Sunspot.commit
  end

  def move_position(resource, direction)
    if ['higher', 'lower'].include?(direction)
      resource.send("move_#{direction}")
      redirect_to url_for(:controller => resource.class.to_s.pluralize.underscore)
      return
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
enju_subject-0.1.0.pre4 spec/dummy/app/controllers/application_controller.rb
enju_subject-0.1.0.pre3 spec/dummy/app/controllers/application_controller.rb
enju_subject-0.1.0.pre2 spec/dummy/app/controllers/application_controller.rb
enju_subject-0.1.0.pre spec/dummy/app/controllers/application_controller.rb
enju_subject-0.0.18 spec/dummy/app/controllers/application_controller.rb
enju_subject-0.0.17 spec/dummy/app/controllers/application_controller.rb
enju_subject-0.0.16 spec/dummy/app/controllers/application_controller.rb
enju_subject-0.0.15 spec/dummy/app/controllers/application_controller.rb
enju_subject-0.0.14 spec/dummy/app/controllers/application_controller.rb
enju_subject-0.0.13 spec/dummy/app/controllers/application_controller.rb
enju_subject-0.0.12 spec/dummy/app/controllers/application_controller.rb
enju_subject-0.0.10 spec/dummy/app/controllers/application_controller.rb
enju_subject-0.0.9 spec/dummy/app/controllers/application_controller.rb