Class: ThinkFeelDoEngine::BitMaker::SlideshowsController
Overview
Enables Admins to create, update, delete, and view the slideshow content
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
Instance Method Details
#create ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'app/controllers/think_feel_do_engine/bit_maker/slideshows_controller.rb', line 29
def create
if @slideshow.save
@content_provider =
@arm
.bit_core_tools
.find_by_type("Tools::Learn")
.add_module(@slideshow.title)
.add_content_provider(
"BitCore::ContentProviders::SlideshowProvider"
)
@content_provider.update(source_content: @slideshow)
redirect_to arm_bit_maker_slideshows_url(@arm),
notice: "Successfully created slideshow"
else
flash.now[:alert] = @slideshow.errors.full_messages.join(", ")
render :new
end
end
|
#destroy ⇒ Object
61
62
63
64
65
66
67
68
69
|
# File 'app/controllers/think_feel_do_engine/bit_maker/slideshows_controller.rb', line 61
def destroy
if @slideshow.destroy
redirect_to arm_bit_maker_slideshows_url(@arm),
notice: "Slideshow deleted."
else
redirect_to arm_bit_maker_slideshows_url(@arm),
alert: @slideshow.errors.full_messages.join(", ")
end
end
|
#edit ⇒ Object
48
49
|
# File 'app/controllers/think_feel_do_engine/bit_maker/slideshows_controller.rb', line 48
def edit
end
|
#index ⇒ Object
12
13
14
15
16
|
# File 'app/controllers/think_feel_do_engine/bit_maker/slideshows_controller.rb', line 12
def index
authorize! :index, BitCore::Slideshow
@slideshows = @arm
.bit_core_slideshows
end
|
#new ⇒ Object
24
25
26
27
|
# File 'app/controllers/think_feel_do_engine/bit_maker/slideshows_controller.rb', line 24
def new
@slideshow = @arm.bit_core_slideshows.build
authorize! :create, @slideshow
end
|
#show ⇒ Object
18
19
20
21
22
|
# File 'app/controllers/think_feel_do_engine/bit_maker/slideshows_controller.rb', line 18
def show
@anchors = SlideshowAnchor
.where(bit_core_slideshow_id: @slideshow.id)
.group_by(&:target_name)
end
|
#update ⇒ Object
51
52
53
54
55
56
57
58
59
|
# File 'app/controllers/think_feel_do_engine/bit_maker/slideshows_controller.rb', line 51
def update
if @slideshow.update(slideshow_params)
redirect_to arm_bit_maker_slideshows_url(@arm),
notice: "Successfully updated slideshow"
else
flash.now[:alert] = @slideshow.errors.full_messages.join(", ")
render :edit
end
end
|