Class: ThinkFeelDoEngine::BitMaker::ContentProvidersController
Overview
Enables Admins to create, update, and delete content providers Content providers display the unique views that participants As they traverse each tool each day
Constant Summary
collapse
- PROVIDER_NOT_FOUND =
"The slide you are looking for no longer exists."
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'app/controllers/think_feel_do_engine/bit_maker/content_providers_controller.rb', line 46
def create
authorize! :create, BitCore::ContentProvider
@content_provider = ContentProviderDecorator
.new(content_provider_params)
if @content_provider.save
redirect_to arm_bit_maker_content_provider_path(
@arm, @content_provider
), notice: "ContentProvider was successfully created."
else
flash.now[:alert] = "Unable to save ContentProvider " +
model_errors
render :new
end
end
|
#destroy ⇒ Object
77
78
79
80
81
82
83
84
85
86
87
88
89
|
# File 'app/controllers/think_feel_do_engine/bit_maker/content_providers_controller.rb', line 77
def destroy
authorize! :destroy, BitCore::ContentProvider
@content_provider = find_content_provider
if @content_provider.destroy
redirect_to arm_bit_maker_content_providers_url(@arm),
notice: "Content provider was successfully destroyed."
else
redirect_to arm_bit_maker_content_providers_url(@arm),
alert: "Unable to delete ContentProvider " +
model_errors
end
end
|
#edit ⇒ Object
41
42
43
44
|
# File 'app/controllers/think_feel_do_engine/bit_maker/content_providers_controller.rb', line 41
def edit
authorize! :edit, BitCore::ContentProvider
@content_provider = find_content_provider
end
|
#index ⇒ Object
14
15
16
17
|
# File 'app/controllers/think_feel_do_engine/bit_maker/content_providers_controller.rb', line 14
def index
authorize! :index, BitCore::ContentProvider
@content_providers = BitCore::ContentProvider.all
end
|
#new ⇒ Object
32
33
34
35
36
37
38
39
|
# File 'app/controllers/think_feel_do_engine/bit_maker/content_providers_controller.rb', line 32
def new
authorize! :new, BitCore::ContentProvider
@content_provider = ContentProviderDecorator
.new(
bit_core_content_module_id:
params[:bit_core_content_module_id]
)
end
|
#show ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'app/controllers/think_feel_do_engine/bit_maker/content_providers_controller.rb', line 19
def show
authorize! :show, BitCore::ContentProvider
begin
@content_provider = find_content_provider
if @content_provider.source_content_id
@slideshow = @content_provider.source_content
end
rescue ActiveRecord::RecordNotFound
redirect_to main_app.root_path, alert: PROVIDER_NOT_FOUND
end
end
|
#update ⇒ Object
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# File 'app/controllers/think_feel_do_engine/bit_maker/content_providers_controller.rb', line 62
def update
authorize! :update, BitCore::ContentProvider
@content_provider = find_content_provider
if @content_provider.update(content_provider_params)
redirect_to arm_bit_maker_content_provider_path(
@arm, @content_provider
), notice: "ContentProvider was successfully updated."
else
flash.now[:alert] = "Unable to save ContentProvider " +
model_errors
render :edit
end
end
|