Class: Course::Assessment::SkillsController

Inherits:
ComponentController show all
Defined in:
app/controllers/course/assessment/skills_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


18
19
20
21
22
23
24
25
# File 'app/controllers/course/assessment/skills_controller.rb', line 18

def create
  if @skill.save
    redirect_to course_assessments_skills_path(current_course),
                success: t('.success', title: @skill.title)
  else
    render 'new'
  end
end

#destroyObject


39
40
41
42
43
44
45
46
47
# File 'app/controllers/course/assessment/skills_controller.rb', line 39

def destroy
  if @skill.destroy
    redirect_to course_assessments_skills_path(current_course),
                success: t('.success', skill: @skill.title)
  else
    redirect_to course_assessments_skills_path(current_course),
                danger: t('.failure', error: @skill.errors.full_messages.to_sentence)
  end
end

#editObject


27
28
# File 'app/controllers/course/assessment/skills_controller.rb', line 27

def edit
end

#indexObject


8
9
10
11
12
13
# File 'app/controllers/course/assessment/skills_controller.rb', line 8

def index
  respond_to do |format|
    format.html { render 'index' }
    format.json { render partial: 'index' }
  end
end

#newObject


15
16
# File 'app/controllers/course/assessment/skills_controller.rb', line 15

def new
end

#updateObject


30
31
32
33
34
35
36
37
# File 'app/controllers/course/assessment/skills_controller.rb', line 30

def update
  if @skill.update_attributes(skill_params)
    redirect_to course_assessments_skills_path(current_course),
                success: t('.success', title: @skill.title)
  else
    render 'edit'
  end
end