Class: Course::LevelsComponent

Inherits:
SimpleDelegator
  • Object
show all
Includes:
ControllerComponentHost::Component
Defined in:
app/controllers/components/course/levels_component.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.display_nameObject


5
6
7
# File 'app/controllers/components/course/levels_component.rb', line 5

def self.display_name
  I18n.t('components.levels.name')
end

.gamified?Boolean

Returns:

  • (Boolean)

9
10
11
# File 'app/controllers/components/course/levels_component.rb', line 9

def self.gamified?
  true
end

Instance Method Details


13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/components/course/levels_component.rb', line 13

def sidebar_items
  return [] unless can?(:manage, Course::Level.new(course: current_course))

  [
    {
      key: :levels,
      icon: 'star-half-o',
      title: I18n.t('course.levels.sidebar_title'),
      type: :admin,
      weight: 6,
      path: course_levels_path(current_course)
    }
  ]
end