Sha256: 1479957c185a1a89fc44fabcdd1078425e732d1ab495c1b4e87b089dcfe8746e

Contents?: true

Size: 1.11 KB

Versions: 3

Compression:

Stored size: 1.11 KB

Contents

module Dust
  module Gallery
    class PhotosController < AuthenticationController

      filter_access_to :all

      layout 'cms'

      def show
        @photo = Dust::Gallery::Photo.find params[:id]
      end

      def edit
        @photo = Dust::Gallery::Photo.find params[:id]
      end

      #def create
        #file = AppSpecificStringIO.new(params[:qqfile], request.raw_post)
        #@photo = Dust::Gallery::Photo.new :filename => file, :album_id => params[:album_id]

        #if @photo.save
          #redirect_to @photo, notice: 'Photo was successfully created.'
        #else
          #render :json => {success: false}
        #end
      #end

      def update
        @photo = Photo.find(params[:id])

        if @photo.update_attributes(params[:dust_gallery_photo])
          redirect_to edit_dust_gallery_album_path(@photo.album), notice: 'Photo was successfully updated.'
        else
          render action: "edit"
        end
      end

      def destroy
        @photo = Photo.find(params[:id])
        @photo.destroy

        redirect_to edit_dust_gallery_album_path(@photo.album)
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dust-cms-0.0.07 app/controllers/dust/gallery/photos_controller.rb
dust-cms-0.0.06 app/controllers/dust/gallery/photos_controller.rb
dust-cms-0.0.05 app/controllers/dust/gallery/photos_controller.rb