Sha256: 88a2d0d6226b802c9472e838a40ad7f82f071a0759bcbc304340caa2d26164fa

Contents?: true

Size: 1.32 KB

Versions: 7

Compression:

Stored size: 1.32 KB

Contents

=begin

  @File Name                 : admin_controller.rb
  @Company Name              : Mindfire Solutions Private Limited
  @Creator Name              : Vikram Kumar Mishra
  @Date Created              : 2012-06-05
  @Date Modified             :
  @Last Modification Details :
  @Purpose                   : To check current user's access, It is yet to implement.

=end

class AdminController < ApplicationController

  #admin part
  # check if mcms core layout exists
  if Gem.available?('mcms')

   #if yes then use core layout
   layout "mcms/main_layout"

  else # if not

    # use page's default layout
    layout "mcms_pages/layouts/mcms_layout"

  end # end if

  # use before filter to authenticate user
  prepend_before_filter :authenticate_user!

  # check authorization for a user
  load_and_authorize_resource

  # rescue from record not found exception
  rescue_from ActiveRecord::RecordNotFound, :with => :render_404


  # @params   : None
  # @return   : None
  # @purpose  : To render 404.html from public folder
  def render_404

    # render data in different format
    respond_to do |format|

      format.html { render :file => "#{Rails.root}/public/404.html", :status => :not_found }
      format.xml  { head :not_found }
      format.any  { head :not_found }

    end # end respond_to block

  end # end method

end # end class

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mcms_pages-1.0.0 app/controllers/admin_controller.rb
mcms_pages-0.0.7 app/controllers/admin_controller.rb
mcms_pages-0.0.6 app/controllers/admin_controller.rb
mcms_pages-0.0.5 app/controllers/admin_controller.rb
mcms_pages-0.0.4 app/controllers/admin_controller.rb
mcms_pages-0.0.3 app/controllers/admin_controller.rb
mcms_pages-0.0.2 app/controllers/admin_controller.rb