Sha256: 0d08200e0c416b8f737236ac808aefa8cf95e92ded8dc96cbe2f7be073e15f5a

Contents?: true

Size: 902 Bytes

Versions: 2

Compression:

Stored size: 902 Bytes

Contents

module Admin
  class ImagesController < BaseController
  
    layout "admin"

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

Version data entries

2 entries across 2 versions & 1 rubygems

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