Class: Course::Condition::AchievementsController

Inherits:
Course::ConditionsController show all
Defined in:
app/controllers/course/condition/achievements_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


12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/course/condition/achievements_controller.rb', line 12

def create
  @achievement_condition.conditional = @conditional
  @achievement_condition.course = current_course
  authorize!(:create, @achievement_condition)

  if @achievement_condition.save
    redirect_to return_to_path, success: t('course.condition.achievements.create.success')
  else
    render :new
  end
end

#destroyObject


35
36
37
38
39
40
41
# File 'app/controllers/course/condition/achievements_controller.rb', line 35

def destroy
  if @achievement_condition.destroy
    redirect_to return_to_path, success: t('course.condition.achievements.destroy.success')
  else
    redirect_to return_to_path, danger: t('course.condition.achievements.destroy.error')
  end
end

#editObject


24
25
# File 'app/controllers/course/condition/achievements_controller.rb', line 24

def edit
end

#newObject


7
8
9
10
# File 'app/controllers/course/condition/achievements_controller.rb', line 7

def new
  @achievement_condition.course = current_course
  authorize!(:new, @achievement_condition)
end

#updateObject


27
28
29
30
31
32
33
# File 'app/controllers/course/condition/achievements_controller.rb', line 27

def update
  if @achievement_condition.update_attributes(achievement_condition_params)
    redirect_to return_to_path, success: t('course.condition.achievements.update.success')
  else
    render :edit
  end
end