Class: Admin::SlidesController

Inherits:
AdminController
  • Object
show all
Defined in:
app/controllers/c/admin/slides_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



9
10
11
12
13
14
15
16
# File 'app/controllers/c/admin/slides_controller.rb', line 9

def create
  @slide = @slideshow.slides.new(slide_params)
  if @slide.save
    redirect_to edit_slideshow_path(@slideshow), notice: 'Slide created'
  else
    render :new
  end
end

#destroyObject



26
27
28
29
30
31
32
33
34
# File 'app/controllers/c/admin/slides_controller.rb', line 26

def destroy
  @slide.destroy
  respond_to do |format|
    format.js
    format.html do
      redirect_to @slideshow, notice: 'Slide deleted'
    end
  end
end

#sortObject



36
37
38
39
40
41
42
# File 'app/controllers/c/admin/slides_controller.rb', line 36

def sort
  @slides = C::Slideshow.find(params[:slideshow_id]).slides
  @slides.update_order(params[:slideshow])
  respond_to do |format|
    format.js { head :ok, content_type: 'text/html' }
  end
end

#updateObject



18
19
20
21
22
23
24
# File 'app/controllers/c/admin/slides_controller.rb', line 18

def update
  if @slide.update(slide_params)
    redirect_to edit_slideshow_path(@slideshow), notice: 'Slide updated'
  else
    render :edit
  end
end