Module: Course::ControllerComponentHost::Settings::ClassMethods

Defined in:
app/controllers/components/course/controller_component_host.rb

Instance Method Summary collapse

Instance Method Details

#can_be_disabled_for_course?Boolean


77
78
79
# File 'app/controllers/components/course/controller_component_host.rb', line 77

def can_be_disabled_for_course?
  true
end

#display_nameString

Override this to customise the display name of the component. The module name is the default display name.


65
66
67
# File 'app/controllers/components/course/controller_component_host.rb', line 65

def display_name
  name
end

#enabled_by_default?Boolean


50
51
52
# File 'app/controllers/components/course/controller_component_host.rb', line 50

def enabled_by_default?
  true
end

#gamified?Boolean


71
72
73
# File 'app/controllers/components/course/controller_component_host.rb', line 71

def gamified?
  false
end

#keySymbol

Unique key of the component, to serve as the key in settings and translations.


57
58
59
# File 'app/controllers/components/course/controller_component_host.rb', line 57

def key
  name.underscore.tr('/', '_').to_sym
end

#lesson_plan_item_actable_namesArray<String>

Override in the component definition with the names of the actable types if the component adds lesson plan items. A component can specify multiple actable types for display on the lesson plan page.


101
102
103
# File 'app/controllers/components/course/controller_component_host.rb', line 101

def lesson_plan_item_actable_names
  []
end

#settings_classClass?

Returns a model which the current component can use to interface with its persisted settings. The class initializer should take an instance of the component as its only argument.

Example: If the component Course::FoobarComponent has settings, define a class Course::Settings::FoobarComponent in the file app/models/course/settings/foobar_component.rb.


92
93
94
# File 'app/controllers/components/course/controller_component_host.rb', line 92

def settings_class
  @settings_class ||= "Course::Settings::#{name.demodulize}".safe_constantize
end