Module: Course::ObjectDuplicationsHelper

Defined in:
app/helpers/course/object_duplications_helper.rb

Instance Method Summary collapse

Instance Method Details

#cherrypickable_components_hashObject

Map of keys of components with cherry-pickable items to tokens for those components in the frontend.


4
5
6
7
8
9
10
11
12
# File 'app/helpers/course/object_duplications_helper.rb', line 4

def cherrypickable_components_hash
  @cherrypickable_components_hash ||= {
    course_assessments_component: 'ASSESSMENTS',
    course_survey_component: 'SURVEYS',
    course_achievements_component: 'ACHIEVEMENTS',
    course_materials_component: 'MATERIALS',
    course_videos_component: 'VIDEOS'
  }.freeze
end

#cherrypickable_items_hashObject

Map of ruby classes to tokens used by the frontend for cherry-pickable items.


15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/helpers/course/object_duplications_helper.rb', line 15

def cherrypickable_items_hash
  @cherrypickable_items_hash ||= {
    Course::Assessment::Category => 'CATEGORY',
    Course::Assessment::Tab => 'TAB',
    Course::Assessment => 'ASSESSMENT',
    Course::Survey => 'SURVEY',
    Course::Achievement => 'ACHIEVEMENT',
    Course::Material::Folder => 'FOLDER',
    Course::Material => 'MATERIAL',
    Course::Video => 'VIDEO',
    Course::Video::Tab => 'VIDEO_TAB'
  }.freeze
end

#map_components_to_frontend_tokens(components) ⇒ Array<String>


31
32
33
# File 'app/helpers/course/object_duplications_helper.rb', line 31

def map_components_to_frontend_tokens(components)
  components.map(&:key).map { |key| cherrypickable_components_hash[key] }.compact
end