Class: Course::Assessment::Question::VoiceResponsesController

Inherits:
Controller show all
Defined in:
app/controllers/course/assessment/question/voice_responses_controller.rb

Instance Method Summary collapse

Methods included from ApplicationSignInCallbacksConcern

#sign_in

Methods included from ApplicationPaginationConcern

#page_param

Methods included from ApplicationAnnouncementsConcern

#global_announcements, #unread_global_announcements

Methods included from ApplicationInstanceUserConcern

#current_instance_user

Methods included from ApplicationUserTimeZoneConcern

#set_time_zone

Methods included from ApplicationUserConcern

#handle_access_denied, #publicly_accessible?

Methods included from ApplicationComponentsConcern

#handle_component_not_found

Instance Method Details

#createObject


9
10
11
12
13
14
15
16
# File 'app/controllers/course/assessment/question/voice_responses_controller.rb', line 9

def create
  if @voice_response_question.save
    redirect_to course_assessment_path(current_course, @assessment),
                success: t('.success')
  else
    render 'new'
  end
end

#destroyObject


34
35
36
37
38
39
40
41
42
43
# File 'app/controllers/course/assessment/question/voice_responses_controller.rb', line 34

def destroy
  if @voice_response_question.destroy
    redirect_to course_assessment_path(current_course, @assessment),
                success: t('.success')
  else
    error = @voice_response_question.errors.full_messages.to_sentence
    redirect_to course_assessment_path(current_course, @assessment),
                danger: t('.failure', error: error)
  end
end

#editObject


30
31
32
# File 'app/controllers/course/assessment/question/voice_responses_controller.rb', line 30

def edit
  @question_assessment = load_question_assessment_for(@voice_response_question)
end

#newObject


18
19
# File 'app/controllers/course/assessment/question/voice_responses_controller.rb', line 18

def new
end

#updateObject


21
22
23
24
25
26
27
28
# File 'app/controllers/course/assessment/question/voice_responses_controller.rb', line 21

def update
  if @voice_response_question.update_attributes(voice_response_question_params)
    redirect_to course_assessment_path(current_course, @assessment),
                success: t('.success')
  else
    render 'edit'
  end
end