Sha256: 6acab3406de526a5a2e2ec78006046954ab677c75b9fd497f9394962974a3fd1

Contents?: true

Size: 1.28 KB

Versions: 60

Compression:

Stored size: 1.28 KB

Contents

class GalleriesController < InheritedResources::Base
  belongs_to :user, :optional=>true
  before_filter :load_user

  def index
    index! do |format|
      if params[:CKEditorFuncNum]
        format.html{
          render :action=>:index, :layout=>"image_dialog"
        }
      end
    end
  end

  def edit
    edit! do |format|
      if params[:CKEditorFuncNum]
        format.html{
          render :action=>:edit, :layout=>"image_dialog"
        }
      end
    end
  end

  def show
    show! do |format|
      @images = paginated_images_for(@gallery)
      if params[:CKEditorFuncNum]
        format.html{
          render :action=>:show, :layout=>"image_dialog"
        }
      end
    end
  end

  def new
    @gallery = Gallery.create(:user=>@user)
    new!
  end

  def create
    create! {images_path(params.slice(:CKEditor, :CKEditorFuncNum, :langCode))}
  end

  def load_user
    unless params[:user_id]
      @user ||= (current_user ? User.find(current_user.id) : super_user)
    end
  end
  helper_method :ckeditor_params, :paginated_images_for

  def paginated_images_for(gallery)
    @images ||= Image.where(:gallery_id=>gallery.id).paginate(:page => params[:page], :order => 'created_at DESC' )
  end

  def ckeditor_params
    params.slice(:CKEditor, :CKEditorFuncNum, :langCode)
  end
end

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
wheels-0.1.30 app/controllers/galleries_controller.rb
wheels-0.1.28 app/controllers/galleries_controller.rb
wheels-0.1.27 app/controllers/galleries_controller.rb
wheels-0.1.25 app/controllers/galleries_controller.rb
wheels-0.1.24 app/controllers/galleries_controller.rb
wheels-0.1.23 app/controllers/galleries_controller.rb
wheels-0.1.22 app/controllers/galleries_controller.rb
wheels-0.1.21 app/controllers/galleries_controller.rb
wheels-0.1.20 app/controllers/galleries_controller.rb
wheels-0.1.19 app/controllers/galleries_controller.rb
wheels-0.1.18 app/controllers/galleries_controller.rb
wheels-0.1.17 app/controllers/galleries_controller.rb
wheels-0.1.16 app/controllers/galleries_controller.rb
wheels-0.1.15 app/controllers/galleries_controller.rb
wheels-0.1.14 app/controllers/galleries_controller.rb
wheels-0.1.13 app/controllers/galleries_controller.rb
wheels-0.1.12 app/controllers/galleries_controller.rb
wheels-0.1.10 app/controllers/galleries_controller.rb
wheels-0.1.9 app/controllers/galleries_controller.rb
wheels-0.1.8 app/controllers/galleries_controller.rb