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

Returns true if component can be disabled (or enabled) for individual courses. Otherwise, the component can only perhaps be disabled instance-wide.

Returns:

  • (Boolean)

    true if component can be disabled (or enabled) for individual courses. Otherwise, the component can only perhaps be disabled instance-wide.


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.

Returns:

  • (String)

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

def display_name
  name
end

#enabled_by_default?Boolean

Returns the default enabled status of the component.

Returns:

  • (Boolean)

    the default enabled status of the component


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

def enabled_by_default?
  true
end

#gamified?Boolean

Returns The gamfied status of the component. If true, the component will be disabled when the gamified flag in the course is false. Value is false by default.

Returns:

  • (Boolean)

    The gamfied status of the component. If true, the component will be disabled when the gamified flag in the course is false. Value is false by default.


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.

Returns:

  • (Symbol)

    the key


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.

Returns:

  • (Array<String>)

    actable types as an array of strings


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.

Returns:

  • (Class)

    The settings interface class

  • (nil)

    if the class does not exist


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