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, #raise_not_found!, #render_not_found
Instance Method Details
#create ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'app/controllers/think_feel_do_engine/bit_maker/slideshows_controller.rb', line 30
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
62
63
64
65
66
67
68
69
70
|
# File 'app/controllers/think_feel_do_engine/bit_maker/slideshows_controller.rb', line 62
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
49
50
|
# File 'app/controllers/think_feel_do_engine/bit_maker/slideshows_controller.rb', line 49
def edit
end
|
#index ⇒ Object
13
14
15
16
17
|
# File 'app/controllers/think_feel_do_engine/bit_maker/slideshows_controller.rb', line 13
def index
authorize! :index, BitCore::Slideshow
@slideshows = @arm
.bit_core_slideshows
end
|
#new ⇒ Object
25
26
27
28
|
# File 'app/controllers/think_feel_do_engine/bit_maker/slideshows_controller.rb', line 25
def new
@slideshow = @arm.bit_core_slideshows.build
authorize! :create, @slideshow
end
|
#show ⇒ Object
19
20
21
22
23
|
# File 'app/controllers/think_feel_do_engine/bit_maker/slideshows_controller.rb', line 19
def show
@anchors = SlideshowAnchor
.where(bit_core_slideshow_id: @slideshow.id)
.group_by(&:target_name)
end
|
#update ⇒ Object
52
53
54
55
56
57
58
59
60
|
# File 'app/controllers/think_feel_do_engine/bit_maker/slideshows_controller.rb', line 52
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
|