Class: ThinkFeelDoEngine::BitMaker::SlideshowAnchorsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/think_feel_do_engine/bit_maker/slideshow_anchors_controller.rb

Overview

Enables creation and deletion of SlideshowAnchors.

Constant Summary

Constants inherited from ApplicationController

ApplicationController::CSRF_COOKIE_NAME, ApplicationController::CSRF_HEADER_NAME, ApplicationController::INACTIVE_MESSAGE, ApplicationController::ROOT_URI

Instance Method Summary collapse

Methods inherited from ApplicationController

#access_denied_resource_path, #after_sign_in_path_for, #after_sign_out_path_for, #raise_not_found!, #render_not_found

Instance Method Details

#createObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/think_feel_do_engine/bit_maker/slideshow_anchors_controller.rb', line 12

def create
  unless params[:slideshow_anchor]
    return destroy if params[:id_to_destroy].present?
    return render(js: "")
  end

  authorize! :create, SlideshowAnchor
  @slideshow_anchor = SlideshowAnchor.new(anchor_params)

  if @slideshow_anchor.save
    render "create", locals: { notice: "Anchor saved" }
  else
    render "create", locals: { alert: "Unable to save Anchor" }
  end
end

#destroyObject



28
29
30
31
32
33
34
35
36
37
# File 'app/controllers/think_feel_do_engine/bit_maker/slideshow_anchors_controller.rb', line 28

def destroy
  authorize! :destroy, SlideshowAnchor
  @slideshow_anchor = SlideshowAnchor.find(params[:id_to_destroy])

  if @slideshow_anchor.destroy
    render "destroy", locals: { notice: "Anchor deleted" }
  else
    render "destroy", locals: { alert: model_errors }
  end
end