Sha256: 88a81d4a103ab9b3bd2b5c9a2e91f9df7874f58758e6f459698f485fa366461e

Contents?: true

Size: 965 Bytes

Versions: 2

Compression:

Stored size: 965 Bytes

Contents

module Admin
  class DocumentsController < BaseController
  
    layout "admin"

    before_filter :authenticate_user!
    access_control do
      allow :admin
    end
  
    def index
      @search = Document.search(params[:search])
      @documents = @search.order(:title).page(params[:page])
    end
  
    def new
      @document = Document.new
    end
  
    def create
      @document = Document.new(params[:document])
      if @document.save
        redirect_to admin_documents_path
      else
        render :new
      end
    end
  
    def edit
      @document = Document.find(params[:id])
    end
  
    def update
      @document = Document.find(params[:id])
      if @document.update_attributes(params[:document])
        redirect_to admin_documents_path
      else
        render :edit
      end
    end
  
    def destroy
      @document = Document.find(params[:id])
      @document.destroy
      redirect_to admin_documents_path
    end
  
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
merrycms-0.1.7 app/controllers/admin/documents_controller.rb
merrycms-0.1.4 app/controllers/admin/documents_controller.rb