Sha256: 4dbad9a7f223e9b0efdd8b1a92b9f102135989d8ce0f9a32decb736ccb7e9581

Contents?: true

Size: 1.29 KB

Versions: 18

Compression:

Stored size: 1.29 KB

Contents

class Forge::GalleriesController < ForgeController
  load_and_authorize_resource :except => [:edit]
  
  def index
    respond_to do |format|
      format.html { @galleries = Gallery.paginate(:per_page => 10, :page => params[:page]) }
      format.js { 
        @galleries = Gallery.where("title LIKE ?", "%#{params[:q]}%")
        render :partial => "gallery", :collection => @galleries
      }
    end
  end

  def new
    @gallery = Gallery.new
  end

  def edit
    @gallery = Gallery.find_with_photos(params[:id])
  end

  def create
    @gallery = Gallery.new(params[:gallery])
    if @gallery.save
      flash[:notice] = 'Gallery was successfully created.'
      redirect_to(forge_galleries_path)
    else
      render :action => "new"
    end
  end

  def update
    if @gallery.update_attributes(params[:gallery])
      flash[:notice] = 'Gallery was successfully updated.'
      redirect_to(edit_forge_gallery_path(@gallery))
    else
      render :action => "edit"
    end
  end

  def destroy
    @gallery.destroy
    redirect_to(forge_galleries_path)
  end

   
  def reorder
    Gallery.reorder!(params[:gallery_list])
    respond_to do |format|
      format.js { render :nothing => true }
      format.html {flash[:notice] = "Re-ordered successfully" and redirect_to forge_galleries_path }
    end
  end
  
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
forge-cli-0.1.4 lib/forge/app/controllers/forge/galleries_controller.rb
forge-cli-0.1.3 lib/forge/app/controllers/forge/galleries_controller.rb
forge-cli-0.1.2 lib/forge/app/controllers/forge/galleries_controller.rb
forge-cli-0.1.1 lib/forge/app/controllers/forge/galleries_controller.rb
forge-cli-0.1.0 lib/forge/app/controllers/forge/galleries_controller.rb
forge-cli-0.0.18 lib/forge/app/controllers/forge/galleries_controller.rb
forge-cli-0.0.17 lib/forge/app/controllers/forge/galleries_controller.rb
forge-cli-0.0.16 lib/forge/app/controllers/forge/galleries_controller.rb
forge-cli-0.0.15 lib/forge/app/controllers/forge/galleries_controller.rb
forge-cli-0.0.14 lib/forge/app/controllers/forge/galleries_controller.rb
forge-cli-0.0.13 lib/forge/app/controllers/forge/galleries_controller.rb
forge-cli-0.0.12 lib/forge/app/controllers/forge/galleries_controller.rb
forge-cli-0.0.11 lib/forge/app/controllers/forge/galleries_controller.rb
forge-cli-0.0.10 lib/forge/app/controllers/forge/galleries_controller.rb
forge-cli-0.0.9 lib/forge/app/controllers/forge/galleries_controller.rb
forge-cli-0.0.8 lib/forge/app/controllers/forge/galleries_controller.rb
forge-cli-0.0.7 lib/forge/app/controllers/forge/galleries_controller.rb
forge-cli-0.0.6 lib/forge/app/controllers/forge/galleries_controller.rb