Sha256: 26b7dde3f0d39eda4fe348eaa7562d29f649c70e411a69f30c429553cb7620b6

Contents?: true

Size: 1.1 KB

Versions: 3

Compression:

Stored size: 1.1 KB

Contents

module Dust
  module Gallery
    class AlbumsController < AuthenticationController

      filter_access_to :all

      layout 'cms'

      def index
        @albums = Dust::Gallery::Album.all
      end

      def new
        @album = Dust::Gallery::Album.new_with_menu_item
      end

      def edit
        @album = Dust::Gallery::Album.find(params[:id])
      end

      def create
        @album = Dust::Gallery::Album.new_with_menu_item(params[:dust_gallery_album])

        if @album.save
          redirect_to edit_dust_gallery_album_path(@album), notice: 'Album was successfully created.'
        else
          render action: "new"
        end
      end

      def update
        @album = Dust::Gallery::Album.find(params[:id])

        if @album.update_attributes(params[:dust_gallery_album])
          redirect_to dust_gallery_albums_path, notice: 'Album was successfully updated.'
        else
          render action: "edit"
        end
      end

      def destroy
        @album = Dust::Gallery::Album.find(params[:id])
        @album.destroy

        redirect_to dust_gallery_albums_url
      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/albums_controller.rb
dust-cms-0.0.06 app/controllers/dust/gallery/albums_controller.rb
dust-cms-0.0.05 app/controllers/dust/gallery/albums_controller.rb