Class: ThinkFeelDoEngine::BitMaker::ContentModulesController

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

Overview

Enables users to create, update, and delete modules These modules contain providers that display content to the participants

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

Instance Method Details

#createObject

POST /content_modules



32
33
34
35
36
37
38
39
40
41
# File 'app/controllers/think_feel_do_engine/bit_maker/content_modules_controller.rb', line 32

def create
  @content_module = BitCore::ContentModule.new(content_module_params)

  if @content_module.save
    redirect_to arm_bit_maker_content_module_path(@arm, @content_module),
                notice: "Content module was successfully created."
  else
    render :new
  end
end

#destroyObject

DELETE /content_modules/1



54
55
56
57
58
59
60
61
62
63
# File 'app/controllers/think_feel_do_engine/bit_maker/content_modules_controller.rb', line 54

def destroy
  if content_module_destroyed
    redirect_to arm_bit_maker_content_modules_path(@arm),
                notice: "Content module along with any\
                associated tasks were successfully destroyed."
  else
    redirect_to arm_bit_maker_content_modules_path(@arm),
                alert: "There were errors"
  end
end

#editObject

GET /content_modules/1/edit



28
29
# File 'app/controllers/think_feel_do_engine/bit_maker/content_modules_controller.rb', line 28

def edit
end

#indexObject

GET /content_modules



13
14
15
# File 'app/controllers/think_feel_do_engine/bit_maker/content_modules_controller.rb', line 13

def index
  authorize! :index, BitCore::ContentModule
end

#newObject

GET /content_modules/new



22
23
24
25
# File 'app/controllers/think_feel_do_engine/bit_maker/content_modules_controller.rb', line 22

def new
  @content_module = BitCore::ContentModule.new
  authorize! :create, @content_module
end

#showObject

GET /content_modules/1



18
19
# File 'app/controllers/think_feel_do_engine/bit_maker/content_modules_controller.rb', line 18

def show
end

#updateObject

PATCH/PUT /content_modules/1



44
45
46
47
48
49
50
51
# File 'app/controllers/think_feel_do_engine/bit_maker/content_modules_controller.rb', line 44

def update
  if @content_module.update(content_module_params)
    redirect_to arm_bit_maker_content_module_path(@arm, @content_module),
                notice: "Content module was successfully updated."
  else
    render :edit
  end
end