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 collapse

ARM_NOT_FOUND_MESSAGE =
"Unable to find that arm."

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, #raise_not_found!, #render_not_found

Instance Method Details

#createObject

POST /content_modules



36
37
38
39
40
41
42
43
44
45
# File 'app/controllers/think_feel_do_engine/bit_maker/content_modules_controller.rb', line 36

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



58
59
60
61
62
63
64
65
66
67
# File 'app/controllers/think_feel_do_engine/bit_maker/content_modules_controller.rb', line 58

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



32
33
# File 'app/controllers/think_feel_do_engine/bit_maker/content_modules_controller.rb', line 32

def edit
end

#indexObject

GET /content_modules



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

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

#newObject

GET /content_modules/new



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

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

#showObject

GET /content_modules/1



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

def show
end

#updateObject

PATCH/PUT /content_modules/1



48
49
50
51
52
53
54
55
# File 'app/controllers/think_feel_do_engine/bit_maker/content_modules_controller.rb', line 48

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