Class: Refinery::ImageSlideshows::Admin::ImageSlidesController

Inherits:
AdminController
  • Object
show all
Defined in:
app/controllers/refinery/image_slideshows/admin/image_slides_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



15
16
17
18
19
20
21
22
23
# File 'app/controllers/refinery/image_slideshows/admin/image_slides_controller.rb', line 15

def create
  @image_slide.position = (Refinery::ImageSlideshows::ImageSlide.maximum(:position) || 0) + 1

  if @image_slide.valid? && @image_slide.save
    redirect_to image_slides_path, :notice => 'Image slide was successfully created.'
  else
    render :action => :new
  end
end

#destroyObject



33
34
35
36
37
# File 'app/controllers/refinery/image_slideshows/admin/image_slides_controller.rb', line 33

def destroy
  if @image_slide.destroy
    redirect_to image_slides_path, :notice => 'Image slide was successfully deleted.'
  end
end

#indexObject



11
12
13
# File 'app/controllers/refinery/image_slideshows/admin/image_slides_controller.rb', line 11

def index
  find_image_slides
end

#updateObject



25
26
27
28
29
30
31
# File 'app/controllers/refinery/image_slideshows/admin/image_slides_controller.rb', line 25

def update
  if @image_slide.update_attributes(params[:image_slide])
    redirect_to image_slides_path, :notice => 'Image slide was successfully updated.'
  else
    render :action => :edit
  end
end