Class: ThinkFeelDoEngine::LessonSlidesController
Overview
Enables slide CRUD functionality.
Constant Summary
ApplicationController::CSRF_COOKIE_NAME, ApplicationController::CSRF_HEADER_NAME, ApplicationController::INACTIVE_MESSAGE, ApplicationController::ROOT_URI
Instance Method Summary
collapse
#access_denied_resource_path, #after_sign_in_path_for, #after_sign_out_path_for, #raise_not_found!, #render_not_found
Instance Method Details
#create ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'app/controllers/think_feel_do_engine/lesson_slides_controller.rb', line 17
def create
authorize! :create, BitCore::Slide
@slide = @lesson.build_slide(slide_params)
if @slide.save
redirect_to arm_lesson_path(@arm, @lesson),
notice: "Successfully created slide for lesson"
else
flash.now[:alert] = @slide.errors.full_messages.join(", ")
render :new
end
end
|
#destroy ⇒ Object
50
51
52
53
54
55
56
57
58
|
# File 'app/controllers/think_feel_do_engine/lesson_slides_controller.rb', line 50
def destroy
authorize! :destroy, BitCore::Slide
if @lesson.destroy_slide(@slide)
redirect_to arm_lesson_path(@arm, @lesson), notice: "Slide deleted"
else
redirect_to arm_lesson_path(@arm, @lesson), alert: "There were errors."
end
end
|
#edit ⇒ Object
34
35
36
|
# File 'app/controllers/think_feel_do_engine/lesson_slides_controller.rb', line 34
def edit
authorize! :edit, BitCore::Slide
end
|
#new ⇒ Object
12
13
14
15
|
# File 'app/controllers/think_feel_do_engine/lesson_slides_controller.rb', line 12
def new
authorize! :new, BitCore::Slide
@slide = @lesson.build_slide(slide_params)
end
|
#show ⇒ Object
30
31
32
|
# File 'app/controllers/think_feel_do_engine/lesson_slides_controller.rb', line 30
def show
authorize! :show, BitCore::Slide
end
|
#sort ⇒ Object
60
61
62
63
64
65
66
67
68
69
|
# File 'app/controllers/think_feel_do_engine/lesson_slides_controller.rb', line 60
def sort
authorize! :update, ContentModules::LessonModule
if @lesson.sort(params[:slide])
flash.now[:success] = "Reorder was successful."
else
flash.now[:alert] = @lesson.errors.full_messages.join(", ")
end
render nothing: true
end
|
#update ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
|
# File 'app/controllers/think_feel_do_engine/lesson_slides_controller.rb', line 38
def update
authorize! :update, BitCore::Slide
if @slide.update(slide_params)
redirect_to arm_lesson_path(@arm, @lesson),
notice: "Successfully updated slide for lesson"
else
flash.now[:alert] = @slide.errors.full_messages.join(", ")
render :edit
end
end
|