diff --git a/app/controllers/components/course/achievements_component.rb b/app/controllers/components/course/achievements_component.rb index d3324cb9de9..9bf3f8d4e17 100644 --- a/app/controllers/components/course/achievements_component.rb +++ b/app/controllers/components/course/achievements_component.rb @@ -2,10 +2,6 @@ class Course::AchievementsComponent < SimpleDelegator include Course::ControllerComponentHost::Component - def self.display_name - I18n.t('components.achievements.name') - end - def self.gamified? true end @@ -15,7 +11,6 @@ def sidebar_items { key: :achievements, icon: :achievement, - title: I18n.t('course.achievement.achievements.sidebar_title'), weight: 4, path: course_achievements_path(current_course) } diff --git a/app/controllers/components/course/announcements_component.rb b/app/controllers/components/course/announcements_component.rb index f60c22a9af8..a53e5d80d85 100644 --- a/app/controllers/components/course/announcements_component.rb +++ b/app/controllers/components/course/announcements_component.rb @@ -3,10 +3,6 @@ class Course::AnnouncementsComponent < SimpleDelegator include Course::ControllerComponentHost::Component include Course::UnreadCountsConcern - def self.display_name - I18n.t('components.announcements.name') - end - def sidebar_items main_sidebar_items + settings_sidebar_items end @@ -18,7 +14,7 @@ def main_sidebar_items { key: :announcements, icon: :announcement, - title: settings.title || t('course.announcements.sidebar_title'), + title: settings.title, weight: 1, path: course_announcements_path(current_course), unread: unread_announcements_count @@ -29,7 +25,8 @@ def main_sidebar_items def settings_sidebar_items [ { - title: settings.title || t('layouts.course_admin.announcement_settings.title'), + key: self.class.key, + title: settings.title, type: :settings, weight: 4, path: course_admin_announcements_path(current_course) diff --git a/app/controllers/components/course/assessments_component.rb b/app/controllers/components/course/assessments_component.rb index 2b48e765682..29f0cdee937 100644 --- a/app/controllers/components/course/assessments_component.rb +++ b/app/controllers/components/course/assessments_component.rb @@ -3,10 +3,6 @@ class Course::AssessmentsComponent < SimpleDelegator include Course::ControllerComponentHost::Component include Course::UnreadCountsConcern - def self.display_name - I18n.t('components.assessments.name') - end - def self.lesson_plan_item_actable_names [Course::Assessment.name] end @@ -38,7 +34,6 @@ def assessment_submissions { key: :assessments_submissions, icon: :submission, - title: t('course.assessment.submissions.sidebar_title'), weight: 3, path: course_submissions_path(current_course), unread: pending_assessment_submissions_count @@ -51,9 +46,8 @@ def admin_sidebar_items [ { - key: :assessments_skills, + key: :sidebar_assessments_skills, icon: :skills, - title: t('course.assessment.skills.sidebar_title'), type: :admin, weight: 8, path: course_assessments_skills_path(current_course) @@ -64,7 +58,7 @@ def admin_sidebar_items def admin_settings_items [ { - title: t('course.assessment.assessments.sidebar_title'), + key: self.class.key, type: :settings, weight: 5, path: course_admin_assessments_path(current_course) diff --git a/app/controllers/components/course/codaveri_component.rb b/app/controllers/components/course/codaveri_component.rb index dca973a0943..ec33b11e0af 100644 --- a/app/controllers/components/course/codaveri_component.rb +++ b/app/controllers/components/course/codaveri_component.rb @@ -2,10 +2,6 @@ class Course::CodaveriComponent < SimpleDelegator include Course::ControllerComponentHost::Component - def self.display_name - I18n.t('components.codaveri.name') - end - def sidebar_items settings_sidebar_items end @@ -15,7 +11,7 @@ def sidebar_items def settings_sidebar_items [ { - title: t('layouts.course_admin.codaveri.title'), + key: self.class.key, type: :settings, weight: 6, path: course_admin_codaveri_path(current_course) diff --git a/app/controllers/components/course/discussion/topics_component.rb b/app/controllers/components/course/discussion/topics_component.rb index 56573daf04f..af6136acd68 100644 --- a/app/controllers/components/course/discussion/topics_component.rb +++ b/app/controllers/components/course/discussion/topics_component.rb @@ -3,10 +3,6 @@ class Course::Discussion::TopicsComponent < SimpleDelegator include Course::ControllerComponentHost::Component include Course::UnreadCountsConcern - def self.display_name - I18n.t('components.discussion.topics.name') - end - def sidebar_items main_sidebar_items + settings_sidebar_items end @@ -18,7 +14,7 @@ def main_sidebar_items { key: :discussion_topics, icon: :comments, - title: settings.title || t('course.discussion.topics.sidebar_title'), + title: settings.title, weight: 5, path: course_topics_path(current_course), unread: unread_comments_count @@ -29,7 +25,8 @@ def main_sidebar_items def settings_sidebar_items [ { - title: settings.title || t('course.discussion.topics.sidebar_title'), + key: :sidebar_discussion_topics, + title: settings.title, type: :settings, weight: 7, path: course_admin_topics_path(current_course) diff --git a/app/controllers/components/course/duplication_component.rb b/app/controllers/components/course/duplication_component.rb index c9d1c7b3c81..77edfe8aad1 100644 --- a/app/controllers/components/course/duplication_component.rb +++ b/app/controllers/components/course/duplication_component.rb @@ -2,18 +2,13 @@ class Course::DuplicationComponent < SimpleDelegator include Course::ControllerComponentHost::Component - def self.display_name - I18n.t('components.duplication.name') - end - def sidebar_items return [] unless can?(:duplicate_from, current_course) [ { - key: :duplication, + key: :admin_duplication, icon: :duplication, - title: t('layouts.duplication.title'), type: :admin, weight: 5, path: course_duplication_path(current_course) diff --git a/app/controllers/components/course/experience_points_component.rb b/app/controllers/components/course/experience_points_component.rb index bcadf81126c..50db16a8b14 100644 --- a/app/controllers/components/course/experience_points_component.rb +++ b/app/controllers/components/course/experience_points_component.rb @@ -6,18 +6,13 @@ def self.gamified? true end - def self.display_name - I18n.t('components.experience_points.name') - end - def sidebar_items return [] unless can_create_experience_points_record? [ { - key: :experience_points, + key: :sidebar_experience_points, icon: :experience, - title: t('course.experience_points.disbursement.sidebar_title'), type: :admin, weight: 4, path: course_experience_points_records_path(current_course) diff --git a/app/controllers/components/course/forums_component.rb b/app/controllers/components/course/forums_component.rb index 9aee44a2c93..df1d2d8156b 100644 --- a/app/controllers/components/course/forums_component.rb +++ b/app/controllers/components/course/forums_component.rb @@ -3,10 +3,6 @@ class Course::ForumsComponent < SimpleDelegator include Course::ControllerComponentHost::Component include Course::UnreadCountsConcern - def self.display_name - I18n.t('components.forums.name') - end - def sidebar_items main_sidebar_items + settings_sidebar_items end @@ -18,7 +14,7 @@ def main_sidebar_items { key: :forums, icon: :forum, - title: settings.title || t('course.forum.forums.sidebar_title'), + title: settings.title, weight: 10, path: course_forums_path(current_course), unread: unread_forum_topics_count @@ -29,7 +25,8 @@ def main_sidebar_items def settings_sidebar_items [ { - title: settings.title || t('course.forum.forums.sidebar_title'), + key: self.class.key, + title: settings.title, type: :settings, weight: 11, path: course_admin_forums_path(current_course) diff --git a/app/controllers/components/course/groups_component.rb b/app/controllers/components/course/groups_component.rb index ec5c42b0360..0e9b9026152 100644 --- a/app/controllers/components/course/groups_component.rb +++ b/app/controllers/components/course/groups_component.rb @@ -3,18 +3,13 @@ class Course::GroupsComponent < SimpleDelegator include Course::ControllerComponentHost::Component include Course::Group::GroupManagerConcern - def self.display_name - I18n.t('components.groups.name') - end - def sidebar_items return [] unless show_group_sidebar_item? [ { - key: :groups, + key: self.class.key, icon: :groups, - title: I18n.t('course.groups.sidebar_title'), type: :admin, weight: 7, path: group_category_url diff --git a/app/controllers/components/course/koditsu_platform_component.rb b/app/controllers/components/course/koditsu_platform_component.rb index 23d73a08a4c..898d9cf858a 100644 --- a/app/controllers/components/course/koditsu_platform_component.rb +++ b/app/controllers/components/course/koditsu_platform_component.rb @@ -2,10 +2,6 @@ class Course::KoditsuPlatformComponent < SimpleDelegator include Course::ControllerComponentHost::Component - def self.display_name - I18n.t('components.koditsu_platform.name') - end - def self.enabled_by_default? false end diff --git a/app/controllers/components/course/leaderboard_component.rb b/app/controllers/components/course/leaderboard_component.rb index ba618f1ee06..6bcdc89d054 100644 --- a/app/controllers/components/course/leaderboard_component.rb +++ b/app/controllers/components/course/leaderboard_component.rb @@ -2,10 +2,6 @@ class Course::LeaderboardComponent < SimpleDelegator include Course::ControllerComponentHost::Component - def self.display_name - I18n.t('components.leaderboard.name') - end - def self.gamified? true end @@ -21,7 +17,7 @@ def main_sidebar_items { key: :leaderboard, icon: :leaderboard, - title: settings.title || t('course.leaderboards.sidebar_title'), + title: settings.title, weight: 6, path: course_leaderboard_path(current_course) } @@ -31,7 +27,8 @@ def main_sidebar_items def settings_sidebar_items [ { - title: settings.title || t('course.leaderboards.title'), + key: self.class.key, + title: settings.title, type: :settings, weight: 8, path: course_admin_leaderboard_path(current_course) diff --git a/app/controllers/components/course/learning_map_component.rb b/app/controllers/components/course/learning_map_component.rb index d22e7661645..0764f564142 100644 --- a/app/controllers/components/course/learning_map_component.rb +++ b/app/controllers/components/course/learning_map_component.rb @@ -6,16 +6,11 @@ def self.enabled_by_default? false end - def self.display_name - I18n.t('components.learning_map.name') - end - def sidebar_items [ { key: :learning_map, icon: :map, - title: t('layouts.learning_map.title'), weight: 5, path: course_learning_map_path(current_course) } diff --git a/app/controllers/components/course/lesson_plan_component.rb b/app/controllers/components/course/lesson_plan_component.rb index 043e44e5979..089c9088002 100644 --- a/app/controllers/components/course/lesson_plan_component.rb +++ b/app/controllers/components/course/lesson_plan_component.rb @@ -2,10 +2,6 @@ class Course::LessonPlanComponent < SimpleDelegator include Course::ControllerComponentHost::Component - def self.display_name - I18n.t('components.lesson_plan.name') - end - def self.lesson_plan_item_actable_names [Course::LessonPlan::Event.name] end @@ -21,7 +17,6 @@ def main_sidebar_items { key: :lesson_plan, icon: :lessonPlan, - title: I18n.t('course.lesson_plan.items.sidebar_title'), weight: 8, path: course_lesson_plan_path(current_course) } @@ -31,7 +26,7 @@ def main_sidebar_items def settings_sidebar_items [ { - title: t('layouts.course_admin.lesson_plan.title'), + key: self.class.key, type: :settings, weight: 9, path: course_admin_lesson_plan_path(current_course) diff --git a/app/controllers/components/course/levels_component.rb b/app/controllers/components/course/levels_component.rb index d2d75d04100..b964b9d1834 100644 --- a/app/controllers/components/course/levels_component.rb +++ b/app/controllers/components/course/levels_component.rb @@ -2,10 +2,6 @@ class Course::LevelsComponent < SimpleDelegator include Course::ControllerComponentHost::Component - def self.display_name - I18n.t('components.levels.name') - end - def self.gamified? true end @@ -15,9 +11,8 @@ def sidebar_items [ { - key: :levels, + key: self.class.key, icon: :levels, - title: I18n.t('course.levels.sidebar_title'), type: :admin, weight: 6, path: course_levels_path(current_course) diff --git a/app/controllers/components/course/materials_component.rb b/app/controllers/components/course/materials_component.rb index 10e0f2722e9..75e14c188ca 100644 --- a/app/controllers/components/course/materials_component.rb +++ b/app/controllers/components/course/materials_component.rb @@ -2,10 +2,6 @@ class Course::MaterialsComponent < SimpleDelegator include Course::ControllerComponentHost::Component - def self.display_name - I18n.t('components.materials.name') - end - def sidebar_items main_sidebar_items + settings_sidebar_items end @@ -17,7 +13,7 @@ def main_sidebar_items { key: :materials, icon: :material, - title: settings.title || t('course.material.sidebar_title'), + title: settings.title, weight: 9, path: course_material_folders_path(current_course) } @@ -27,7 +23,8 @@ def main_sidebar_items def settings_sidebar_items [ { - title: settings.title || t('course.material.sidebar_title'), + key: self.class.key, + title: settings.title, type: :settings, weight: 10, path: course_admin_materials_path(current_course) diff --git a/app/controllers/components/course/monitoring_component.rb b/app/controllers/components/course/monitoring_component.rb index bfc03f6c97e..769f010762a 100644 --- a/app/controllers/components/course/monitoring_component.rb +++ b/app/controllers/components/course/monitoring_component.rb @@ -2,10 +2,6 @@ class Course::MonitoringComponent < SimpleDelegator include Course::ControllerComponentHost::Component - def self.display_name - I18n.t('components.monitoring.name') - end - def self.enabled_by_default? false end diff --git a/app/controllers/components/course/multiple_reference_timelines_component.rb b/app/controllers/components/course/multiple_reference_timelines_component.rb index bb5514ec2f9..f19a7e54e51 100644 --- a/app/controllers/components/course/multiple_reference_timelines_component.rb +++ b/app/controllers/components/course/multiple_reference_timelines_component.rb @@ -2,10 +2,6 @@ class Course::MultipleReferenceTimelinesComponent < SimpleDelegator include Course::ControllerComponentHost::Component - def self.display_name - I18n.t('components.multiple_reference_timelines.name') - end - def self.enabled_by_default? false end @@ -15,11 +11,10 @@ def sidebar_items [ { - key: :reference_timelines, + key: :admin_multiple_reference_timelines, icon: :timelines, type: :admin, weight: 9, - title: t('layouts.multiple_reference_timelines.timeline_designer'), path: course_reference_timelines_path(current_course) } ] diff --git a/app/controllers/components/course/plagiarism_component.rb b/app/controllers/components/course/plagiarism_component.rb index 0f9d8fab8c8..57a98f64fdc 100644 --- a/app/controllers/components/course/plagiarism_component.rb +++ b/app/controllers/components/course/plagiarism_component.rb @@ -2,10 +2,6 @@ class Course::PlagiarismComponent < SimpleDelegator include Course::ControllerComponentHost::Component - def self.display_name - I18n.t('components.plagiarism.name') - end - def self.enabled_by_default? false end @@ -15,9 +11,8 @@ def sidebar_items [ { - key: :plagiarism, + key: :admin_plagiarism, icon: :plagiarism, - title: t('course.plagiarism.header'), type: :admin, weight: 3, path: course_plagiarism_assessments_path(current_course) diff --git a/app/controllers/components/course/rag_wise_component.rb b/app/controllers/components/course/rag_wise_component.rb index caaf96c9d53..2457ff968ea 100644 --- a/app/controllers/components/course/rag_wise_component.rb +++ b/app/controllers/components/course/rag_wise_component.rb @@ -2,10 +2,6 @@ class Course::RagWiseComponent < SimpleDelegator include Course::ControllerComponentHost::Component - def self.display_name - I18n.t('components.rag_wise.name') - end - def self.enabled_by_default? false end @@ -19,7 +15,7 @@ def sidebar_items def settings_sidebar_items [ { - title: t('layouts.course_admin.rag_wise.title'), + key: self.class.key, type: :settings, weight: 6, path: course_admin_rag_wise_path(current_course) diff --git a/app/controllers/components/course/scholaistic_component.rb b/app/controllers/components/course/scholaistic_component.rb index e1fec99e0b1..5a6ac861495 100644 --- a/app/controllers/components/course/scholaistic_component.rb +++ b/app/controllers/components/course/scholaistic_component.rb @@ -3,10 +3,6 @@ class Course::ScholaisticComponent < SimpleDelegator include Course::ControllerComponentHost::Component include Course::Scholaistic::Concern - def self.display_name - I18n.t('components.scholaistic.name') - end - def self.enabled_by_default? false end @@ -28,7 +24,7 @@ def student_sidebar_items { key: :scholaistic_assessments, icon: :chatbot, - title: settings.assessments_title || I18n.t('course.scholaistic.assessments'), + title: settings.assessments_title, weight: 4, path: course_scholaistic_assessments_path(current_course) } @@ -57,10 +53,9 @@ def admin_sidebar_items [ { - key: :scholaistic_assistants, + key: :admin_scholaistic_assistants, type: :admin, icon: :chatbot, - title: I18n.t('components.scholaistic.manage_assistants'), weight: 9, path: course_scholaistic_assistants_path(current_course), exact: true @@ -72,7 +67,7 @@ def settings_sidebar_items [ { type: :settings, - title: I18n.t('components.scholaistic.name'), + key: self.class.key, weight: 5, path: course_admin_scholaistic_path(current_course) } diff --git a/app/controllers/components/course/settings_component.rb b/app/controllers/components/course/settings_component.rb index 49caf3c994d..1688e0259f7 100644 --- a/app/controllers/components/course/settings_component.rb +++ b/app/controllers/components/course/settings_component.rb @@ -7,10 +7,6 @@ def self.can_be_disabled_for_course? false end - def self.display_name - I18n.t('components.settings.name') - end - def sidebar_items admin_sidebar_items + settings_sidebar_items end @@ -22,9 +18,8 @@ def admin_sidebar_items [ { - key: :admin, + key: :admin_settings, icon: :settings, - title: t('layouts.course_admin.title'), type: :admin, weight: 100, path: course_admin_path(current_course) @@ -43,7 +38,7 @@ def settings_sidebar_items def settings_index_item { - title: t('layouts.course_admin.course_settings.title'), + key: :admin_settings_general, type: :settings, weight: 1, path: course_admin_path(current_course) @@ -52,7 +47,7 @@ def settings_index_item def settings_components_item { - title: t('layouts.course_admin.component_settings.title'), + key: :admin_settings_component_settings, type: :settings, weight: 2, path: course_admin_components_path(current_course) @@ -61,7 +56,7 @@ def settings_components_item def settings_sidebar_item { - title: t('layouts.course_admin.sidebar_settings.title'), + key: :admin_settings_sidebar_settings, type: :settings, weight: 3, path: course_admin_sidebar_path(current_course) @@ -70,7 +65,7 @@ def settings_sidebar_item def settings_notifications { - title: t('layouts.course_admin.notifications.title'), + key: :admin_settings_notifications, type: :settings, weight: 12, path: course_admin_notifications_path(current_course) diff --git a/app/controllers/components/course/statistics_component.rb b/app/controllers/components/course/statistics_component.rb index 874b3e310cf..80f0ae78897 100644 --- a/app/controllers/components/course/statistics_component.rb +++ b/app/controllers/components/course/statistics_component.rb @@ -2,18 +2,13 @@ class Course::StatisticsComponent < SimpleDelegator include Course::ControllerComponentHost::Component - def self.display_name - I18n.t('components.statistics.name') - end - def sidebar_items return [] unless can?(:read_statistics, current_course) [ { - key: :statistics, + key: self.class.key, icon: :statistics, - title: t('course.statistics.header'), type: :admin, weight: 3, path: course_statistics_students_path(current_course) diff --git a/app/controllers/components/course/stories_component.rb b/app/controllers/components/course/stories_component.rb index d231b4ac9db..e46044ad91c 100644 --- a/app/controllers/components/course/stories_component.rb +++ b/app/controllers/components/course/stories_component.rb @@ -2,10 +2,6 @@ class Course::StoriesComponent < SimpleDelegator include Course::ControllerComponentHost::Component - def self.display_name - I18n.t('components.stories.name') - end - def self.enabled_by_default? false end @@ -30,7 +26,7 @@ def student_sidebar_items { key: :learn, icon: :learn, - title: settings.title || I18n.t('course.stories.learn'), + title: settings.title, weight: 0, path: course_learn_path(current_course) } @@ -42,10 +38,9 @@ def staff_sidebar_items [ { - key: :mission_control, + key: :sidebar_stories_mission_control, icon: :mission_control, type: :admin, - title: I18n.t('course.stories.mission_control'), weight: 1, path: course_mission_control_path(current_course) } @@ -55,7 +50,7 @@ def staff_sidebar_items def settings_sidebar_items [ { - title: I18n.t('components.stories.name'), + key: self.class.key, type: :settings, weight: 5, path: course_admin_stories_path(current_course) diff --git a/app/controllers/components/course/survey_component.rb b/app/controllers/components/course/survey_component.rb index 1adcf2e71c0..04da2214595 100644 --- a/app/controllers/components/course/survey_component.rb +++ b/app/controllers/components/course/survey_component.rb @@ -2,10 +2,6 @@ class Course::SurveyComponent < SimpleDelegator include Course::ControllerComponentHost::Component - def self.display_name - I18n.t('components.surveys.name') - end - def self.lesson_plan_item_actable_names [Course::Survey.name] end @@ -15,7 +11,6 @@ def sidebar_items { key: :surveys, icon: :survey, - title: I18n.t('course.surveys.sidebar_title'), weight: 11, path: course_surveys_path(current_course) } diff --git a/app/controllers/components/course/users_component.rb b/app/controllers/components/course/users_component.rb index f0fc90addee..d619dee2966 100644 --- a/app/controllers/components/course/users_component.rb +++ b/app/controllers/components/course/users_component.rb @@ -7,9 +7,6 @@ def self.can_be_disabled_for_course? false end - def self.display_name - I18n.t('components.users.name') - end def sidebar_items main_sidebar_items + admin_sidebar_items @@ -22,7 +19,6 @@ def main_sidebar_items { key: :users, icon: :users, - title: t('course.users.sidebar_title'), weight: 7, path: course_users_path(current_course) } @@ -40,9 +36,8 @@ def admin_sidebar_items [ { - key: :manage_users, + key: :admin_users_manage_users, icon: :manageUsers, - title: t('layouts.course_users.title'), type: :admin, weight: 2, path: diff --git a/app/controllers/components/course/videos_component.rb b/app/controllers/components/course/videos_component.rb index f56675ed13b..3edd5477cfb 100644 --- a/app/controllers/components/course/videos_component.rb +++ b/app/controllers/components/course/videos_component.rb @@ -3,10 +3,6 @@ class Course::VideosComponent < SimpleDelegator include Course::ControllerComponentHost::Component include Course::UnreadCountsConcern - def self.display_name - I18n.t('components.video.name') - end - def self.lesson_plan_item_actable_names [Course::Video.name] end @@ -22,7 +18,7 @@ def main_sidebar_items { key: :videos, icon: :video, - title: settings.title || t('course.video.videos.sidebar_title'), + title: settings.title, weight: 12, path: course_videos_path(current_course, tab: current_course.default_video_tab), unread: unwatched_videos_count @@ -33,7 +29,8 @@ def main_sidebar_items def settings_sidebar_items [ { - title: settings.title || t('course.video.videos.sidebar_title'), + key: self.class.key, + title: settings.title, type: :settings, weight: 13, path: course_admin_videos_path(current_course) diff --git a/app/controllers/course/controller.rb b/app/controllers/course/controller.rb index a6f7eebe4d3..670d0e81f86 100644 --- a/app/controllers/course/controller.rb +++ b/app/controllers/course/controller.rb @@ -14,8 +14,8 @@ def sidebar_items(type: nil) items = sidebar_items_of_type(type) items.sort do |a, b| - weight_a = weights_hash[a[:key]] || a[:weight] - weight_b = weights_hash[b[:key]] || b[:weight] + weight_a = weights_hash[a[:type]][a[:key]] || a[:weight] + weight_b = weights_hash[b[:type]][b[:key]] || b[:weight] (weight_a <=> weight_b).nonzero? || a[:key].to_s <=> b[:key].to_s end end @@ -66,14 +66,20 @@ def sidebar_items_of_type(type) type ? sidebar_items.select { |item| item.fetch(:type, :normal) == type } : sidebar_items end - # Computes a hash containing the key of each sidebar item, and its defined weight as the value. + # Computes a hash to store the weights of sidebar items, including manually overridden weights. # - # @return [Hash{Symbol=>Integer}] - def sidebar_items_weights + # @return [Hash{Symbol=>Hash{Symbol=>Integer}}] A nested hash mapping item types and item keys to + # the associated sidebar item's weight. + + def sidebar_items_weights(type: nil) sidebar_settings = Course::Settings::Sidebar.new(current_course.settings, current_component_host.sidebar_items) - defined_sidebar_settings = sidebar_settings.sidebar_items.select { |item| item.id.present? } - defined_sidebar_settings.to_h { |item| [item.id, item.weight] } + defined_sidebar_settings = sidebar_settings.sidebar_items.select do |item| + item.id.present? && (type.nil? || item.type == type) + end + defined_sidebar_settings.group_by(&:type).transform_values do |items| + items.to_h { |item| [item.id, item.weight] } + end end def set_last_active_at diff --git a/app/controllers/course/lesson_plan/items_controller.rb b/app/controllers/course/lesson_plan/items_controller.rb index 95904a0c5d5..4a5e60b574e 100644 --- a/app/controllers/course/lesson_plan/items_controller.rb +++ b/app/controllers/course/lesson_plan/items_controller.rb @@ -74,7 +74,7 @@ def assessment_tabs_visibility_hash # @return [Hash{Array => Boolean}] def component_visibility_hash @component_visibility_hash = component_item_settings.to_h do |setting| - [[setting[:component_title]], setting[:visible]] + [[setting[:component]], setting[:visible]] end end diff --git a/app/controllers/course/material/controller.rb b/app/controllers/course/material/controller.rb index 638d4aad7c1..41cfbd5fea7 100644 --- a/app/controllers/course/material/controller.rb +++ b/app/controllers/course/material/controller.rb @@ -46,6 +46,6 @@ def component helper_method :component def root_folder_name - component.settings.title || t('course.material.sidebar_title') + component.settings.title || current_course.title end end diff --git a/app/models/concerns/component_settings_concern.rb b/app/models/concerns/component_settings_concern.rb index a37d22211ba..04c00759687 100644 --- a/app/models/concerns/component_settings_concern.rb +++ b/app/models/concerns/component_settings_concern.rb @@ -4,7 +4,7 @@ module ComponentSettingsConcern # This is used when generating checkboxes for each of the components def disableable_component_collection - @settable.disableable_components.map { |c| [c.display_name, c.key.to_s] }.sort + @settable.disableable_components.map { |c| c.key.to_s } end # Returns the ids of enabled components that can be disabled diff --git a/app/models/course/settings/sidebar_item.rb b/app/models/course/settings/sidebar_item.rb index 9826d092016..687d04254ba 100644 --- a/app/models/course/settings/sidebar_item.rb +++ b/app/models/course/settings/sidebar_item.rb @@ -22,6 +22,11 @@ def title @sidebar_item[:title] end + # @return [Symbol | nil] The type of the item. + def type + @sidebar_item[:type] + end + # @return [Integer] The weight of the item. def weight result = @settings.settings(id).weight if id diff --git a/app/models/course/settings/survey_component.rb b/app/models/course/settings/survey_component.rb index e24fbbf5b5d..8eacc7a69a6 100644 --- a/app/models/course/settings/survey_component.rb +++ b/app/models/course/settings/survey_component.rb @@ -3,7 +3,7 @@ class Course::Settings::SurveyComponent < Course::Settings::Component include Course::Settings::LessonPlanSettingsConcern def lesson_plan_item_settings - super.merge(component_title: I18n.t('components.surveys.name')) + super end def showable_in_lesson_plan? diff --git a/app/models/course/settings/videos_component.rb b/app/models/course/settings/videos_component.rb index 633688da464..e73799dcfc4 100644 --- a/app/models/course/settings/videos_component.rb +++ b/app/models/course/settings/videos_component.rb @@ -8,7 +8,7 @@ def self.component_class end def lesson_plan_item_settings - super.merge(component_title: I18n.t('course.video.videos.index.header')) + super.merge(component_title: title) end def showable_in_lesson_plan? diff --git a/app/views/course/admin/component_settings/edit.json.jbuilder b/app/views/course/admin/component_settings/edit.json.jbuilder index 1bd583cad0e..0fc3b15905c 100644 --- a/app/views/course/admin/component_settings/edit.json.jbuilder +++ b/app/views/course/admin/component_settings/edit.json.jbuilder @@ -2,9 +2,7 @@ components = @settings.disableable_component_collection enabled_components = @settings.enabled_component_ids.to_set -json.array! components do |component| - id = component[1] +json.array! components do |id| json.id id - json.displayName component[0] json.enabled enabled_components.include?(id) end diff --git a/app/views/course/admin/sidebar_settings/show.json.jbuilder b/app/views/course/admin/sidebar_settings/show.json.jbuilder index b135268d61c..e676a72fa47 100644 --- a/app/views/course/admin/sidebar_settings/show.json.jbuilder +++ b/app/views/course/admin/sidebar_settings/show.json.jbuilder @@ -1,6 +1,7 @@ # frozen_string_literal: true json.array! controller.sidebar_items(type: :settings) do |option| json.title option[:title] + json.id option[:key] json.weight option[:weight] json.path option[:path] end diff --git a/app/views/course/material/folders/breadcrumbs.json.jbuilder b/app/views/course/material/folders/breadcrumbs.json.jbuilder index 93b5aec1254..70514c00415 100644 --- a/app/views/course/material/folders/breadcrumbs.json.jbuilder +++ b/app/views/course/material/folders/breadcrumbs.json.jbuilder @@ -2,5 +2,5 @@ json.breadcrumbs @folder.ancestors.reverse << @folder do |folder| json.id folder.id - json.name folder.parent_id.nil? ? @settings.title || t('course.material.sidebar_title') : folder.name + json.name folder.parent_id.nil? ? @settings.title : folder.name end diff --git a/app/views/course/reference_timelines/_reference_timeline.json.jbuilder b/app/views/course/reference_timelines/_reference_timeline.json.jbuilder index c7d64c36233..fe11336c55d 100644 --- a/app/views/course/reference_timelines/_reference_timeline.json.jbuilder +++ b/app/views/course/reference_timelines/_reference_timeline.json.jbuilder @@ -1,6 +1,6 @@ # frozen_string_literal: true json.id timeline.id -json.title timeline.title || t('.default_title') +json.title timeline.title json.timesCount timeline.reference_times.size json.weight timeline.weight if timeline.weight.present? diff --git a/app/views/course/surveys/_survey_lesson_plan_item.json.jbuilder b/app/views/course/surveys/_survey_lesson_plan_item.json.jbuilder index 75e00d09b95..a5bb0bdffbc 100644 --- a/app/views/course/surveys/_survey_lesson_plan_item.json.jbuilder +++ b/app/views/course/surveys/_survey_lesson_plan_item.json.jbuilder @@ -1,4 +1,4 @@ # frozen_string_literal: true json.partial! 'course/lesson_plan/items/item', item: item -json.lesson_plan_item_type [t('components.surveys.name')] +json.lesson_plan_item_type :course_surveys_component json.item_path course_survey_path(current_course, item) diff --git a/app/views/course/video/videos/_video_lesson_plan_item.json.jbuilder b/app/views/course/video/videos/_video_lesson_plan_item.json.jbuilder index 0753e17aeb1..118fb3d906d 100644 --- a/app/views/course/video/videos/_video_lesson_plan_item.json.jbuilder +++ b/app/views/course/video/videos/_video_lesson_plan_item.json.jbuilder @@ -3,5 +3,5 @@ json.partial! 'course/lesson_plan/items/item', item: item json.item_path course_video_path(current_course, item) json.description format_ckeditor_rich_text(item.description) -type = current_component_host[:course_videos_component]&.settings&.title || t('components.video.name') +type = current_component_host[:course_videos_component]&.settings&.title || :course_videos_component json.lesson_plan_item_type [type] diff --git a/app/views/system/admin/instance/components/index.json.jbuilder b/app/views/system/admin/instance/components/index.json.jbuilder index 1facefe6169..cbf50cfa22f 100644 --- a/app/views/system/admin/instance/components/index.json.jbuilder +++ b/app/views/system/admin/instance/components/index.json.jbuilder @@ -4,8 +4,7 @@ enabled_components = @settings.enabled_component_ids.to_set json.components do json.array! components do |component| - json.key component[1] - json.displayName component[0] - json.enabled enabled_components.include?(component[1]) + json.key component + json.enabled enabled_components.include?(component) end end diff --git a/client/app/bundles/course/admin/components/SettingsNavigation.tsx b/client/app/bundles/course/admin/components/SettingsNavigation.tsx index d9af55245f6..0db2582ed90 100644 --- a/client/app/bundles/course/admin/components/SettingsNavigation.tsx +++ b/client/app/bundles/course/admin/components/SettingsNavigation.tsx @@ -14,6 +14,12 @@ import CourseAPI from 'api/course'; import Page from 'lib/components/core/layouts/Page'; import LoadingIndicator from 'lib/components/core/LoadingIndicator'; import { DataHandle } from 'lib/hooks/router/dynamicNest'; +import useTranslation from 'lib/hooks/useTranslation'; + +import { + getComponentTitle, + getComponentTranslationKey, +} from '../../translations'; const translations = defineMessages({ courseSettings: { @@ -34,6 +40,7 @@ export const useItemsReloader = (): (() => void) => const SettingsNavigation = (): JSX.Element => { const data = useLoaderData() as CourseAdminItems; + const { t } = useTranslation(); const [items, setItems] = useState(data); @@ -51,14 +58,14 @@ const SettingsNavigation = (): JSX.Element => {
- {items.map(({ title, path }) => ( + {items.map((item) => ( navigate(path)} - variant={path === pathname ? 'filled' : 'outlined'} + key={item.path} + className={`m-2 ${item.path === pathname && 'p-[1px]'}`} + clickable={item.path !== pathname} + label={getComponentTitle(t, item.id, item.title)} + onClick={(): void => navigate(item.path)} + variant={item.path === pathname ? 'filled' : 'outlined'} /> ))}
@@ -84,7 +91,8 @@ const handle: DataHandle = (match, location) => { title: translations.courseSettings, }, { - title: currentItem?.title, + title: + currentItem?.title ?? getComponentTranslationKey(currentItem?.id), url: currentItem?.path, }, ], diff --git a/client/app/bundles/course/admin/pages/ComponentSettings/ComponentSettingsForm.tsx b/client/app/bundles/course/admin/pages/ComponentSettings/ComponentSettingsForm.tsx index 23435782fb7..075d6126a51 100644 --- a/client/app/bundles/course/admin/pages/ComponentSettings/ComponentSettingsForm.tsx +++ b/client/app/bundles/course/admin/pages/ComponentSettings/ComponentSettingsForm.tsx @@ -3,6 +3,7 @@ import { FormControlLabel, Switch } from '@mui/material'; import { produce } from 'immer'; import { CourseComponents } from 'types/course/admin/components'; +import { getComponentTitle } from 'course/translations'; import Section from 'lib/components/core/layouts/Section'; import useTranslation from 'lib/hooks/useTranslation'; @@ -47,7 +48,8 @@ const ComponentSettingsForm = ( className="mb-0" control={} disabled={props.disabled} - label={component.displayName} + id={`component_${component.id}`} + label={getComponentTitle(t, component.id)} onChange={(_, checked): void => toggleComponent(index, checked)} /> ))} diff --git a/client/app/bundles/course/admin/pages/LessonPlanSettings/index.jsx b/client/app/bundles/course/admin/pages/LessonPlanSettings/index.jsx index 365ba663448..451a3b2271b 100644 --- a/client/app/bundles/course/admin/pages/LessonPlanSettings/index.jsx +++ b/client/app/bundles/course/admin/pages/LessonPlanSettings/index.jsx @@ -14,6 +14,7 @@ import { } from '@mui/material'; import PropTypes from 'prop-types'; +import { getComponentTranslationKey } from 'course/translations'; import Section from 'lib/components/core/layouts/Section'; import Subsection from 'lib/components/core/layouts/Subsection'; import LoadingIndicator from 'lib/components/core/LoadingIndicator'; @@ -56,7 +57,11 @@ class LessonPlanSettings extends Component { options, }, }; - const values = { setting: tab_title || component_title }; + const values = { + setting: tab_title || component_title || ( + + ), + }; const successMessage = ( ); @@ -84,7 +89,11 @@ class LessonPlanSettings extends Component { options, }, }; - const values = { setting: tab_title || component_title }; + const values = { + setting: tab_title || component_title || ( + + ), + }; const successMessage = ( ); @@ -126,7 +135,9 @@ class LessonPlanSettings extends Component { } renderComponentSettingRow(setting) { - const componentTitle = setting.component_title || setting.component; + const componentTitle = setting.component_title || ( + + ); return ( diff --git a/client/app/bundles/course/admin/pages/NotificationSettings/index.jsx b/client/app/bundles/course/admin/pages/NotificationSettings/index.jsx index d9fe9d13bb8..cc1a44d90bf 100644 --- a/client/app/bundles/course/admin/pages/NotificationSettings/index.jsx +++ b/client/app/bundles/course/admin/pages/NotificationSettings/index.jsx @@ -12,7 +12,6 @@ import { } from '@mui/material'; import PropTypes from 'prop-types'; -import adminTranslations from 'course/translations.intl'; import Section from 'lib/components/core/layouts/Section'; import LoadingIndicator from 'lib/components/core/LoadingIndicator'; import messagesTranslations from 'lib/translations/messages'; @@ -106,7 +105,7 @@ class NotificationSettings extends Component { - + diff --git a/client/app/bundles/course/admin/pages/NotificationSettings/translations.intl.js b/client/app/bundles/course/admin/pages/NotificationSettings/translations.intl.js index 81865edc3f9..5eecfd858fc 100644 --- a/client/app/bundles/course/admin/pages/NotificationSettings/translations.intl.js +++ b/client/app/bundles/course/admin/pages/NotificationSettings/translations.intl.js @@ -1,6 +1,10 @@ import { defineMessages } from 'react-intl'; const translations = defineMessages({ + component: { + id: 'course.admin.NotificationSettings.component', + defaultMessage: 'Component', + }, setting: { id: 'course.admin.NotificationSettings.setting', defaultMessage: 'Setting', diff --git a/client/app/bundles/course/admin/pages/SidebarSettings/SidebarSettingsForm.tsx b/client/app/bundles/course/admin/pages/SidebarSettings/SidebarSettingsForm.tsx index 3f7124d2569..02c3b12f170 100644 --- a/client/app/bundles/course/admin/pages/SidebarSettings/SidebarSettingsForm.tsx +++ b/client/app/bundles/course/admin/pages/SidebarSettings/SidebarSettingsForm.tsx @@ -18,6 +18,7 @@ import { import { produce } from 'immer'; import { SidebarItem, SidebarItems } from 'types/course/admin/sidebar'; +import { getComponentTitle } from 'course/translations'; import Section from 'lib/components/core/layouts/Section'; import { defensivelyGetIcon } from 'lib/constants/icons'; import useTranslation from 'lib/hooks/useTranslation'; @@ -131,7 +132,7 @@ const SidebarSettingsForm = (props: SidebarSettingsFormProps): JSX.Element => { color={props.disabled ? 'text.disabled' : 'text.primary'} variant="body2" > - {item.title} + {getComponentTitle(t, item.id, item.title)} diff --git a/client/app/bundles/course/container/Sidebar/SidebarItem.tsx b/client/app/bundles/course/container/Sidebar/SidebarItem.tsx index ea8edc51deb..2c96ac40899 100644 --- a/client/app/bundles/course/container/Sidebar/SidebarItem.tsx +++ b/client/app/bundles/course/container/Sidebar/SidebarItem.tsx @@ -1,5 +1,4 @@ import { useLayoutEffect, useRef } from 'react'; -import { defineMessages } from 'react-intl'; import { Link, useLocation } from 'react-router-dom'; import { Badge, Typography } from '@mui/material'; import { SidebarItemData } from 'types/course/courses'; @@ -8,6 +7,8 @@ import { defensivelyGetIcon } from 'lib/constants/icons'; import { useUnreadCountForItem } from 'lib/hooks/unread'; import useTranslation from 'lib/hooks/useTranslation'; +import { getComponentTitle } from '../../translations'; + interface SidebarItemProps { of: SidebarItemData; square?: boolean; @@ -18,6 +19,8 @@ interface SidebarItemProps { const SidebarItem = (props: SidebarItemProps): JSX.Element => { const { of: item, square, exact, activePath } = props; + const { t } = useTranslation(); + const location = useLocation(); const activeUrl = activePath ?? location.pathname + location.search; @@ -42,6 +45,7 @@ const SidebarItem = (props: SidebarItemProps): JSX.Element => {
{ className="overflow-hidden text-ellipsis whitespace-nowrap font-medium" variant="body2" > - {item.label} + {getComponentTitle(t, item.key, item.label)}
); }; -const translations = defineMessages({ - home: { - id: 'course.courses.SidebarItem.home', - defaultMessage: 'Home', - }, -}); - const HomeSidebarItem = (props: { to: string }): JSX.Element => { - const { t } = useTranslation(); - return ( diff --git a/client/app/bundles/course/duplication/pages/Duplication/DuplicateItemsConfirmation/AchievementsListing.jsx b/client/app/bundles/course/duplication/pages/Duplication/DuplicateItemsConfirmation/AchievementsListing.jsx index f8ead04dd96..0ca46922721 100644 --- a/client/app/bundles/course/duplication/pages/Duplication/DuplicateItemsConfirmation/AchievementsListing.jsx +++ b/client/app/bundles/course/duplication/pages/Duplication/DuplicateItemsConfirmation/AchievementsListing.jsx @@ -15,7 +15,7 @@ import UnpublishedIcon from 'course/duplication/components/UnpublishedIcon'; import { duplicableItemTypes } from 'course/duplication/constants'; import { achievementShape } from 'course/duplication/propTypes'; import { getAchievementBadgeUrl } from 'course/helper/achievements'; -import { defaultComponentTitles } from 'course/translations.intl'; +import componentTranslations from 'course/translations'; const styles = { badge: { @@ -73,7 +73,7 @@ class AchievementsListing extends Component { <> diff --git a/client/app/bundles/course/duplication/pages/Duplication/DuplicateItemsConfirmation/AssessmentsListing.jsx b/client/app/bundles/course/duplication/pages/Duplication/DuplicateItemsConfirmation/AssessmentsListing.jsx index b62ccda9ae6..d649864dfa8 100644 --- a/client/app/bundles/course/duplication/pages/Duplication/DuplicateItemsConfirmation/AssessmentsListing.jsx +++ b/client/app/bundles/course/duplication/pages/Duplication/DuplicateItemsConfirmation/AssessmentsListing.jsx @@ -9,7 +9,7 @@ import TypeBadge from 'course/duplication/components/TypeBadge'; import UnpublishedIcon from 'course/duplication/components/UnpublishedIcon'; import { duplicableItemTypes } from 'course/duplication/constants'; import { categoryShape } from 'course/duplication/propTypes'; -import { defaultComponentTitles } from 'course/translations.intl'; +import componentTranslations from 'course/translations'; const { TAB, ASSESSMENT, CATEGORY } = duplicableItemTypes; @@ -177,7 +177,7 @@ class AssessmentsListing extends Component { <> {categoriesTrees.map((category) => diff --git a/client/app/bundles/course/duplication/pages/Duplication/DuplicateItemsConfirmation/MaterialsListing.jsx b/client/app/bundles/course/duplication/pages/Duplication/DuplicateItemsConfirmation/MaterialsListing.jsx index 8b14b8fb434..557f29e94a2 100644 --- a/client/app/bundles/course/duplication/pages/Duplication/DuplicateItemsConfirmation/MaterialsListing.jsx +++ b/client/app/bundles/course/duplication/pages/Duplication/DuplicateItemsConfirmation/MaterialsListing.jsx @@ -8,7 +8,7 @@ import IndentedCheckbox from 'course/duplication/components/IndentedCheckbox'; import TypeBadge from 'course/duplication/components/TypeBadge'; import { duplicableItemTypes } from 'course/duplication/constants'; import { folderShape } from 'course/duplication/propTypes'; -import { defaultComponentTitles } from 'course/translations.intl'; +import componentTranslations from 'course/translations'; const { FOLDER, MATERIAL } = duplicableItemTypes; const ROOT_CHILDREN_LEVEL = 1; @@ -112,7 +112,7 @@ class MaterialsListing extends Component {
diff --git a/client/app/bundles/course/duplication/pages/Duplication/DuplicateItemsConfirmation/SurveyListing.jsx b/client/app/bundles/course/duplication/pages/Duplication/DuplicateItemsConfirmation/SurveyListing.jsx index d0ba5976d35..d41acd77c26 100644 --- a/client/app/bundles/course/duplication/pages/Duplication/DuplicateItemsConfirmation/SurveyListing.jsx +++ b/client/app/bundles/course/duplication/pages/Duplication/DuplicateItemsConfirmation/SurveyListing.jsx @@ -14,7 +14,7 @@ import TypeBadge from 'course/duplication/components/TypeBadge'; import UnpublishedIcon from 'course/duplication/components/UnpublishedIcon'; import { duplicableItemTypes } from 'course/duplication/constants'; import { surveyShape } from 'course/duplication/propTypes'; -import { defaultComponentTitles } from 'course/translations.intl'; +import componentTranslations from 'course/translations'; const styles = { row: { @@ -61,7 +61,7 @@ class SurveyListing extends Component { <> diff --git a/client/app/bundles/course/duplication/pages/Duplication/DuplicateItemsConfirmation/VideosListing.jsx b/client/app/bundles/course/duplication/pages/Duplication/DuplicateItemsConfirmation/VideosListing.jsx index ca4ded31899..5963a9a04ee 100644 --- a/client/app/bundles/course/duplication/pages/Duplication/DuplicateItemsConfirmation/VideosListing.jsx +++ b/client/app/bundles/course/duplication/pages/Duplication/DuplicateItemsConfirmation/VideosListing.jsx @@ -9,7 +9,7 @@ import TypeBadge from 'course/duplication/components/TypeBadge'; import UnpublishedIcon from 'course/duplication/components/UnpublishedIcon'; import { duplicableItemTypes } from 'course/duplication/constants'; import { videoTabShape } from 'course/duplication/propTypes'; -import { defaultComponentTitles } from 'course/translations.intl'; +import componentTranslations from 'course/translations'; const { VIDEO_TAB, VIDEO } = duplicableItemTypes; @@ -102,7 +102,7 @@ class VideoListing extends Component { <> diff --git a/client/app/bundles/course/duplication/pages/Duplication/ItemsSelector/AchievementsSelector.jsx b/client/app/bundles/course/duplication/pages/Duplication/ItemsSelector/AchievementsSelector.jsx index 749a7e1c45b..977e1394dc0 100644 --- a/client/app/bundles/course/duplication/pages/Duplication/ItemsSelector/AchievementsSelector.jsx +++ b/client/app/bundles/course/duplication/pages/Duplication/ItemsSelector/AchievementsSelector.jsx @@ -12,7 +12,7 @@ import { duplicableItemTypes } from 'course/duplication/constants'; import { achievementShape } from 'course/duplication/propTypes'; import { actions } from 'course/duplication/store'; import { getAchievementBadgeUrl } from 'course/helper/achievements'; -import { defaultComponentTitles } from 'course/translations.intl'; +import componentTranslations from 'course/translations'; import Thumbnail from 'lib/components/core/Thumbnail'; const translations = defineMessages({ @@ -118,7 +118,7 @@ class AchievementsSelector extends Component { <> {this.renderBody()} diff --git a/client/app/bundles/course/duplication/pages/Duplication/ItemsSelector/AssessmentsSelector.jsx b/client/app/bundles/course/duplication/pages/Duplication/ItemsSelector/AssessmentsSelector.jsx index 88569dd5bcd..fb5c7afed50 100644 --- a/client/app/bundles/course/duplication/pages/Duplication/ItemsSelector/AssessmentsSelector.jsx +++ b/client/app/bundles/course/duplication/pages/Duplication/ItemsSelector/AssessmentsSelector.jsx @@ -12,7 +12,7 @@ import { duplicableItemTypes } from 'course/duplication/constants'; import { categoryShape } from 'course/duplication/propTypes'; import destinationCourseSelector from 'course/duplication/selectors/destinationCourse'; import { actions } from 'course/duplication/store'; -import { defaultComponentTitles } from 'course/translations.intl'; +import componentTranslations from 'course/translations'; const { TAB, ASSESSMENT, CATEGORY } = duplicableItemTypes; @@ -134,7 +134,7 @@ class AssessmentsSelector extends Component { <> {categories.length > 0 ? ( diff --git a/client/app/bundles/course/duplication/pages/Duplication/ItemsSelector/MaterialsSelector.jsx b/client/app/bundles/course/duplication/pages/Duplication/ItemsSelector/MaterialsSelector.jsx index 9102d109235..227a946ca80 100644 --- a/client/app/bundles/course/duplication/pages/Duplication/ItemsSelector/MaterialsSelector.jsx +++ b/client/app/bundles/course/duplication/pages/Duplication/ItemsSelector/MaterialsSelector.jsx @@ -10,7 +10,7 @@ import TypeBadge from 'course/duplication/components/TypeBadge'; import { duplicableItemTypes } from 'course/duplication/constants'; import { folderShape } from 'course/duplication/propTypes'; import { actions } from 'course/duplication/store'; -import { defaultComponentTitles } from 'course/translations.intl'; +import componentTranslations from 'course/translations'; const { FOLDER, MATERIAL } = duplicableItemTypes; @@ -101,7 +101,7 @@ class MaterialsSelector extends Component { <> {folders.length > 0 ? ( diff --git a/client/app/bundles/course/duplication/pages/Duplication/ItemsSelector/SurveysSelector.jsx b/client/app/bundles/course/duplication/pages/Duplication/ItemsSelector/SurveysSelector.jsx index 13bfa68588d..0127124c92d 100644 --- a/client/app/bundles/course/duplication/pages/Duplication/ItemsSelector/SurveysSelector.jsx +++ b/client/app/bundles/course/duplication/pages/Duplication/ItemsSelector/SurveysSelector.jsx @@ -11,7 +11,7 @@ import UnpublishedIcon from 'course/duplication/components/UnpublishedIcon'; import { duplicableItemTypes } from 'course/duplication/constants'; import { surveyShape } from 'course/duplication/propTypes'; import { actions } from 'course/duplication/store'; -import { defaultComponentTitles } from 'course/translations.intl'; +import componentTranslations from 'course/translations'; const translations = defineMessages({ noItems: { @@ -98,7 +98,7 @@ class SurveysSelector extends Component { <> {this.renderBody()} diff --git a/client/app/bundles/course/duplication/pages/Duplication/ItemsSelector/VideosSelector.jsx b/client/app/bundles/course/duplication/pages/Duplication/ItemsSelector/VideosSelector.jsx index 2434498444a..c18fdc34637 100644 --- a/client/app/bundles/course/duplication/pages/Duplication/ItemsSelector/VideosSelector.jsx +++ b/client/app/bundles/course/duplication/pages/Duplication/ItemsSelector/VideosSelector.jsx @@ -11,7 +11,7 @@ import UnpublishedIcon from 'course/duplication/components/UnpublishedIcon'; import { duplicableItemTypes } from 'course/duplication/constants'; import { videoTabShape } from 'course/duplication/propTypes'; import { actions } from 'course/duplication/store'; -import { defaultComponentTitles } from 'course/translations.intl'; +import componentTranslations from 'course/translations'; const { VIDEO_TAB, VIDEO } = duplicableItemTypes; @@ -120,7 +120,7 @@ class VideosSelector extends Component { <> {this.renderBody()} diff --git a/client/app/bundles/course/duplication/pages/Duplication/ItemsSelectorMenu/index.jsx b/client/app/bundles/course/duplication/pages/Duplication/ItemsSelectorMenu/index.jsx index 278ea18b68a..a91172df79c 100644 --- a/client/app/bundles/course/duplication/pages/Duplication/ItemsSelectorMenu/index.jsx +++ b/client/app/bundles/course/duplication/pages/Duplication/ItemsSelectorMenu/index.jsx @@ -17,7 +17,7 @@ import { } from 'course/duplication/constants'; import { courseShape } from 'course/duplication/propTypes'; import { actions } from 'course/duplication/store'; -import { defaultComponentTitles } from 'course/translations.intl'; +import componentTranslations from 'course/translations'; import DuplicateButton from '../DuplicateButton'; @@ -72,7 +72,7 @@ class ItemsSelectorMenu extends Component { - + ); diff --git a/client/app/bundles/course/lesson-plan/containers/LessonPlanFilter/index.jsx b/client/app/bundles/course/lesson-plan/containers/LessonPlanFilter/index.jsx index 059998aabaa..61431219d76 100644 --- a/client/app/bundles/course/lesson-plan/containers/LessonPlanFilter/index.jsx +++ b/client/app/bundles/course/lesson-plan/containers/LessonPlanFilter/index.jsx @@ -7,6 +7,7 @@ import { Button, MenuItem, MenuList, Popover } from '@mui/material'; import PropTypes from 'prop-types'; import { actions } from '../../store'; +import TranslatedItemType from '../TranslatedItemType'; const translations = defineMessages({ filter: { @@ -78,7 +79,7 @@ class LessonPlanFilter extends Component { } style={{ display: 'flex', justifyContent: 'space-between' }} > - {itemType} + {isVisible && } ); diff --git a/client/app/bundles/course/lesson-plan/containers/TranslatedItemType.tsx b/client/app/bundles/course/lesson-plan/containers/TranslatedItemType.tsx new file mode 100644 index 00000000000..6b1be4947dd --- /dev/null +++ b/client/app/bundles/course/lesson-plan/containers/TranslatedItemType.tsx @@ -0,0 +1,22 @@ +import { FC } from 'react'; + +import { getComponentTitle } from 'course/translations'; +import useTranslation from 'lib/hooks/useTranslation'; + +// TODO: properly handle this by separating raw strings & component keys. +const TranslatedItemType: FC<{ type: string }> = ({ type }) => { + const { t } = useTranslation(); + const isTypeComponentKey = [ + 'course_surveys_component', + 'course_videos_component', + ].includes(type); + + return ( + <> + {isTypeComponentKey && getComponentTitle(t, type)} + {!isTypeComponentKey && type} + + ); +}; + +export default TranslatedItemType; diff --git a/client/app/bundles/course/lesson-plan/pages/LessonPlanEdit/ItemRow/index.jsx b/client/app/bundles/course/lesson-plan/pages/LessonPlanEdit/ItemRow/index.jsx index 30e61a95bfc..c8e764e108d 100644 --- a/client/app/bundles/course/lesson-plan/pages/LessonPlanEdit/ItemRow/index.jsx +++ b/client/app/bundles/course/lesson-plan/pages/LessonPlanEdit/ItemRow/index.jsx @@ -6,6 +6,7 @@ import PropTypes from 'prop-types'; import Link from 'lib/components/core/Link'; import { fields } from '../../../constants'; +import TranslatedItemType from '../../../containers/TranslatedItemType'; import { updateItem } from '../../../operations'; import DateCell from './DateCell'; @@ -68,7 +69,11 @@ class ItemRow extends Component { return ( - {columnsVisible[fields.ITEM_TYPE] ? {type} : null} + {columnsVisible[fields.ITEM_TYPE] ? ( + + + + ) : null} {title} diff --git a/client/app/bundles/course/lesson-plan/pages/LessonPlanShow/LessonPlanItem/Details/Chips.jsx b/client/app/bundles/course/lesson-plan/pages/LessonPlanShow/LessonPlanItem/Details/Chips.jsx index 64f69595180..bf859481e0e 100644 --- a/client/app/bundles/course/lesson-plan/pages/LessonPlanShow/LessonPlanItem/Details/Chips.jsx +++ b/client/app/bundles/course/lesson-plan/pages/LessonPlanShow/LessonPlanItem/Details/Chips.jsx @@ -10,6 +10,8 @@ import PropTypes from 'prop-types'; import moment, { formatShortDateTime, formatShortTime } from 'lib/moment'; +import TranslatedItemType from '../../../../containers/TranslatedItemType'; + const translations = defineMessages({ notPublished: { id: 'course.lessonPlan.LessonPlanShow.LessonPlanItem.Details.Chip.notPublished', @@ -127,7 +129,7 @@ class Chips extends Component { } - label={itemType} + label={} style={styles.chip} /> ); diff --git a/client/app/bundles/course/level/pages/LevelsIndex/index.tsx b/client/app/bundles/course/level/pages/LevelsIndex/index.tsx index 0863cddcc87..0b6280039b7 100644 --- a/client/app/bundles/course/level/pages/LevelsIndex/index.tsx +++ b/client/app/bundles/course/level/pages/LevelsIndex/index.tsx @@ -1,7 +1,7 @@ import { defineMessages } from 'react-intl'; import { Skeleton, Stack, Typography } from '@mui/material'; -import { defaultComponentTitles } from 'course/translations.intl'; +import componentTranslations from 'course/translations'; import Page from 'lib/components/core/layouts/Page'; import Preload from 'lib/components/wrappers/Preload'; import { useAppDispatch } from 'lib/hooks/store'; @@ -37,7 +37,7 @@ const LevelsIndex = (): JSX.Element => { - {t(defaultComponentTitles.course_levels_component)} + {t(componentTranslations.course_levels_component)} } > diff --git a/client/app/bundles/course/material/folders/handles.ts b/client/app/bundles/course/material/folders/handles.ts index aa21b2dac08..b7c4e7f4599 100644 --- a/client/app/bundles/course/material/folders/handles.ts +++ b/client/app/bundles/course/material/folders/handles.ts @@ -4,6 +4,7 @@ import { FolderData } from 'types/course/material/folders'; import { getIdFromUnknown } from 'utilities'; import CourseAPI from 'api/course'; +import componentTranslations from 'course/translations'; import { CrumbPath, DataHandle } from 'lib/hooks/router/dynamicNest'; const translations = defineMessages({ @@ -25,13 +26,25 @@ const translations = defineMessages({ */ const buildCrumbPath = ( courseUrl: string, - breadcrumbs: { id: number; name: string }[], + breadcrumbs: { id: number; name?: string }[], ): CrumbPath => ({ activePath: `${courseUrl}/materials/folders/${breadcrumbs[0].id}`, - content: breadcrumbs.map((crumb) => ({ - title: crumb.id < 0 ? translations.error : crumb.name, - url: `materials/folders/${crumb.id < 0 ? '' : crumb.id}`, - })), + content: breadcrumbs.map((crumb) => { + if (crumb.id < 0) { + return { + title: translations.error, + url: `materials/folders/`, + }; + } + + return { + title: + crumb.name && crumb.name.length > 0 + ? crumb.name + : componentTranslations.course_materials_component, + url: `materials/folders/${crumb.id}`, + }; + }), }); /** diff --git a/client/app/bundles/course/reference-timelines/components/CreateRenameTimelinePrompt.tsx b/client/app/bundles/course/reference-timelines/components/CreateRenameTimelinePrompt.tsx index 29633a34fe8..71aa825a0ea 100644 --- a/client/app/bundles/course/reference-timelines/components/CreateRenameTimelinePrompt.tsx +++ b/client/app/bundles/course/reference-timelines/components/CreateRenameTimelinePrompt.tsx @@ -116,7 +116,7 @@ const CreateRenameTimelinePrompt = ( } title={ timeline - ? t(translations.renameTimelineTitle, { title: timeline.title }) + ? t(translations.renameTimelineTitle, { title: timeline.title ?? '' }) : t(translations.newTimeline) } > diff --git a/client/app/bundles/course/reference-timelines/components/DeleteTimelinePrompt.tsx b/client/app/bundles/course/reference-timelines/components/DeleteTimelinePrompt.tsx index afc5a595a32..ed99202d4bd 100644 --- a/client/app/bundles/course/reference-timelines/components/DeleteTimelinePrompt.tsx +++ b/client/app/bundles/course/reference-timelines/components/DeleteTimelinePrompt.tsx @@ -46,7 +46,9 @@ const DeleteTimelinePrompt = ( ? t(translations.confirmRevertAndDeleteTimeline) : t(translations.confirmDeleteTimeline) } - title={t(translations.sureDeletingTimeline, { title: timeline.title })} + title={t(translations.sureDeletingTimeline, { + title: timeline.title ?? '', + })} > {Boolean(timeline.timesCount) && ( diff --git a/client/app/bundles/course/reference-timelines/components/TimelinesOverview/TimelinesOverviewItem.tsx b/client/app/bundles/course/reference-timelines/components/TimelinesOverview/TimelinesOverviewItem.tsx index 974d74e2b46..ff3c719a084 100644 --- a/client/app/bundles/course/reference-timelines/components/TimelinesOverview/TimelinesOverviewItem.tsx +++ b/client/app/bundles/course/reference-timelines/components/TimelinesOverview/TimelinesOverviewItem.tsx @@ -46,7 +46,9 @@ const TimelinesOverviewItem = ( toast.error( error ?? - t(translations.errorDeletingTimeline, { title: timeline.title }), + t(translations.errorDeletingTimeline, { + title: timeline.title ?? '', + }), ); }); }; @@ -62,7 +64,7 @@ const TimelinesOverviewItem = ( } descriptionVariant="caption" disabled={timeline.default ?? status === 'loading'} - label={timeline.title} + label={timeline.title ?? t(translations.defaultTimeline)} labelClassName="!-mb-2 line-clamp-1 max-w-[20rem]" onChange={(_, checked): void => props.onChangeCheck?.(checked)} variant="body2" diff --git a/client/app/bundles/course/reference-timelines/translations.ts b/client/app/bundles/course/reference-timelines/translations.ts index eaaf61c76fc..6afe68d3c85 100644 --- a/client/app/bundles/course/reference-timelines/translations.ts +++ b/client/app/bundles/course/reference-timelines/translations.ts @@ -158,7 +158,7 @@ export default defineMessages({ }, defaultTimeline: { id: 'course.timelines.defaultTimeline', - defaultMessage: 'Default', + defaultMessage: 'Default Timeline', }, deleteTime: { id: 'course.timelines.deleteTime', diff --git a/client/app/bundles/course/reference-timelines/views/DayView/ItemsSidebar.tsx b/client/app/bundles/course/reference-timelines/views/DayView/ItemsSidebar.tsx index 12081c2be64..a995904f7eb 100644 --- a/client/app/bundles/course/reference-timelines/views/DayView/ItemsSidebar.tsx +++ b/client/app/bundles/course/reference-timelines/views/DayView/ItemsSidebar.tsx @@ -4,8 +4,10 @@ import { TimelineData, } from 'types/course/referenceTimelines'; +import useTranslation from 'lib/hooks/useTranslation'; import moment from 'lib/moment'; +import translations from '../../translations'; import { getDaysFromSeconds } from '../../utils'; import TimelineSidebarItem from './TimelineSidebarItem'; @@ -19,6 +21,7 @@ interface ItemsSidebarProps { const ItemsSidebar = (props: ItemsSidebarProps): JSX.Element => { const { for: items, within: timelines } = props; + const { t } = useTranslation(); return (
diff --git a/client/app/bundles/course/reference-timelines/views/DayView/TimelineSidebarItem.tsx b/client/app/bundles/course/reference-timelines/views/DayView/TimelineSidebarItem.tsx index 7df66bcf5ee..4083efa39bf 100644 --- a/client/app/bundles/course/reference-timelines/views/DayView/TimelineSidebarItem.tsx +++ b/client/app/bundles/course/reference-timelines/views/DayView/TimelineSidebarItem.tsx @@ -30,7 +30,7 @@ const TimelineSidebarItem = (props: TimelineSidebarItemProps): JSX.Element => { })} > - {timeline.title} + {timeline.title ?? t(translations.defaultTimeline)} {assigned ? ( diff --git a/client/app/bundles/course/translations.intl.js b/client/app/bundles/course/translations.intl.js deleted file mode 100644 index 43b42246b84..00000000000 --- a/client/app/bundles/course/translations.intl.js +++ /dev/null @@ -1,49 +0,0 @@ -import { defineMessages } from 'react-intl'; - -const translations = defineMessages({ - component: { - id: 'course.component', - defaultMessage: 'Component', - }, -}); - -export const defaultComponentTitles = defineMessages({ - course_achievements_component: { - id: 'course.componentTitles.course_achievements_component', - defaultMessage: 'Achievements', - }, - course_assessments_component: { - id: 'course.componentTitles.course_assessments_component', - defaultMessage: 'Assessments', - }, - course_announcements_component: { - id: 'course.componentTitles.course_announcements_component', - defaultMessage: 'Announcements', - }, - course_survey_component: { - id: 'course.componentTitles.course_survey_component', - defaultMessage: 'Surveys', - }, - course_users_component: { - id: 'course.componentTitles.course_users_component', - defaultMessage: 'Users', - }, - course_forums_component: { - id: 'course.componentTitles.course_forums_component', - defaultMessage: 'Forums', - }, - course_videos_component: { - id: 'course.componentTitles.course_videos_component', - defaultMessage: 'Videos', - }, - course_materials_component: { - id: 'course.componentTitles.course_materials_component', - defaultMessage: 'Materials', - }, - course_levels_component: { - id: 'course.componentTitles.course_levels_component', - defaultMessage: 'Levels', - }, -}); - -export default translations; diff --git a/client/app/bundles/course/translations.ts b/client/app/bundles/course/translations.ts new file mode 100644 index 00000000000..74ee28e438f --- /dev/null +++ b/client/app/bundles/course/translations.ts @@ -0,0 +1,219 @@ +import { defineMessages, MessageDescriptor } from 'react-intl'; + +import { MessageTranslator } from 'lib/hooks/useTranslation'; + +const translations = defineMessages({ + admin_duplication: { + id: 'course.courses.SidebarItem.admin.duplication', + defaultMessage: 'Duplicate Data', + }, + admin_multiple_reference_timelines: { + id: 'course.courses.SidebarItem.admin.multipleReferenceTimelines', + defaultMessage: 'Timeline Designer', + }, + admin_plagiarism: { + id: 'course.courses.SidebarItem.admin.plagiarism', + defaultMessage: 'Plagiarism Check', + }, + admin_scholaistic_assistants: { + id: 'course.courses.SidebarItem.admin.scholaistic.assistants', + defaultMessage: 'Assistants', + }, + admin_settings: { + id: 'course.courses.SidebarItem.admin.settings', + defaultMessage: 'Course Settings', + }, + admin_settings_component_settings: { + id: 'course.courses.SidebarItem.admin.settings.components', + defaultMessage: 'Components', + }, + admin_settings_general: { + id: 'course.courses.SidebarItem.admin.settings.general', + defaultMessage: 'General', + }, + admin_settings_notifications: { + id: 'course.courses.SidebarItem.admin.settings.notifications', + defaultMessage: 'Email', + }, + admin_settings_sidebar_settings: { + id: 'course.courses.SidebarItem.admin.settings.sidebar', + defaultMessage: 'Sidebar', + }, + admin_users_manage_users: { + id: 'course.courses.SidebarItem.admin.users.manageUsers', + defaultMessage: 'Manage Users', + }, + course_achievements_component: { + id: 'course.componentTitles.course_achievements_component', + defaultMessage: 'Achievements', + }, + course_announcements_component: { + id: 'course.componentTitles.course_announcements_component', + defaultMessage: 'Announcements', + }, + course_assessments_component: { + id: 'course.componentTitles.course_assessments_component', + defaultMessage: 'Assessments', + }, + course_codaveri_component: { + id: 'course.componentTitles.course_codaveri_component', + defaultMessage: 'Codaveri Evaluation and Feedback', + }, + course_discussion_topics_component: { + id: 'course.componentTitles.course_discussion_topics_component', + defaultMessage: 'Comments Center', + }, + course_duplication_component: { + id: 'course.componentTitles.course_duplication_component', + defaultMessage: 'Duplication', + }, + course_experience_points_component: { + id: 'course.componentTitles.course_experience_points_component', + defaultMessage: 'Experience Points', + }, + course_forums_component: { + id: 'course.componentTitles.course_forums_component', + defaultMessage: 'Forums', + }, + course_groups_component: { + id: 'course.componentTitles.course_groups_component', + defaultMessage: 'Groups', + }, + course_koditsu_platform_component: { + id: 'course.componentTitles.course_koditsu_platform_component', + defaultMessage: 'Koditsu Exam', + }, + course_leaderboard_component: { + id: 'course.componentTitles.course_leaderboard_component', + defaultMessage: 'Leaderboard', + }, + course_learning_map_component: { + id: 'course.componentTitles.course_learning_map_component', + defaultMessage: 'Learning Map', + }, + course_lesson_plan_component: { + id: 'course.componentTitles.course_lesson_plan_component', + defaultMessage: 'Lesson Plan', + }, + course_levels_component: { + id: 'course.componentTitles.course_levels_component', + defaultMessage: 'Levels', + }, + course_materials_component: { + id: 'course.componentTitles.course_materials_component', + defaultMessage: 'Materials', + }, + course_monitoring_component: { + id: 'course.componentTitles.course_monitoring_component', + defaultMessage: 'Heartbeat Monitoring for Exams', + }, + course_multiple_reference_timelines_component: { + id: 'course.componentTitles.course_multiple_reference_timelines_component', + defaultMessage: 'Multiple Reference Timelines', + }, + course_plagiarism_component: { + id: 'course.componentTitles.course_plagiarism_component', + defaultMessage: 'SSID Plagiarism Check', + }, + course_rag_wise_component: { + id: 'course.componentTitles.course_rag_wise_component', + defaultMessage: 'RagWise Auto Forum Response', + }, + course_scholaistic_component: { + id: 'course.componentTitles.course_scholaistic_component', + defaultMessage: 'Role-Playing Chatbots & Assessments', + }, + course_settings_component: { + id: 'course.componentTitles.course_settings_component', + defaultMessage: 'Settings', + }, + course_statistics_component: { + id: 'course.componentTitles.course_statistics_component', + defaultMessage: 'Statistics', + }, + course_stories_component: { + id: 'course.componentTitles.course_stories_component', + defaultMessage: 'Stories', + }, + course_survey_component: { + id: 'course.componentTitles.course_survey_component', + defaultMessage: 'Surveys', + }, + course_users_component: { + id: 'course.componentTitles.course_users_component', + defaultMessage: 'Users', + }, + course_videos_component: { + id: 'course.componentTitles.course_videos_component', + defaultMessage: 'Videos', + }, + sidebar_assessments_skills: { + id: 'course.courses.SidebarItem.assessmentSkills', + defaultMessage: 'Skills', + }, + sidebar_assessments_submissions: { + id: 'course.courses.SidebarItem.assessmentSubmissions', + defaultMessage: 'Submissions', + }, + sidebar_discussion_topics: { + id: 'course.courses.SidebarItem.discussionTopics', + defaultMessage: 'Comments', + }, + sidebar_experience_points: { + id: 'course.courses.SidebarItem.experiencePoints', + defaultMessage: 'Experience Points', + }, + sidebar_home: { + id: 'course.courses.SidebarItem.home', + defaultMessage: 'Home', + }, + sidebar_stories_learn: { + id: 'course.courses.SidebarItem.stories.learn', + defaultMessage: 'Learn', + }, + sidebar_stories_mission_control: { + id: 'course.courses.SidebarItem.stories.missionControl', + defaultMessage: 'Mission Control', + }, +}); + +// Keys for main sidebar items (the ones students can see) cannot be changed, +// because the ordering of sidebar items for each course is saved in DB using these names. +const LegacySidebarItemKeyMapper: Record = { + announcements: translations.course_announcements_component, + achievements: translations.course_achievements_component, + assessments_submissions: translations.sidebar_assessments_submissions, + discussion_topics: translations.sidebar_discussion_topics, + forums: translations.course_forums_component, + leaderboard: translations.course_leaderboard_component, + learning_map: translations.course_learning_map_component, + lesson_plan: translations.course_lesson_plan_component, + materials: translations.course_materials_component, + learn: translations.sidebar_stories_learn, + surveys: translations.course_survey_component, + users: translations.course_users_component, + videos: translations.course_videos_component, +}; + +export const getComponentTranslationKey = ( + key?: string, +): MessageDescriptor | undefined => { + if (!key) return undefined; + if (translations[key]) return translations[key]; + if (LegacySidebarItemKeyMapper[key]) return LegacySidebarItemKeyMapper[key]; + return undefined; +}; + +export const getComponentTitle = ( + t: MessageTranslator, + key?: string, + definedTitle?: string, +): string | undefined => { + if (definedTitle && definedTitle.length > 0) return definedTitle; + + const translationKey = getComponentTranslationKey(key); + if (translationKey) return t(translationKey); + return key; +}; + +export default translations; diff --git a/client/app/bundles/system/admin/instance/instance/pages/InstanceComponentsIndex.tsx b/client/app/bundles/system/admin/instance/instance/pages/InstanceComponentsIndex.tsx index 6c1c65c2b7e..f16b84b5e29 100644 --- a/client/app/bundles/system/admin/instance/instance/pages/InstanceComponentsIndex.tsx +++ b/client/app/bundles/system/admin/instance/instance/pages/InstanceComponentsIndex.tsx @@ -1,5 +1,5 @@ import { FC, useEffect, useState } from 'react'; -import { defineMessages, injectIntl, WrappedComponentProps } from 'react-intl'; +import { defineMessages } from 'react-intl'; import { Switch, Table, @@ -10,16 +10,16 @@ import { } from '@mui/material'; import { ComponentData } from 'types/system/instance/components'; +import { getComponentTitle } from 'course/translations'; import LoadingIndicator from 'lib/components/core/LoadingIndicator'; import { useAppDispatch } from 'lib/hooks/store'; import toast from 'lib/hooks/toast'; +import useTranslation from 'lib/hooks/useTranslation'; import tableTranslations from 'lib/translations/table'; import { indexComponents, updateComponents } from '../operations'; import { actions } from '../store'; -type Props = WrappedComponentProps; - const translations = defineMessages({ fetchComponentsFailure: { id: 'system.admin.instance.instance.InstanceComponentsForm.fetchComponentsFailure', @@ -35,8 +35,8 @@ const translations = defineMessages({ }, }); -const InstanceComponentsIndex: FC = (props) => { - const { intl } = props; +const InstanceComponentsIndex: FC = () => { + const { t } = useTranslation(); const dispatch = useAppDispatch(); const [isLoading, setIsLoading] = useState(false); const [isUpdating, setIsUpdating] = useState(false); @@ -49,9 +49,7 @@ const InstanceComponentsIndex: FC = (props) => { setComponents(data); dispatch(actions.initComponentList(data)); }) - .catch(() => - toast.error(intl.formatMessage(translations.fetchComponentsFailure)), - ) + .catch(() => toast.error(t(translations.fetchComponentsFailure))) .finally(() => { setIsLoading(false); }); @@ -63,11 +61,9 @@ const InstanceComponentsIndex: FC = (props) => { .then((data) => { setComponents(data); dispatch(actions.initComponentList(data)); - toast.success(intl.formatMessage(translations.updateComponentsSuccess)); + toast.success(t(translations.updateComponentsSuccess)); }) - .catch(() => - toast.error(intl.formatMessage(translations.updateComponentsFailed)), - ) + .catch(() => toast.error(t(translations.updateComponentsFailed))) .finally(() => setIsUpdating(false)); }; @@ -77,18 +73,14 @@ const InstanceComponentsIndex: FC = (props) => { - - {intl.formatMessage(tableTranslations.component)} - - - {intl.formatMessage(tableTranslations.isEnabled)} - + {t(tableTranslations.component)} + {t(tableTranslations.isEnabled)} {components.map((component) => ( - {component.displayName} + {getComponentTitle(t, component.key)} = (props) => { ); }; -export default injectIntl(InstanceComponentsIndex); +export default InstanceComponentsIndex; diff --git a/client/app/types/course/admin/components.ts b/client/app/types/course/admin/components.ts index 443ec6289c8..8b31bc8da91 100644 --- a/client/app/types/course/admin/components.ts +++ b/client/app/types/course/admin/components.ts @@ -1,6 +1,5 @@ export interface CourseComponent { id: string; - displayName: string; enabled: boolean; } diff --git a/client/app/types/course/admin/course.ts b/client/app/types/course/admin/course.ts index 6a6babb2f39..6990c234018 100644 --- a/client/app/types/course/admin/course.ts +++ b/client/app/types/course/admin/course.ts @@ -15,7 +15,8 @@ export interface CourseInfo { } export interface CourseAdminItem { - title: string; + id: string; + title?: string; weight: number; path: string; } diff --git a/client/app/types/course/admin/sidebar.ts b/client/app/types/course/admin/sidebar.ts index e39479d4ecc..0d1aa8711cd 100644 --- a/client/app/types/course/admin/sidebar.ts +++ b/client/app/types/course/admin/sidebar.ts @@ -2,7 +2,7 @@ import { CourseComponentIconName } from 'lib/constants/icons'; export interface SidebarItem { id: string; - title: string; + title?: string; weight: number; icon: CourseComponentIconName; } diff --git a/client/app/types/course/courses.ts b/client/app/types/course/courses.ts index 25503a9fc8b..083add24cc3 100644 --- a/client/app/types/course/courses.ts +++ b/client/app/types/course/courses.ts @@ -77,7 +77,7 @@ export interface NewCourseFormData { export interface SidebarItemData { key: string; - label: string; + label?: string; path: string; icon: CourseComponentIconName; unread?: number; diff --git a/client/app/types/course/material/folders.ts b/client/app/types/course/material/folders.ts index 0276fc0462d..98e726f2302 100644 --- a/client/app/types/course/material/folders.ts +++ b/client/app/types/course/material/folders.ts @@ -94,7 +94,7 @@ export interface FolderData { export interface BreadcrumbData { breadcrumbs: { id: number; - name: string; + name?: string; }[]; } diff --git a/client/app/types/course/referenceTimelines.ts b/client/app/types/course/referenceTimelines.ts index 106026b5684..85ee0a43652 100644 --- a/client/app/types/course/referenceTimelines.ts +++ b/client/app/types/course/referenceTimelines.ts @@ -8,7 +8,7 @@ export interface TimeData { export interface TimelineData { id: number; timesCount: number; - title: string; + title?: string; default?: boolean; weight?: number; assignees?: number; diff --git a/client/app/types/system/instance/components.ts b/client/app/types/system/instance/components.ts index 874feb716d7..041024d9094 100644 --- a/client/app/types/system/instance/components.ts +++ b/client/app/types/system/instance/components.ts @@ -1,5 +1,4 @@ export interface ComponentData { key: string; - displayName: string; enabled: boolean; } diff --git a/client/locales/en.json b/client/locales/en.json index 52b28396ce6..a7185a5aaa7 100644 --- a/client/locales/en.json +++ b/client/locales/en.json @@ -4026,7 +4026,7 @@ "course.asssessment.submission.submitNoQuestionExplain": { "defaultMessage": "Mark as completed?" }, - "course.component": { + "course.admin.NotificationSettings.component": { "defaultMessage": "Component" }, "course.componentTitles.course_achievements_component": { @@ -4038,15 +4038,66 @@ "course.componentTitles.course_assessments_component": { "defaultMessage": "Assessments" }, + "course.componentTitles.course_codaveri_component": { + "defaultMessage": "Codaveri Evaluation and Feedback" + }, + "course.componentTitles.course_discussion_topics_component": { + "defaultMessage": "Comments Center" + }, + "course.componentTitles.course_duplication_component": { + "defaultMessage": "Duplication" + }, + "course.componentTitles.course_experience_points_component": { + "defaultMessage": "Experience Points" + }, "course.componentTitles.course_forums_component": { "defaultMessage": "Forums" }, + "course.componentTitles.course_groups_component": { + "defaultMessage": "Groups" + }, + "course.componentTitles.course_koditsu_platform_component": { + "defaultMessage": "Koditsu Exam" + }, + "course.componentTitles.course_leaderboard_component": { + "defaultMessage": "Leaderboard" + }, + "course.componentTitles.course_learning_map_component": { + "defaultMessage": "Learning Map" + }, + "course.componentTitles.course_lesson_plan_component": { + "defaultMessage": "Lesson Plan" + }, "course.componentTitles.course_levels_component": { "defaultMessage": "Levels" }, "course.componentTitles.course_materials_component": { "defaultMessage": "Materials" }, + "course.componentTitles.course_monitoring_component": { + "defaultMessage": "Heartbeat Monitoring for Exams" + }, + "course.componentTitles.course_multiple_reference_timelines_component": { + "defaultMessage": "Multiple Reference Timelines" + }, + "course.componentTitles.course_plagiarism_component": { + "defaultMessage": "SSID Plagiarism Check" + }, + "course.componentTitles.course_rag_wise_component": { + "defaultMessage": "RagWise Auto Forum Response" + }, + "course.componentTitles.course_scholaistic_component": { + "defaultMessage": "Role-Playing Chatbots & Assessments" + }, + "course.componentTitles.course_settings_component": { + "defaultMessage": "Settings" + }, + "course.componentTitles.course_statistics_component": { + "defaultMessage": "Statistics" + }, + "course.componentTitles.course_stories_component": { + "defaultMessage": "Stories" + }, "course.componentTitles.course_survey_component": { "defaultMessage": "Surveys" }, @@ -4227,9 +4278,57 @@ "course.courses.Sidebar.administration": { "defaultMessage": "Administration" }, + "course.courses.SidebarItem.admin.duplication": { + "defaultMessage": "Duplicate Data" + }, + "course.courses.SidebarItem.admin.multipleReferenceTimelines": { + "defaultMessage": "Timeline Designer" + }, + "course.courses.SidebarItem.admin.plagiarism": { + "defaultMessage": "Plagiarism Check" + }, + "course.courses.SidebarItem.admin.scholaistic.assistants": { + "defaultMessage": "Assistants" + }, + "course.courses.SidebarItem.admin.settings": { + "defaultMessage": "Course Settings" + }, + "course.courses.SidebarItem.admin.settings.components": { + "defaultMessage": "Components" + }, + "course.courses.SidebarItem.admin.settings.general": { + "defaultMessage": "General" + }, + "course.courses.SidebarItem.admin.settings.notifications": { + "defaultMessage": "Email" + }, + "course.courses.SidebarItem.admin.settings.sidebar": { + "defaultMessage": "Sidebar" + }, + "course.courses.SidebarItem.admin.users.manageUsers": { + "defaultMessage": "Manage Users" + }, + "course.courses.SidebarItem.assessmentSkills": { + "defaultMessage": "Skills" + }, + "course.courses.SidebarItem.assessmentSubmissions": { + "defaultMessage": "Submissions" + }, + "course.courses.SidebarItem.discussionTopics": { + "defaultMessage": "Comments" + }, + "course.courses.SidebarItem.experiencePoints": { + "defaultMessage": "Experience Points" + }, "course.courses.SidebarItem.home": { "defaultMessage": "Home" }, + "course.courses.SidebarItem.stories.learn": { + "defaultMessage": "Learn" + }, + "course.courses.SidebarItem.stories.missionControl": { + "defaultMessage": "Mission Control" + }, "course.courses.TodoIgnoreButton.ignore.ignoreButtonText": { "defaultMessage": "Ignore" }, diff --git a/client/locales/ko.json b/client/locales/ko.json index e2c59931ba1..88bbe031e26 100644 --- a/client/locales/ko.json +++ b/client/locales/ko.json @@ -4007,7 +4007,7 @@ "course.asssessment.submission.submitNoQuestionExplain": { "defaultMessage": "완료로 표시하시겠습니까?" }, - "course.component": { + "course.admin.NotificationSettings.component": { "defaultMessage": "구성 요소" }, "course.componentTitles.course_achievements_component": { @@ -4019,15 +4019,66 @@ "course.componentTitles.course_assessments_component": { "defaultMessage": "평가" }, + "course.componentTitles.course_codaveri_component": { + "defaultMessage": "Codaveri 평가 및 피드백" + }, + "course.componentTitles.course_discussion_topics_component": { + "defaultMessage": "댓글 센터" + }, + "course.componentTitles.course_duplication_component": { + "defaultMessage": "복제" + }, + "course.componentTitles.course_experience_points_component": { + "defaultMessage": "경험치" + }, "course.componentTitles.course_forums_component": { "defaultMessage": "포럼" }, + "course.componentTitles.course_groups_component": { + "defaultMessage": "그룹" + }, + "course.componentTitles.course_koditsu_platform_component": { + "defaultMessage": "Koditsu 시험" + }, + "course.componentTitles.course_leaderboard_component": { + "defaultMessage": "리더보드" + }, + "course.componentTitles.course_learning_map_component": { + "defaultMessage": "학습 지도" + }, + "course.componentTitles.course_lesson_plan_component": { + "defaultMessage": "수업 계획" + }, "course.componentTitles.course_levels_component": { "defaultMessage": "레벨" }, "course.componentTitles.course_materials_component": { "defaultMessage": "자료" }, + "course.componentTitles.course_monitoring_component": { + "defaultMessage": "시험 모니터링" + }, + "course.componentTitles.course_multiple_reference_timelines_component": { + "defaultMessage": "다중 참조 타임라인" + }, + "course.componentTitles.course_plagiarism_component": { + "defaultMessage": "SSID 표절 검사" + }, + "course.componentTitles.course_rag_wise_component": { + "defaultMessage": "RagWise 자동 포럼 응답" + }, + "course.componentTitles.course_scholaistic_component": { + "defaultMessage": "롤플레잉 챗봇 및 평가" + }, + "course.componentTitles.course_settings_component": { + "defaultMessage": "설정" + }, + "course.componentTitles.course_statistics_component": { + "defaultMessage": "통계" + }, + "course.componentTitles.course_stories_component": { + "defaultMessage": "이야기" + }, "course.componentTitles.course_survey_component": { "defaultMessage": "설문조사" }, @@ -4208,9 +4259,57 @@ "course.courses.Sidebar.administration": { "defaultMessage": "관리" }, + "course.courses.SidebarItem.admin.duplication": { + "defaultMessage": "데이터 복제" + }, + "course.courses.SidebarItem.admin.multipleReferenceTimelines": { + "defaultMessage": "타임라인 디자이너" + }, + "course.courses.SidebarItem.admin.plagiarism": { + "defaultMessage": "SSID 표절 검사" + }, + "course.courses.SidebarItem.admin.scholaistic.assistants": { + "defaultMessage": "학습 조수" + }, + "course.courses.SidebarItem.admin.settings": { + "defaultMessage": "코스 설정" + }, + "course.courses.SidebarItem.admin.settings.components": { + "defaultMessage": "구성 요소" + }, + "course.courses.SidebarItem.admin.settings.general": { + "defaultMessage": "일반" + }, + "course.courses.SidebarItem.admin.settings.notifications": { + "defaultMessage": "이메일" + }, + "course.courses.SidebarItem.admin.settings.sidebar": { + "defaultMessage": "사이드바" + }, + "course.courses.SidebarItem.admin.users.manageUsers": { + "defaultMessage": "사용자 관리" + }, + "course.courses.SidebarItem.assessmentSkills": { + "defaultMessage": "기술" + }, + "course.courses.SidebarItem.assessmentSubmissions": { + "defaultMessage": "제출물" + }, + "course.courses.SidebarItem.discussionTopics": { + "defaultMessage": "댓글 센터" + }, + "course.courses.SidebarItem.experiencePoints": { + "defaultMessage": "경험치" + }, "course.courses.SidebarItem.home": { "defaultMessage": "홈" }, + "course.courses.SidebarItem.stories.learn": { + "defaultMessage": "배우기" + }, + "course.courses.SidebarItem.stories.missionControl": { + "defaultMessage": "미션 컨트롤" + }, "course.courses.TodoIgnoreButton.ignore.ignoreButtonText": { "defaultMessage": "무시" }, diff --git a/client/locales/zh.json b/client/locales/zh.json index 08846a7363e..064501d8acd 100644 --- a/client/locales/zh.json +++ b/client/locales/zh.json @@ -4001,7 +4001,7 @@ "course.asssessment.submission.submitNoQuestionExplain": { "defaultMessage": "标记为完成?" }, - "course.component": { + "course.admin.NotificationSettings.component": { "defaultMessage": "组件" }, "course.componentTitles.course_achievements_component": { @@ -4013,15 +4013,66 @@ "course.componentTitles.course_assessments_component": { "defaultMessage": "测验" }, + "course.componentTitles.course_codaveri_component": { + "defaultMessage": "Codaveri 评估和反馈" + }, + "course.componentTitles.course_discussion_topics_component": { + "defaultMessage": "评论中心" + }, + "course.componentTitles.course_duplication_component": { + "defaultMessage": "复制" + }, + "course.componentTitles.course_experience_points_component": { + "defaultMessage": "经验值" + }, "course.componentTitles.course_forums_component": { "defaultMessage": "论坛" }, + "course.componentTitles.course_groups_component": { + "defaultMessage": "组" + }, + "course.componentTitles.course_koditsu_platform_component": { + "defaultMessage": "Koditsu 考试" + }, + "course.componentTitles.course_leaderboard_component": { + "defaultMessage": "排行榜" + }, + "course.componentTitles.course_learning_map_component": { + "defaultMessage": "学习路线" + }, + "course.componentTitles.course_lesson_plan_component": { + "defaultMessage": "课程计划" + }, "course.componentTitles.course_levels_component": { "defaultMessage": "等级" }, "course.componentTitles.course_materials_component": { "defaultMessage": "材料" }, + "course.componentTitles.course_monitoring_component": { + "defaultMessage": "监听" + }, + "course.componentTitles.course_multiple_reference_timelines_component": { + "defaultMessage": "多重参考时间线" + }, + "course.componentTitles.course_plagiarism_component": { + "defaultMessage": "SSID 抄袭检查" + }, + "course.componentTitles.course_rag_wise_component": { + "defaultMessage": "RagWise 自动论坛回复" + }, + "course.componentTitles.course_scholaistic_component": { + "defaultMessage": "角色扮演聊天机器人和评估" + }, + "course.componentTitles.course_settings_component": { + "defaultMessage": "设置" + }, + "course.componentTitles.course_statistics_component": { + "defaultMessage": "统计" + }, + "course.componentTitles.course_stories_component": { + "defaultMessage": "故事" + }, "course.componentTitles.course_survey_component": { "defaultMessage": "调查" }, @@ -4202,9 +4253,57 @@ "course.courses.Sidebar.administration": { "defaultMessage": "课程管理" }, + "course.courses.SidebarItem.admin.duplication": { + "defaultMessage": "复制数据" + }, + "course.courses.SidebarItem.admin.multipleReferenceTimelines": { + "defaultMessage": "时间线设计工具" + }, + "course.courses.SidebarItem.admin.plagiarism": { + "defaultMessage": "SSID 抄袭检查" + }, + "course.courses.SidebarItem.admin.scholaistic.assistants": { + "defaultMessage": "学习助手" + }, + "course.courses.SidebarItem.admin.settings": { + "defaultMessage": "课程设置" + }, + "course.courses.SidebarItem.admin.settings.components": { + "defaultMessage": "功能组件" + }, + "course.courses.SidebarItem.admin.settings.general": { + "defaultMessage": "通用" + }, + "course.courses.SidebarItem.admin.settings.notifications": { + "defaultMessage": "邮箱" + }, + "course.courses.SidebarItem.admin.settings.sidebar": { + "defaultMessage": "侧边栏" + }, + "course.courses.SidebarItem.admin.users.manageUsers": { + "defaultMessage": "管理用户" + }, + "course.courses.SidebarItem.assessmentSkills": { + "defaultMessage": "技能" + }, + "course.courses.SidebarItem.assessmentSubmissions": { + "defaultMessage": "提交" + }, + "course.courses.SidebarItem.discussionTopics": { + "defaultMessage": "评论中心" + }, + "course.courses.SidebarItem.experiencePoints": { + "defaultMessage": "经验值" + }, "course.courses.SidebarItem.home": { "defaultMessage": "主页" }, + "course.courses.SidebarItem.stories.learn": { + "defaultMessage": "学习" + }, + "course.courses.SidebarItem.stories.missionControl": { + "defaultMessage": "任务控制" + }, "course.courses.TodoIgnoreButton.ignore.ignoreButtonText": { "defaultMessage": "忽视" }, diff --git a/config/locales/en/activerecord/course/assessment/category.yml b/config/locales/en/activerecord/course/assessment/category.yml index 31179088ab5..e68ddd6b344 100644 --- a/config/locales/en/activerecord/course/assessment/category.yml +++ b/config/locales/en/activerecord/course/assessment/category.yml @@ -2,7 +2,7 @@ en: activerecord: attributes: course/assessment/category/title: - default: :'course.assessment.assessments.index.header' + default: 'Assessments' course/assessment/category: weight: 'Order' errors: diff --git a/config/locales/en/components.yml b/config/locales/en/components.yml deleted file mode 100644 index 2e917ff39ba..00000000000 --- a/config/locales/en/components.yml +++ /dev/null @@ -1,56 +0,0 @@ -en: - components: - announcements: - name: :'course.announcements.index.header' - achievements: - name: :'course.achievement.achievements.index.header' - lesson_plan: - name: :'course.lesson_plan.items.index.header' - assessments: - name: 'Assessments' - forums: - name: :'course.forum.forums.index.header' - groups: - name: :'course.groups.index.header' - levels: - name: :'course.levels.index.header' - leaderboard: - name: :'course.leaderboards.index.header' - materials: - name: :'course.material.sidebar_title' - discussion: - topics: - name: 'Comments Center' - statistics: - name: 'Statistics' - experience_points: - name: 'Experience Points' - duplication: - name: 'Duplication' - video: - name: :'course.video.videos.index.header' - settings: - name: 'Settings' - users: - name: 'Users' - surveys: - name: 'Surveys' - learning_map: - name: 'Learning Map' - codaveri: - name: 'Codaveri Evaluation and Feedback' - multiple_reference_timelines: - name: 'Multiple Reference Timelines' - monitoring: - name: 'Heartbeat Monitoring for Exams' - scholaistic: - name: 'Role-Playing Chatbots & Assessments' - manage_assistants: 'Assistants' - stories: - name: 'Stories' - koditsu_platform: - name: 'Koditsu Exam' - rag_wise: - name: 'RagWise Auto Forum Response' - plagiarism: - name: 'SSID Plagiarism Check' \ No newline at end of file diff --git a/config/locales/en/course/achievement/achievements.yml b/config/locales/en/course/achievement/achievements.yml deleted file mode 100644 index 0234a01f54e..00000000000 --- a/config/locales/en/course/achievement/achievements.yml +++ /dev/null @@ -1,7 +0,0 @@ -en: - course: - achievement: - achievements: - sidebar_title: :'course.achievement.achievements.index.header' - index: - header: 'Achievements' diff --git a/config/locales/en/course/announcements.yml b/config/locales/en/course/announcements.yml deleted file mode 100644 index e26e30d9058..00000000000 --- a/config/locales/en/course/announcements.yml +++ /dev/null @@ -1,6 +0,0 @@ -en: - course: - announcements: - sidebar_title: :'course.announcements.index.header' - index: - header: 'Announcements' diff --git a/config/locales/en/course/assessment/assessments.yml b/config/locales/en/course/assessment/assessments.yml index 2bd714b9bf6..5af72a174a2 100644 --- a/config/locales/en/course/assessment/assessments.yml +++ b/config/locales/en/course/assessment/assessments.yml @@ -3,9 +3,6 @@ en: assessment: assessments: invalid_questions_order: 'Invalid ordering for assessment questions' - sidebar_title: :'course.assessment.assessments.index.header' - index: - header: 'Assessments' show: public_test: 'Public' private_test: 'Private' diff --git a/config/locales/en/course/assessment/skills.yml b/config/locales/en/course/assessment/skills.yml deleted file mode 100644 index f6419ccd5d4..00000000000 --- a/config/locales/en/course/assessment/skills.yml +++ /dev/null @@ -1,7 +0,0 @@ -en: - course: - assessment: - skills: - sidebar_title: 'Skills' - index: - header: 'Skills' diff --git a/config/locales/en/course/assessment/submissions.yml b/config/locales/en/course/assessment/submissions.yml deleted file mode 100644 index b8a6f41a726..00000000000 --- a/config/locales/en/course/assessment/submissions.yml +++ /dev/null @@ -1,9 +0,0 @@ -en: - course: - assessment: - submissions: - sidebar_title: :'course.assessment.submissions.index.header' - index: - header: 'Submissions' - pending: - header: 'Pending Submissions' diff --git a/config/locales/en/course/discussion/topics.yml b/config/locales/en/course/discussion/topics.yml deleted file mode 100644 index c85701604da..00000000000 --- a/config/locales/en/course/discussion/topics.yml +++ /dev/null @@ -1,13 +0,0 @@ -en: - course: - discussion: - topics: - sidebar_title: :'course.discussion.topics.index.header' - index: - header: 'Comments' - pending: - header: :'course.discussion.topics.index.header' - my_students: - header: :'course.discussion.topics.index.header' - my_students_pending: - header: :'course.discussion.topics.index.header' diff --git a/config/locales/en/course/experience_points/disbursement.yml b/config/locales/en/course/experience_points/disbursement.yml deleted file mode 100644 index 8728af2331d..00000000000 --- a/config/locales/en/course/experience_points/disbursement.yml +++ /dev/null @@ -1,7 +0,0 @@ -en: - course: - experience_points: - disbursement: - sidebar_title: 'Experience Points' - new: - header: 'Disburse Experience Points' diff --git a/config/locales/en/course/experience_points/forum_disbursement.yml b/config/locales/en/course/experience_points/forum_disbursement.yml deleted file mode 100644 index 44aa7ba5a79..00000000000 --- a/config/locales/en/course/experience_points/forum_disbursement.yml +++ /dev/null @@ -1,6 +0,0 @@ -en: - course: - experience_points: - forum_disbursement: - new: - header: :'course.experience_points.disbursement.new.header' diff --git a/config/locales/en/course/experience_points_records.yml b/config/locales/en/course/experience_points_records.yml index 0f784bdb066..953ee69db25 100644 --- a/config/locales/en/course/experience_points_records.yml +++ b/config/locales/en/course/experience_points_records.yml @@ -1,8 +1,6 @@ en: course: experience_points_records: - index: - header: 'Experience Points History for %{name}' download: name: 'Name' updated_at: 'Updated At' diff --git a/config/locales/en/course/forum/forums.yml b/config/locales/en/course/forum/forums.yml deleted file mode 100644 index dc5536cdc59..00000000000 --- a/config/locales/en/course/forum/forums.yml +++ /dev/null @@ -1,7 +0,0 @@ -en: - course: - forum: - forums: - sidebar_title: 'Forums' - index: - header: 'Forums' diff --git a/config/locales/en/course/groups.yml b/config/locales/en/course/groups.yml deleted file mode 100644 index 345d16d1c5a..00000000000 --- a/config/locales/en/course/groups.yml +++ /dev/null @@ -1,12 +0,0 @@ -en: - course: - groups: - sidebar_title: :'course.group.group_categories.index.header' - index: - header: :'course.group.group_categories.index.header' - group: - group_categories: - index: - header: 'Groups' - show: - header: 'Groups' diff --git a/config/locales/en/course/leaderboards.yml b/config/locales/en/course/leaderboards.yml deleted file mode 100644 index b8ff2d85753..00000000000 --- a/config/locales/en/course/leaderboards.yml +++ /dev/null @@ -1,7 +0,0 @@ -en: - course: - leaderboards: - sidebar_title: :'course.leaderboards.index.header' - title: :'course.leaderboards.index.header' - index: - header: 'Leaderboard' diff --git a/config/locales/en/course/learning_map.yml b/config/locales/en/course/learning_map.yml deleted file mode 100644 index 3e6474871cf..00000000000 --- a/config/locales/en/course/learning_map.yml +++ /dev/null @@ -1,5 +0,0 @@ -en: - course: - learning_map: - index: - header: 'Learning Map' diff --git a/config/locales/en/course/lesson_plan/items.yml b/config/locales/en/course/lesson_plan/items.yml index 3e4ce95a8f9..8ef4f9577d2 100644 --- a/config/locales/en/course/lesson_plan/items.yml +++ b/config/locales/en/course/lesson_plan/items.yml @@ -1,10 +1,4 @@ en: - course: - lesson_plan: - items: - sidebar_title: :'course.lesson_plan.items.index.header' - index: - header: 'Lesson Plan' activerecord: attributes: course/lesson_plan/item: diff --git a/config/locales/en/course/levels.yml b/config/locales/en/course/levels.yml deleted file mode 100644 index eced2270c7e..00000000000 --- a/config/locales/en/course/levels.yml +++ /dev/null @@ -1,6 +0,0 @@ -en: - course: - levels: - sidebar_title: :'course.levels.index.header' - index: - header: 'Levels' diff --git a/config/locales/en/course/material/materials.yml b/config/locales/en/course/material/materials.yml deleted file mode 100644 index ece74dc36cf..00000000000 --- a/config/locales/en/course/material/materials.yml +++ /dev/null @@ -1,4 +0,0 @@ -en: - course: - material: - sidebar_title: 'Materials' diff --git a/config/locales/en/course/plagiarism.yml b/config/locales/en/course/plagiarism.yml deleted file mode 100644 index 637a71cfe3c..00000000000 --- a/config/locales/en/course/plagiarism.yml +++ /dev/null @@ -1,4 +0,0 @@ -en: - course: - plagiarism: - header: 'Plagiarism Check' diff --git a/config/locales/en/course/reference_timelines.yml b/config/locales/en/course/reference_timelines.yml deleted file mode 100644 index bf0d3d1674d..00000000000 --- a/config/locales/en/course/reference_timelines.yml +++ /dev/null @@ -1,5 +0,0 @@ -en: - course: - reference_timelines: - reference_timeline: - default_title: 'Default Timeline' diff --git a/config/locales/en/course/scholaistic.yml b/config/locales/en/course/scholaistic.yml deleted file mode 100644 index 877fae00575..00000000000 --- a/config/locales/en/course/scholaistic.yml +++ /dev/null @@ -1,4 +0,0 @@ -en: - course: - scholaistic: - assessments: "Role-Playing Assessments" diff --git a/config/locales/en/course/stories.yml b/config/locales/en/course/stories.yml deleted file mode 100644 index a49bf74c46c..00000000000 --- a/config/locales/en/course/stories.yml +++ /dev/null @@ -1,5 +0,0 @@ -en: - course: - stories: - learn: 'Learn' - mission_control: 'Mission Control' diff --git a/config/locales/en/course/surveys.yml b/config/locales/en/course/surveys.yml deleted file mode 100644 index 5bbc34e115a..00000000000 --- a/config/locales/en/course/surveys.yml +++ /dev/null @@ -1,4 +0,0 @@ -en: - course: - surveys: - sidebar_title: 'Surveys' diff --git a/config/locales/en/course/users.yml b/config/locales/en/course/users.yml index cde94ce90c5..fe3e893fe86 100644 --- a/config/locales/en/course/users.yml +++ b/config/locales/en/course/users.yml @@ -1,7 +1,6 @@ en: course: users: - sidebar_title: :'course.users.index.header' role: student: 'Student' teaching_assistant: 'Teaching Assistant' @@ -11,9 +10,4 @@ en: phantom: 'Phantom' new: already_registered: 'You are already registered as a %{role}.' - students: - header: 'Students' - staff: - header: 'Staff' - index: - header: 'Students' + diff --git a/config/locales/en/course/video/videos.yml b/config/locales/en/course/video/videos.yml deleted file mode 100644 index 03e436b3911..00000000000 --- a/config/locales/en/course/video/videos.yml +++ /dev/null @@ -1,7 +0,0 @@ -en: - course: - video: - videos: - sidebar_title: :'course.video.videos.index.header' - index: - header: 'Videos' diff --git a/config/locales/en/layout.yml b/config/locales/en/layout.yml index 6a2e019256e..d02f2ca5fa8 100644 --- a/config/locales/en/layout.yml +++ b/config/locales/en/layout.yml @@ -2,36 +2,10 @@ en: layout: coursemology: 'Coursemology' layouts: - course_admin: - title: 'Course Settings' - course_settings: - title: 'General' - announcement_settings: - title: :'course.announcements.index.header' - component_settings: - title: 'Components' - sidebar_settings: - title: 'Sidebar' - notifications: - title: 'Email' - lesson_plan: - title: 'Lesson Plan' - codaveri: - title: 'Codaveri Evaluation and Feedback' - rag_wise: - title: 'RagWise Auto Forum Response' - course_users: - title: 'Manage Users' - duplication: - title: 'Duplicate Data' mailer: greeting: 'Hello, %{user}:' code_formatter: size_too_big: 'The file is too big and cannot be displayed.' - learning_map: - title: 'Learning Map' - multiple_reference_timelines: - timeline_designer: 'Timeline Designer' manage_email_subscription: tag: 'Unsubscribe' message: '%{manage_email_subscription_link} from this email topic.' diff --git a/config/locales/en/user/emails.yml b/config/locales/en/user/emails.yml index 5e7a2469847..e653759e92d 100644 --- a/config/locales/en/user/emails.yml +++ b/config/locales/en/user/emails.yml @@ -1,8 +1,6 @@ en: user: emails: - index: - header: 'Emails' set_primary: no_confirmed_emails: 'There are no confirmed emails to set as the primary email.' send_confirmation: diff --git a/config/locales/ko/activerecord/course/assessment/category.yml b/config/locales/ko/activerecord/course/assessment/category.yml index 60ece1b0ac0..804a2e5dc7b 100644 --- a/config/locales/ko/activerecord/course/assessment/category.yml +++ b/config/locales/ko/activerecord/course/assessment/category.yml @@ -2,7 +2,7 @@ ko: activerecord: attributes: course/assessment/category/title: - default: :'course.assessment.assessments.index.header' + default: '평가' course/assessment/category: weight: '순서' errors: diff --git a/config/locales/ko/components.yml b/config/locales/ko/components.yml deleted file mode 100644 index 4a11a0e74bd..00000000000 --- a/config/locales/ko/components.yml +++ /dev/null @@ -1,56 +0,0 @@ -ko: - components: - announcements: - name: :'course.announcements.index.header' - achievements: - name: :'course.achievement.achievements.index.header' - lesson_plan: - name: :'course.lesson_plan.items.index.header' - assessments: - name: '평가' - forums: - name: :'course.forum.forums.index.header' - groups: - name: :'course.groups.index.header' - levels: - name: :'course.levels.index.header' - leaderboard: - name: :'course.leaderboards.index.header' - materials: - name: :'course.material.sidebar_title' - discussion: - topics: - name: '댓글 센터' - statistics: - name: '통계' - experience_points: - name: '경험치' - duplication: - name: '복제' - video: - name: :'course.video.videos.index.header' - settings: - name: '설정' - users: - name: '사용자' - surveys: - name: '설문' - learning_map: - name: '학습 지도' - codaveri: - name: 'Codaveri 평가 및 피드백' - multiple_reference_timelines: - name: '다중 참조 타임라인' - monitoring: - name: '시험 모니터링' - scholaistic: - name: '롤플레잉 챗봇 및 평가' - manage_assistants: '학습 조수' - stories: - name: '이야기' - koditsu_platform: - name: 'Koditsu 시험' - rag_wise: - name: 'RagWise 자동 포럼 응답' - plagiarism: - name: 'SSID 표절 검사' diff --git a/config/locales/ko/course/achievement/achievements.yml b/config/locales/ko/course/achievement/achievements.yml deleted file mode 100644 index e8d821eb276..00000000000 --- a/config/locales/ko/course/achievement/achievements.yml +++ /dev/null @@ -1,7 +0,0 @@ -ko: - course: - achievement: - achievements: - sidebar_title: :'course.achievement.achievements.index.header' - index: - header: '성과' diff --git a/config/locales/ko/course/announcements.yml b/config/locales/ko/course/announcements.yml deleted file mode 100644 index 1d9a1aeec95..00000000000 --- a/config/locales/ko/course/announcements.yml +++ /dev/null @@ -1,6 +0,0 @@ -ko: - course: - announcements: - sidebar_title: :'course.announcements.index.header' - index: - header: '공지사항' diff --git a/config/locales/ko/course/assessment/assessments.yml b/config/locales/ko/course/assessment/assessments.yml index 1551ed9c468..aec245e5ec3 100644 --- a/config/locales/ko/course/assessment/assessments.yml +++ b/config/locales/ko/course/assessment/assessments.yml @@ -3,9 +3,6 @@ ko: assessment: assessments: invalid_questions_order: '평가 질문의 순서가 잘못되었습니다' - sidebar_title: :'course.assessment.assessments.index.header' - index: - header: '평가' show: public_test: '공개' private_test: '비공개' diff --git a/config/locales/ko/course/assessment/skills.yml b/config/locales/ko/course/assessment/skills.yml deleted file mode 100644 index 3674ea608e9..00000000000 --- a/config/locales/ko/course/assessment/skills.yml +++ /dev/null @@ -1,7 +0,0 @@ -ko: - course: - assessment: - skills: - sidebar_title: '기술' - index: - header: '기술' diff --git a/config/locales/ko/course/assessment/submissions.yml b/config/locales/ko/course/assessment/submissions.yml deleted file mode 100644 index f970f6cac56..00000000000 --- a/config/locales/ko/course/assessment/submissions.yml +++ /dev/null @@ -1,9 +0,0 @@ -ko: - course: - assessment: - submissions: - sidebar_title: :'course.assessment.submissions.index.header' - index: - header: '제출물' - pending: - header: '대기 중인 제출물' diff --git a/config/locales/ko/course/discussion/topics.yml b/config/locales/ko/course/discussion/topics.yml deleted file mode 100644 index 229d62d0668..00000000000 --- a/config/locales/ko/course/discussion/topics.yml +++ /dev/null @@ -1,13 +0,0 @@ -ko: - course: - discussion: - topics: - sidebar_title: :'course.discussion.topics.index.header' - index: - header: '댓글' - pending: - header: :'course.discussion.topics.index.header' - my_students: - header: :'course.discussion.topics.index.header' - my_students_pending: - header: :'course.discussion.topics.index.header' diff --git a/config/locales/ko/course/experience_points/disbursement.yml b/config/locales/ko/course/experience_points/disbursement.yml deleted file mode 100644 index d54b5a4ae68..00000000000 --- a/config/locales/ko/course/experience_points/disbursement.yml +++ /dev/null @@ -1,7 +0,0 @@ -ko: - course: - experience_points: - disbursement: - sidebar_title: '경험치' - new: - header: '경험 포인트 지급' diff --git a/config/locales/ko/course/experience_points/forum_disbursement.yml b/config/locales/ko/course/experience_points/forum_disbursement.yml deleted file mode 100644 index a61a94d5a41..00000000000 --- a/config/locales/ko/course/experience_points/forum_disbursement.yml +++ /dev/null @@ -1,6 +0,0 @@ -ko: - course: - experience_points: - forum_disbursement: - new: - header: :'course.experience_points.disbursement.new.header' diff --git a/config/locales/ko/course/experience_points_records.yml b/config/locales/ko/course/experience_points_records.yml index 98189707dcc..1d51422bab3 100644 --- a/config/locales/ko/course/experience_points_records.yml +++ b/config/locales/ko/course/experience_points_records.yml @@ -1,8 +1,6 @@ ko: course: experience_points_records: - index: - header: '%{name}의 경험치 기록' download: name: '이름' updated_at: '업데이트 날짜' diff --git a/config/locales/ko/course/forum/forums.yml b/config/locales/ko/course/forum/forums.yml deleted file mode 100644 index f132a3df945..00000000000 --- a/config/locales/ko/course/forum/forums.yml +++ /dev/null @@ -1,7 +0,0 @@ -ko: - course: - forum: - forums: - sidebar_title: '포럼' - index: - header: '포럼' diff --git a/config/locales/ko/course/groups.yml b/config/locales/ko/course/groups.yml deleted file mode 100644 index 2b7717755d3..00000000000 --- a/config/locales/ko/course/groups.yml +++ /dev/null @@ -1,12 +0,0 @@ -ko: - course: - groups: - sidebar_title: :'course.group.group_categories.index.header' - index: - header: :'course.group.group_categories.index.header' - group: - group_categories: - index: - header: '그룹' - show: - header: '그룹' diff --git a/config/locales/ko/course/leaderboards.yml b/config/locales/ko/course/leaderboards.yml deleted file mode 100644 index 89fd1afe361..00000000000 --- a/config/locales/ko/course/leaderboards.yml +++ /dev/null @@ -1,7 +0,0 @@ -ko: - course: - leaderboards: - sidebar_title: :'course.leaderboards.index.header' - title: :'course.leaderboards.index.header' - index: - header: '리더보드' diff --git a/config/locales/ko/course/learning_map.yml b/config/locales/ko/course/learning_map.yml deleted file mode 100644 index 6cb94f48062..00000000000 --- a/config/locales/ko/course/learning_map.yml +++ /dev/null @@ -1,5 +0,0 @@ -ko: - course: - learning_map: - index: - header: '학습 지도' diff --git a/config/locales/ko/course/lesson_plan/items.yml b/config/locales/ko/course/lesson_plan/items.yml index 76019621143..45c7e34b0de 100644 --- a/config/locales/ko/course/lesson_plan/items.yml +++ b/config/locales/ko/course/lesson_plan/items.yml @@ -1,10 +1,4 @@ ko: - course: - lesson_plan: - items: - sidebar_title: :'course.lesson_plan.items.index.header' - index: - header: '수업 계획' activerecord: attributes: course/lesson_plan/item: diff --git a/config/locales/ko/course/levels.yml b/config/locales/ko/course/levels.yml deleted file mode 100644 index 5e2478e7435..00000000000 --- a/config/locales/ko/course/levels.yml +++ /dev/null @@ -1,6 +0,0 @@ -ko: - course: - levels: - sidebar_title: :'course.levels.index.header' - index: - header: '레벨' diff --git a/config/locales/ko/course/material/materials.yml b/config/locales/ko/course/material/materials.yml deleted file mode 100644 index b8b3ba64d30..00000000000 --- a/config/locales/ko/course/material/materials.yml +++ /dev/null @@ -1,4 +0,0 @@ -ko: - course: - material: - sidebar_title: '자료' diff --git a/config/locales/ko/course/plagiarism.yml b/config/locales/ko/course/plagiarism.yml deleted file mode 100644 index 96579cc8630..00000000000 --- a/config/locales/ko/course/plagiarism.yml +++ /dev/null @@ -1,4 +0,0 @@ -ko: - course: - plagiarism: - header: '표절 검사' diff --git a/config/locales/ko/course/reference_timelines.yml b/config/locales/ko/course/reference_timelines.yml deleted file mode 100644 index 035af096296..00000000000 --- a/config/locales/ko/course/reference_timelines.yml +++ /dev/null @@ -1,5 +0,0 @@ -ko: - course: - reference_timelines: - reference_timeline: - default_title: '기본 타임라인' diff --git a/config/locales/ko/course/scholaistic.yml b/config/locales/ko/course/scholaistic.yml deleted file mode 100644 index 8271e0ed60f..00000000000 --- a/config/locales/ko/course/scholaistic.yml +++ /dev/null @@ -1,4 +0,0 @@ -ko: - course: - scholaistic: - assessments: "롤플레잉 평가" diff --git a/config/locales/ko/course/stories.yml b/config/locales/ko/course/stories.yml deleted file mode 100644 index c459eb1ce09..00000000000 --- a/config/locales/ko/course/stories.yml +++ /dev/null @@ -1,5 +0,0 @@ -ko: - course: - stories: - learn: '배우다' - mission_control: '미션 컨트롤' diff --git a/config/locales/ko/course/surveys.yml b/config/locales/ko/course/surveys.yml deleted file mode 100644 index be73b742ba1..00000000000 --- a/config/locales/ko/course/surveys.yml +++ /dev/null @@ -1,4 +0,0 @@ -ko: - course: - surveys: - sidebar_title: '설문' diff --git a/config/locales/ko/course/users.yml b/config/locales/ko/course/users.yml index 9da568388a0..50d5ec133f1 100644 --- a/config/locales/ko/course/users.yml +++ b/config/locales/ko/course/users.yml @@ -1,7 +1,6 @@ ko: course: users: - sidebar_title: :'course.users.index.header' role: student: '학생' teaching_assistant: '조교' @@ -11,9 +10,3 @@ ko: phantom: '팬텀' new: already_registered: '당신은 이미 %{role}(으)로 등록되어 있습니다.' - students: - header: '학생들' - staff: - header: '직원' - index: - header: '학생들' diff --git a/config/locales/ko/course/video/videos.yml b/config/locales/ko/course/video/videos.yml deleted file mode 100644 index 3d68aa0f1c1..00000000000 --- a/config/locales/ko/course/video/videos.yml +++ /dev/null @@ -1,7 +0,0 @@ -ko: - course: - video: - videos: - sidebar_title: :'course.video.videos.index.header' - index: - header: '비디오' diff --git a/config/locales/ko/layout.yml b/config/locales/ko/layout.yml index 7ab47d14021..2cf414a73a7 100644 --- a/config/locales/ko/layout.yml +++ b/config/locales/ko/layout.yml @@ -2,36 +2,10 @@ ko: layout: coursemology: 'Coursemology' layouts: - course_admin: - title: '코스 설정' - course_settings: - title: '일반' - announcement_settings: - title: :'course.announcements.index.header' - component_settings: - title: '구성 요소' - sidebar_settings: - title: '사이드바' - notifications: - title: '이메일' - lesson_plan: - title: '수업 계획' - codaveri: - title: 'Codaveri 평가 및 피드백' - rag_wise: - title: 'RagWise 자동 포럼 응답' - course_users: - title: '사용자 관리' - duplication: - title: '데이터 복제' mailer: greeting: '안녕하세요, %{user}:' code_formatter: size_too_big: '파일이 너무 커서 표시할 수 없습니다.' - learning_map: - title: '학습 지도' - multiple_reference_timelines: - timeline_designer: '타임라인 디자이너' manage_email_subscription: tag: '구독 취소' message: '%{manage_email_subscription_link} 이 이메일 주제에서 구독을 취소합니다.' diff --git a/config/locales/ko/user/emails.yml b/config/locales/ko/user/emails.yml index 7dab3b9c37a..a1aa65dd4b7 100644 --- a/config/locales/ko/user/emails.yml +++ b/config/locales/ko/user/emails.yml @@ -1,8 +1,6 @@ ko: user: emails: - index: - header: '이메일' set_primary: no_confirmed_emails: '기본 이메일로 설정할 수 있는 확인된 이메일 주소가 없습니다.' send_confirmation: diff --git a/config/locales/zh/activerecord/course/assessment/category.yml b/config/locales/zh/activerecord/course/assessment/category.yml index e3196d57181..b24aa471247 100644 --- a/config/locales/zh/activerecord/course/assessment/category.yml +++ b/config/locales/zh/activerecord/course/assessment/category.yml @@ -2,7 +2,7 @@ zh: activerecord: attributes: course/assessment/category/title: - default: :'course.assessment.assessments.index.header' + default: '评估' course/assessment/category: weight: '权重' errors: diff --git a/config/locales/zh/components.yml b/config/locales/zh/components.yml deleted file mode 100644 index 8defcf8e84a..00000000000 --- a/config/locales/zh/components.yml +++ /dev/null @@ -1,56 +0,0 @@ -zh: - components: - announcements: - name: :'course.announcements.index.header' - achievements: - name: :'course.achievement.achievements.index.header' - lesson_plan: - name: :'course.lesson_plan.items.index.header' - assessments: - name: '测验' - forums: - name: :'course.forum.forums.index.header' - groups: - name: :'course.groups.index.header' - levels: - name: :'course.levels.index.header' - leaderboard: - name: :'course.leaderboards.index.header' - materials: - name: :'course.material.sidebar_title' - discussion: - topics: - name: '评论中心' - statistics: - name: '统计' - experience_points: - name: '经验值' - duplication: - name: '复制' - video: - name: :'course.video.videos.index.header' - settings: - name: '设置' - users: - name: '用户' - surveys: - name: '调查' - learning_map: - name: '学习路线' - codaveri: - name: 'Codaveri 评估和反馈' - multiple_reference_timelines: - name: '多重参考时间线' - monitoring: - name: '监听' - scholaistic: - name: '角色扮演聊天机器人和评估' - manage_assistants: '学习助手' - stories: - name: '故事' - koditsu_platform: - name: 'Koditsu 考试' - rag_wise: - name: 'RagWise 自动论坛回复' - plagiarism: - name: 'SSID 抄袭检查' diff --git a/config/locales/zh/course/achievement/achievements.yml b/config/locales/zh/course/achievement/achievements.yml deleted file mode 100644 index 7ed290a7070..00000000000 --- a/config/locales/zh/course/achievement/achievements.yml +++ /dev/null @@ -1,7 +0,0 @@ -zh: - course: - achievement: - achievements: - sidebar_title: :'course.achievement.achievements.index.header' - index: - header: '成就' diff --git a/config/locales/zh/course/announcements.yml b/config/locales/zh/course/announcements.yml deleted file mode 100644 index 8883fe20eb8..00000000000 --- a/config/locales/zh/course/announcements.yml +++ /dev/null @@ -1,6 +0,0 @@ -zh: - course: - announcements: - sidebar_title: :'course.announcements.index.header' - index: - header: '公告' diff --git a/config/locales/zh/course/assessment/assessments.yml b/config/locales/zh/course/assessment/assessments.yml index 3a7f5e78c53..de0b696d652 100644 --- a/config/locales/zh/course/assessment/assessments.yml +++ b/config/locales/zh/course/assessment/assessments.yml @@ -3,9 +3,6 @@ zh: assessment: assessments: invalid_questions_order: '测验问题的权重无效' - sidebar_title: :'course.assessment.assessments.index.header' - index: - header: '测验' show: public_test: '公开' private_test: '私有' diff --git a/config/locales/zh/course/assessment/skills.yml b/config/locales/zh/course/assessment/skills.yml deleted file mode 100644 index 0cef45bd036..00000000000 --- a/config/locales/zh/course/assessment/skills.yml +++ /dev/null @@ -1,7 +0,0 @@ -zh: - course: - assessment: - skills: - sidebar_title: '技能' - index: - header: '技能' diff --git a/config/locales/zh/course/assessment/submissions.yml b/config/locales/zh/course/assessment/submissions.yml deleted file mode 100644 index 263cd77dc6a..00000000000 --- a/config/locales/zh/course/assessment/submissions.yml +++ /dev/null @@ -1,9 +0,0 @@ -zh: - course: - assessment: - submissions: - sidebar_title: :'course.assessment.submissions.index.header' - index: - header: '提交' - pending: - header: '等待中的提交' diff --git a/config/locales/zh/course/discussion/topics.yml b/config/locales/zh/course/discussion/topics.yml deleted file mode 100644 index b1ef7136386..00000000000 --- a/config/locales/zh/course/discussion/topics.yml +++ /dev/null @@ -1,13 +0,0 @@ -zh: - course: - discussion: - topics: - sidebar_title: :'course.discussion.topics.index.header' - index: - header: '评论' - pending: - header: :'course.discussion.topics.index.header' - my_students: - header: :'course.discussion.topics.index.header' - my_students_pending: - header: :'course.discussion.topics.index.header' diff --git a/config/locales/zh/course/experience_points/disbursement.yml b/config/locales/zh/course/experience_points/disbursement.yml deleted file mode 100644 index 21e50b7d1d1..00000000000 --- a/config/locales/zh/course/experience_points/disbursement.yml +++ /dev/null @@ -1,7 +0,0 @@ -zh: - course: - experience_points: - disbursement: - sidebar_title: '经验值发放' - new: - header: '发放经验值' diff --git a/config/locales/zh/course/experience_points/forum_disbursement.yml b/config/locales/zh/course/experience_points/forum_disbursement.yml deleted file mode 100644 index c14a0713005..00000000000 --- a/config/locales/zh/course/experience_points/forum_disbursement.yml +++ /dev/null @@ -1,6 +0,0 @@ -zh: - course: - experience_points: - forum_disbursement: - new: - header: :'course.experience_points.disbursement.new.header' diff --git a/config/locales/zh/course/experience_points_records.yml b/config/locales/zh/course/experience_points_records.yml index b718f7de0d3..a14fa1ad5c1 100644 --- a/config/locales/zh/course/experience_points_records.yml +++ b/config/locales/zh/course/experience_points_records.yml @@ -1,8 +1,6 @@ zh: course: experience_points_records: - index: - header: '用户%{name}:经验值历史记录' download: name: '姓名' updated_at: '更新于' diff --git a/config/locales/zh/course/forum/forums.yml b/config/locales/zh/course/forum/forums.yml deleted file mode 100644 index 26c1698a4ac..00000000000 --- a/config/locales/zh/course/forum/forums.yml +++ /dev/null @@ -1,7 +0,0 @@ -zh: - course: - forum: - forums: - sidebar_title: '论坛' - index: - header: '论坛' diff --git a/config/locales/zh/course/groups.yml b/config/locales/zh/course/groups.yml deleted file mode 100644 index 2b3a564304f..00000000000 --- a/config/locales/zh/course/groups.yml +++ /dev/null @@ -1,12 +0,0 @@ -zh: - course: - groups: - sidebar_title: :'course.group.group_categories.index.header' - index: - header: :'course.group.group_categories.index.header' - group: - group_categories: - index: - header: '分组' - show: - header: '分组' diff --git a/config/locales/zh/course/leaderboards.yml b/config/locales/zh/course/leaderboards.yml deleted file mode 100644 index a6b473b0d9f..00000000000 --- a/config/locales/zh/course/leaderboards.yml +++ /dev/null @@ -1,7 +0,0 @@ -zh: - course: - leaderboards: - sidebar_title: :'course.leaderboards.index.header' - title: :'course.leaderboards.index.header' - index: - header: '排行榜' diff --git a/config/locales/zh/course/learning_map.yml b/config/locales/zh/course/learning_map.yml deleted file mode 100644 index df827ce7bb4..00000000000 --- a/config/locales/zh/course/learning_map.yml +++ /dev/null @@ -1,6 +0,0 @@ -zh: - course: - learning_map: - index: - header: '学习路线' - diff --git a/config/locales/zh/course/lesson_plan/items.yml b/config/locales/zh/course/lesson_plan/items.yml index 27e7d218ea7..3799e917899 100644 --- a/config/locales/zh/course/lesson_plan/items.yml +++ b/config/locales/zh/course/lesson_plan/items.yml @@ -1,10 +1,4 @@ zh: - course: - lesson_plan: - items: - sidebar_title: :'course.lesson_plan.items.index.header' - index: - header: '课程计划' activerecord: attributes: course/lesson_plan/item: diff --git a/config/locales/zh/course/levels.yml b/config/locales/zh/course/levels.yml deleted file mode 100644 index 27fa0d579f8..00000000000 --- a/config/locales/zh/course/levels.yml +++ /dev/null @@ -1,7 +0,0 @@ -zh: - course: - levels: - sidebar_title: :'course.levels.index.header' - index: - header: '等级' - diff --git a/config/locales/zh/course/material/materials.yml b/config/locales/zh/course/material/materials.yml deleted file mode 100644 index b7133916321..00000000000 --- a/config/locales/zh/course/material/materials.yml +++ /dev/null @@ -1,4 +0,0 @@ -zh: - course: - material: - sidebar_title: '材料' diff --git a/config/locales/zh/course/plagiarism.yml b/config/locales/zh/course/plagiarism.yml deleted file mode 100644 index 6cca8befdb1..00000000000 --- a/config/locales/zh/course/plagiarism.yml +++ /dev/null @@ -1,4 +0,0 @@ -zh: - course: - plagiarism: - header: '抄袭检查' diff --git a/config/locales/zh/course/reference_timelines.yml b/config/locales/zh/course/reference_timelines.yml deleted file mode 100644 index adb0f7175ce..00000000000 --- a/config/locales/zh/course/reference_timelines.yml +++ /dev/null @@ -1,5 +0,0 @@ -zh: - course: - reference_timelines: - reference_timeline: - default_title: '默认时间线' diff --git a/config/locales/zh/course/scholaistic.yml b/config/locales/zh/course/scholaistic.yml deleted file mode 100644 index 28af39c13d6..00000000000 --- a/config/locales/zh/course/scholaistic.yml +++ /dev/null @@ -1,4 +0,0 @@ -zh: - course: - scholaistic: - assessments: "角色扮演评估" diff --git a/config/locales/zh/course/stories.yml b/config/locales/zh/course/stories.yml deleted file mode 100644 index ea465a8c0db..00000000000 --- a/config/locales/zh/course/stories.yml +++ /dev/null @@ -1,5 +0,0 @@ -zh: - course: - stories: - learn: '学' - mission_control: '任务控制' diff --git a/config/locales/zh/course/surveys.yml b/config/locales/zh/course/surveys.yml deleted file mode 100644 index c83f978f32e..00000000000 --- a/config/locales/zh/course/surveys.yml +++ /dev/null @@ -1,4 +0,0 @@ -zh: - course: - surveys: - sidebar_title: '调查' diff --git a/config/locales/zh/course/users.yml b/config/locales/zh/course/users.yml index fd211889430..cfe1ff9f2d3 100644 --- a/config/locales/zh/course/users.yml +++ b/config/locales/zh/course/users.yml @@ -1,7 +1,6 @@ zh: course: users: - sidebar_title: :'course.users.index.header' role: student: '学生' teaching_assistant: '助教' @@ -11,9 +10,3 @@ zh: phantom: '虚拟用户' new: already_registered: '你已注册为%{role}。' - students: - header: '学生' - staff: - header: '员工' - index: - header: '学生' diff --git a/config/locales/zh/course/video/videos.yml b/config/locales/zh/course/video/videos.yml deleted file mode 100644 index df39ff22abb..00000000000 --- a/config/locales/zh/course/video/videos.yml +++ /dev/null @@ -1,7 +0,0 @@ -zh: - course: - video: - videos: - sidebar_title: :'course.video.videos.index.header' - index: - header: '视频' diff --git a/config/locales/zh/layout.yml b/config/locales/zh/layout.yml index a32e0a663ed..4c460906839 100644 --- a/config/locales/zh/layout.yml +++ b/config/locales/zh/layout.yml @@ -2,36 +2,10 @@ zh: layout: coursemology: 'Coursemology' layouts: - course_admin: - title: '课程设置' - course_settings: - title: '通用' - announcement_settings: - title: :'course.announcements.index.header' - component_settings: - title: '功能组件' - sidebar_settings: - title: '侧边栏' - notifications: - title: '邮箱' - lesson_plan: - title: '课程计划' - codaveri: - title: 'Codaveri评估和反馈' - rag_wise: - title: 'RagWise 自动论坛回复' - course_users: - title: '管理用户' - duplication: - title: '复制数据' mailer: - greeting: '你好, %{user}:' + greeting: '您好,%{user}:' code_formatter: - size_too_big: '该文件太大,无法显示。' - learning_map: - title: '学习计划' - multiple_reference_timelines: - timeline_designer: '时间线设计工具' + size_too_big: '文件过大,无法显示。' manage_email_subscription: tag: '取消订阅' - message: '%{manage_email_subscription_link} 以不再关注该电子邮件主题。' + message: '%{manage_email_subscription_link} 从此电子邮件主题取消订阅。' diff --git a/config/locales/zh/user/emails.yml b/config/locales/zh/user/emails.yml index 5f774cabe34..77453e8ebb1 100644 --- a/config/locales/zh/user/emails.yml +++ b/config/locales/zh/user/emails.yml @@ -1,8 +1,6 @@ zh: user: emails: - index: - header: '邮箱' set_primary: no_confirmed_emails: '没有已验证的邮箱地址可以设置为主要邮箱。' send_confirmation: diff --git a/spec/controllers/course/admin/sidebar_settings_controller_spec.rb b/spec/controllers/course/admin/sidebar_settings_controller_spec.rb index fd59fe19e96..402f9635599 100644 --- a/spec/controllers/course/admin/sidebar_settings_controller_spec.rb +++ b/spec/controllers/course/admin/sidebar_settings_controller_spec.rb @@ -18,7 +18,6 @@ let(:sample_item) { controller.sidebar_items(type: :normal).sample } let(:weight) { 10 } let(:sidebar_item_attributes) do - id = generate(:nested_attribute_new_id) sidebar_item_attributes = [{ id: sample_item[:key], weight: weight }] { sidebar_items_attributes: sidebar_item_attributes } end diff --git a/spec/controllers/course/controller_spec.rb b/spec/controllers/course/controller_spec.rb index 65c36bdc376..c19a682bf7a 100644 --- a/spec/controllers/course/controller_spec.rb +++ b/spec/controllers/course/controller_spec.rb @@ -71,11 +71,11 @@ def publicly_accessible? end it 'orders sidebar items with the same weight by ascending key' do - allow(controller).to receive(:sidebar_items_weights).and_return(Hash.new(1)) - - keys = controller.sidebar_items.map { |item| item[:key] } - expect(keys.length).not_to eq(0) - expect(keys.each_cons(2).all? { |a, b| a.to_s <= b.to_s }).to be_truthy + key_sets = controller.sidebar_items.group_by { |item| item[:weight] } + expect(key_sets.length).not_to eq(0) + expect( + key_sets.map { |_, set| set.each_cons(2).all? { |a, b| a[:key].to_s <= b[:key].to_s } } + ).to all(be_truthy) end context 'when no type is specified' do diff --git a/spec/controllers/course/lesson_plan/items_controller_spec.rb b/spec/controllers/course/lesson_plan/items_controller_spec.rb index b998bc16840..5cf7ffcd7bf 100644 --- a/spec/controllers/course/lesson_plan/items_controller_spec.rb +++ b/spec/controllers/course/lesson_plan/items_controller_spec.rb @@ -66,7 +66,7 @@ subject expect(json_response['items'].map { |i| i['lesson_plan_item_type'][0] }). - to include(I18n.t('components.video.name')) + to include(Course::VideosComponent.key.to_s) end end @@ -113,7 +113,7 @@ expect(json_response['items']).not_to be_empty expect(json_response['items'].map { |i| i['lesson_plan_item_type'][0] }). - not_to include(I18n.t('components.video.name')) + not_to include(Course::VideosComponent.key.to_s) end end end diff --git a/spec/features/course/achievement_listing_spec.rb b/spec/features/course/achievement_listing_spec.rb index 98eac3f5b8c..80472c71294 100644 --- a/spec/features/course/achievement_listing_spec.rb +++ b/spec/features/course/achievement_listing_spec.rb @@ -62,7 +62,7 @@ scenario 'I can view the Achievement Sidebar item' do visit course_path(course) - expect(find_sidebar).to have_text(I18n.t('course.achievement.achievements.sidebar_title')) + expect(find_sidebar).to have_selector('#sidebar_item_achievements') end scenario 'I can view all users who have obtained an achievement' do diff --git a/spec/features/course/admin/admin_spec.rb b/spec/features/course/admin/admin_spec.rb index 15d52370420..93775eb2f7b 100644 --- a/spec/features/course/admin/admin_spec.rb +++ b/spec/features/course/admin/admin_spec.rb @@ -16,7 +16,7 @@ scenario 'I can view the Course Admin Sidebar item' do visit course_path(course) - expect(find_sidebar).to have_text(I18n.t('layouts.course_admin.title')) + expect(find_sidebar).to have_selector('#sidebar_item_admin_settings') end scenario 'I can change the course attributes' do @@ -97,7 +97,7 @@ scenario 'I can view the Course Admin Sidebar item' do visit course_path(course) - expect(find_sidebar).to have_text(I18n.t('layouts.course_admin.title')) + expect(find_sidebar).to have_selector('#sidebar_item_admin_settings') end scenario 'I cannot delete the course' do @@ -113,7 +113,7 @@ scenario 'I cannot view the Course Admin Sidebar item' do visit course_path(course) - expect(find_sidebar).not_to have_text(I18n.t('layouts.course_admin.title')) + expect(find_sidebar).not_to have_selector('#sidebar_item_admin_settings') end end @@ -123,7 +123,7 @@ scenario 'I cannot view the Course Admin Sidebar item' do visit course_path(course) - expect(find_sidebar).not_to have_text(I18n.t('layouts.course_admin.title')) + expect(find_sidebar).not_to have_selector('#sidebar_item_admin_settings') end end end diff --git a/spec/features/course/admin/announcement_settings_spec.rb b/spec/features/course/admin/announcement_settings_spec.rb index 3ee176f3d85..020fcebb864 100644 --- a/spec/features/course/admin/announcement_settings_spec.rb +++ b/spec/features/course/admin/announcement_settings_spec.rb @@ -27,7 +27,7 @@ # Refresh page to update sidebar visit current_path - expect(find_sidebar).to have_text(new_title) + expect(find_sidebar).to have_selector('#sidebar_item_announcements', text: new_title) fill_in title_field, with: empty_title click_button 'Save changes' @@ -35,7 +35,7 @@ # Refresh page to update sidebar visit current_path - expect(find_sidebar).to have_text(I18n.t('course.announcements.sidebar_title')) + expect(find_sidebar).to have_selector('#sidebar_item_announcements') end end end diff --git a/spec/features/course/admin/component_settings_spec.rb b/spec/features/course/admin/component_settings_spec.rb index 3461b198508..ada46c87180 100644 --- a/spec/features/course/admin/component_settings_spec.rb +++ b/spec/features/course/admin/component_settings_spec.rb @@ -27,10 +27,11 @@ scenario 'I can view the list of enabled/disabled components' do visit course_admin_components_path(course) + sleep 300 components.each do |component| - expect(page).to have_selector('label', text: component.display_name) - within find('label', text: component.display_name) do + expect(page).to have_selector("label#component_#{component.key}") + within find("label#component_#{component.key}") do if enabled_components.include?(component) expect(page).to have_field(type: 'checkbox', checked: true, visible: false) else @@ -44,7 +45,7 @@ visit course_admin_components_path(course) sample_component = components.intersection(enabled_components).sample - control = find('label', text: sample_component.display_name) + control = find("label#component_#{sample_component.key}") control.click expect_toastify('Your changes have been saved. Refresh to see the new changes.', dismiss: true) diff --git a/spec/features/course/admin/discussion/topic_settings_spec.rb b/spec/features/course/admin/discussion/topic_settings_spec.rb index 26684a88561..7632206aa6b 100644 --- a/spec/features/course/admin/discussion/topic_settings_spec.rb +++ b/spec/features/course/admin/discussion/topic_settings_spec.rb @@ -42,13 +42,13 @@ expect(page).to have_field(title_field, with: new_title) visit current_path - expect(find_sidebar).to have_text(new_title) + expect(find_sidebar).to have_selector('#sidebar_item_discussion_topics', text: new_title) fill_in title_field, with: empty_title click_button 'Save changes' expect_toastify('Your changes have been saved.') visit current_path - expect(find_sidebar).to have_text(I18n.t('course.discussion.topics.sidebar_title')) + expect(find_sidebar).to have_selector('#sidebar_item_discussion_topics') end end end diff --git a/spec/features/course/admin/forum_settings_spec.rb b/spec/features/course/admin/forum_settings_spec.rb index d6ebea74e69..4763b9b8814 100644 --- a/spec/features/course/admin/forum_settings_spec.rb +++ b/spec/features/course/admin/forum_settings_spec.rb @@ -25,7 +25,7 @@ expect(course.reload.settings(:course_forums_component).title).to eq(new_title) visit current_path - expect(find_sidebar).to have_text(new_title) + expect(find_sidebar).to have_selector('#sidebar_item_forums', text: new_title) fill_in title_field, with: empty_title click_button 'Save changes' @@ -33,7 +33,7 @@ expect(course.reload.settings(:course_forums_component).title).to eq(nil) visit current_path - expect(find_sidebar).to have_text(I18n.t('course.forum.forums.sidebar_title')) + expect(find_sidebar).to have_selector('#sidebar_item_forums') end scenario 'I can change the forum pagination settings' do diff --git a/spec/features/course/admin/leaderboard_settings_spec.rb b/spec/features/course/admin/leaderboard_settings_spec.rb index e06550d8cd4..e5490d5aa81 100644 --- a/spec/features/course/admin/leaderboard_settings_spec.rb +++ b/spec/features/course/admin/leaderboard_settings_spec.rb @@ -44,14 +44,14 @@ expect(page).to have_field(title_field, with: new_title) visit current_path - expect(find_sidebar).to have_text(new_title) + expect(find_sidebar).to have_selector('#sidebar_item_leaderboard', text: new_title) fill_in title_field, with: empty_title click_button 'Save changes' expect_toastify('Your changes have been saved.') visit current_path - expect(find_sidebar).to have_text(I18n.t('course.leaderboards.sidebar_title')) + expect(find_sidebar).to have_selector('#sidebar_item_leaderboard') end scenario 'I can enable and disable the group leaderboard' do diff --git a/spec/features/course/admin/material_settings_spec.rb b/spec/features/course/admin/material_settings_spec.rb index 46102972b02..46feca0fafd 100644 --- a/spec/features/course/admin/material_settings_spec.rb +++ b/spec/features/course/admin/material_settings_spec.rb @@ -31,7 +31,7 @@ expect_toastify('Your changes have been saved.') visit current_path - expect(find_sidebar).to have_text(I18n.t('course.material.sidebar_title')) + expect(find_sidebar).to have_selector('#sidebar_item_materials') end end end diff --git a/spec/features/course/admin/video_settings_spec.rb b/spec/features/course/admin/video_settings_spec.rb index 890c9a4393a..476c37acbbb 100644 --- a/spec/features/course/admin/video_settings_spec.rb +++ b/spec/features/course/admin/video_settings_spec.rb @@ -24,14 +24,14 @@ expect(page).to have_field(title_field, with: new_title) visit current_path - expect(find_sidebar).to have_text(new_title) + expect(find_sidebar).to have_selector('#sidebar_item_videos', text: new_title) fill_in title_field, with: empty_title click_button 'Save changes' expect_toastify('Your changes have been saved.') visit current_path - expect(find_sidebar).to have_text(I18n.t('course.video.videos.sidebar_title')) + expect(find_sidebar).to have_selector('#sidebar_item_videos') end end end diff --git a/spec/features/course/announcement_management_spec.rb b/spec/features/course/announcement_management_spec.rb index ffcae142e7a..fe28a216e1f 100644 --- a/spec/features/course/announcement_management_spec.rb +++ b/spec/features/course/announcement_management_spec.rb @@ -86,7 +86,7 @@ scenario 'I can view the Announcement Sidebar item' do visit course_path(course) - expect(find_sidebar).to have_text(I18n.t('course.announcements.sidebar_title')) + expect(find_sidebar).to have_selector('#sidebar_item_announcements') end scenario 'I can see the started announcements' do diff --git a/spec/features/course/assessment/submissions_viewing_spec.rb b/spec/features/course/assessment/submissions_viewing_spec.rb index 9587326d989..0b153ea8d54 100644 --- a/spec/features/course/assessment/submissions_viewing_spec.rb +++ b/spec/features/course/assessment/submissions_viewing_spec.rb @@ -87,8 +87,7 @@ expect(page).to have_no_content_tag_for(published_submission) expect(find_sidebar). - to have_link(I18n.t('course.assessment.submissions.sidebar_title'), - href: course_submissions_path(course)) + to have_link('sidebar_item_assessments_submissions', href: course_submissions_path(course)) end # COMMENTED OUT as it is not possible to select the options for filtering diff --git a/spec/features/course/duplication_spec.rb b/spec/features/course/duplication_spec.rb index 335d1091235..b94063baaa3 100644 --- a/spec/features/course/duplication_spec.rb +++ b/spec/features/course/duplication_spec.rb @@ -18,7 +18,7 @@ scenario 'I cannot view the Duplication Sidebar item' do visit course_path(course) - expect(find_sidebar).not_to have_text(I18n.t('layouts.duplication.title')) + expect(find_sidebar).not_to have_selector('#sidebar_item_admin_duplication') end end @@ -28,7 +28,7 @@ scenario 'I can view the Duplication Sidebar item' do visit course_path(course) - expect(find_sidebar).to have_text(I18n.t('layouts.duplication.title')) + expect(find_sidebar).to have_selector('#sidebar_item_admin_duplication') end end end @@ -39,7 +39,7 @@ scenario 'I can view the Duplication Sidebar item' do visit course_path(course) - expect(find_sidebar).to have_text(I18n.t('layouts.duplication.title')) + expect(find_sidebar).to have_selector('#sidebar_item_admin_duplication') end context 'when I am a manager in one specific course' do @@ -104,7 +104,7 @@ scenario 'I cannot view the Duplication Sidebar item' do visit course_path(course) - expect(find_sidebar).not_to have_text(I18n.t('layouts.duplication.title')) + expect(find_sidebar).not_to have_selector('#sidebar_item_admin_duplication') end scenario 'I cannot access the duplication page' do diff --git a/spec/features/course/forum/topic_management_spec.rb b/spec/features/course/forum/topic_management_spec.rb index f29dccff7a4..5bf9448e009 100644 --- a/spec/features/course/forum/topic_management_spec.rb +++ b/spec/features/course/forum/topic_management_spec.rb @@ -208,7 +208,7 @@ scenario 'I can view the Forum Sidebar item' do visit course_path(course) - expect(find_sidebar).to have_text(I18n.t('course.forum.forums.sidebar_title')) + expect(find_sidebar).to have_selector('#sidebar_item_forums') end scenario 'I can see shown topics' do diff --git a/spec/features/course/group_management_spec.rb b/spec/features/course/group_management_spec.rb index 48e06e7d255..1b1e78bb050 100644 --- a/spec/features/course/group_management_spec.rb +++ b/spec/features/course/group_management_spec.rb @@ -17,7 +17,7 @@ scenario 'I can view the Group Sidebar item' do visit course_path(course) - expect(find_sidebar).to have_text(I18n.t('course.groups.sidebar_title')) + expect(find_sidebar).to have_selector('#sidebar_item_course_groups_component') end scenario 'I can view all the group categories in course' do @@ -113,7 +113,7 @@ scenario 'I can view the Group Sidebar item' do visit course_path(course) - expect(find_sidebar).to have_text(I18n.t('course.groups.sidebar_title')) + expect(find_sidebar).to have_selector('#sidebar_item_course_groups_component') end # scenario 'I can edit my group' do @@ -149,7 +149,7 @@ scenario 'I cannot view the Group Sidebar item' do visit course_path(course) - expect(find_sidebar).not_to have_text(I18n.t('course.groups.sidebar_title')) + expect(find_sidebar).not_to have_selector('#sidebar_item_course_groups_component') end end end diff --git a/spec/features/course/lesson_plan_spec.rb b/spec/features/course/lesson_plan_spec.rb index 2c1a3fa322f..27aa8a567a7 100644 --- a/spec/features/course/lesson_plan_spec.rb +++ b/spec/features/course/lesson_plan_spec.rb @@ -55,7 +55,7 @@ scenario 'I can view the LessonPlan Sidebar item' do visit course_path(course) - expect(find_sidebar).to have_text(I18n.t('course.lesson_plan.items.sidebar_title')) + expect(find_sidebar).to have_selector('#sidebar_item_lesson_plan') end scenario 'I can view all lesson plan items and milestones' do diff --git a/spec/features/course/level_management_spec.rb b/spec/features/course/level_management_spec.rb index 341e6aa49ce..e398395de45 100644 --- a/spec/features/course/level_management_spec.rb +++ b/spec/features/course/level_management_spec.rb @@ -24,7 +24,7 @@ scenario 'I can view the Level Sidebar item' do visit course_path(course) - expect(find_sidebar).to have_text(I18n.t('course.levels.sidebar_title')) + expect(find_sidebar).to have_selector('#sidebar_item_course_levels_component') end scenario 'I can view course levels' do @@ -66,7 +66,7 @@ scenario 'I cannot view the Level Sidebar item' do visit course_path(course) - expect(find_sidebar).not_to have_text(I18n.t('course.levels.sidebar_title')) + expect(find_sidebar).not_to have_selector('#sidebar_item_course_levels_component') end end end diff --git a/spec/features/course/material/folder_management_spec.rb b/spec/features/course/material/folder_management_spec.rb index fcc470aea57..282b117246f 100644 --- a/spec/features/course/material/folder_management_spec.rb +++ b/spec/features/course/material/folder_management_spec.rb @@ -146,7 +146,7 @@ let(:user) { create(:course_student, course: course).user } scenario 'I can view the Material Sidebar item' do - expect(find_sidebar).to have_text(I18n.t('course.material.sidebar_title')) + expect(find_sidebar).to have_selector('#sidebar_item_materials') end scenario 'I can view valid subfolders' do diff --git a/spec/features/course/staff_management_spec.rb b/spec/features/course/staff_management_spec.rb index 4f9daf754c7..c9f13f308d7 100644 --- a/spec/features/course/staff_management_spec.rb +++ b/spec/features/course/staff_management_spec.rb @@ -16,7 +16,7 @@ scenario 'I cannot view the Users Management Sidebar item' do visit course_path(course) - expect(find_sidebar).not_to have_text(I18n.t('layouts.course_users.title')) + expect(find_sidebar).not_to have_selector('#sidebar_item_admin_users_manage_users') end end @@ -27,7 +27,7 @@ scenario 'I can view the Users Management Sidebar item' do visit course_path(course) - expect(find_sidebar).to have_text(I18n.t('layouts.course_users.title')) + expect(find_sidebar).to have_selector('#sidebar_item_admin_users_manage_users') end scenario 'I cannot access the staff list' do @@ -43,7 +43,7 @@ scenario 'I can view the Users Management Sidebar item' do visit course_path(course) - expect(find_sidebar).to have_text(I18n.t('layouts.course_users.title')) + expect(find_sidebar).to have_selector('#sidebar_item_admin_users_manage_users') end scenario 'I can view the list of staff' do diff --git a/spec/features/course/staff_statistics_spec.rb b/spec/features/course/staff_statistics_spec.rb index a2b1bba5374..4fa5b51eaa0 100644 --- a/spec/features/course/staff_statistics_spec.rb +++ b/spec/features/course/staff_statistics_spec.rb @@ -113,7 +113,7 @@ scenario 'I cannot see the sidebar item' do visit course_path(course) - expect(find_sidebar).not_to have_text(I18n.t('course.statistics.header')) + expect(find_sidebar).not_to have_selector('#sidebar_item_course_statistics_component') end end end diff --git a/spec/features/course/students_statistics_spec.rb b/spec/features/course/students_statistics_spec.rb index 759abdc143b..9d92a675695 100644 --- a/spec/features/course/students_statistics_spec.rb +++ b/spec/features/course/students_statistics_spec.rb @@ -52,7 +52,7 @@ scenario 'I cannot see the statistics sidebar item' do visit course_path(course) - expect(find_sidebar).not_to have_text(I18n.t('course.statistics.header')) + expect(find_sidebar).not_to have_selector('#sidebar_item_course_statistics_component') end scenario 'I cannot access the statistics page' do diff --git a/spec/features/course/unread_status_management_spec.rb b/spec/features/course/unread_status_management_spec.rb index 3c6ce6d65d0..27daa819136 100644 --- a/spec/features/course/unread_status_management_spec.rb +++ b/spec/features/course/unread_status_management_spec.rb @@ -53,7 +53,7 @@ it 'shows the correct number of unread items' do expect(course.announcements.unread_by(first_user).count).to eq(1) - expect(find_sidebar.find_link(I18n.t('course.announcements.sidebar_title'))).to have_text 1 + expect(find_sidebar).to have_selector('#sidebar_item_announcements', text: 1) end end end diff --git a/spec/features/system/admin/components_settings_spec.rb b/spec/features/system/admin/components_settings_spec.rb index 606e915f05f..139673314c5 100644 --- a/spec/features/system/admin/components_settings_spec.rb +++ b/spec/features/system/admin/components_settings_spec.rb @@ -27,7 +27,7 @@ settings = Instance::Settings::Components.new(instance) components.each do |component| - expect(page).to have_selector('tr', text: component.display_name) + expect(page).to have_selector("tr#component_#{component.key}") within find("tr#component_#{component.key}") do if enabled_components.include?(component) diff --git a/spec/models/course/assessment/duplication_spec.rb b/spec/models/course/assessment/duplication_spec.rb index 577545bfab1..814b45ce6d5 100644 --- a/spec/models/course/assessment/duplication_spec.rb +++ b/spec/models/course/assessment/duplication_spec.rb @@ -49,7 +49,7 @@ options = { current_user: admin, new_start_at: (source_course.start_at + time_shift).iso8601, - new_title: I18n.t('course.duplications.show.new_course_title_prefix') + new_title: "#{source_course.title} copy" } Course::Duplication::CourseDuplicationService.duplicate_course(source_course, options) end diff --git a/spec/services/course/duplication/course_duplication_service_spec.rb b/spec/services/course/duplication/course_duplication_service_spec.rb index 43121956a48..64d4bc3fd6b 100644 --- a/spec/services/course/duplication/course_duplication_service_spec.rb +++ b/spec/services/course/duplication/course_duplication_service_spec.rb @@ -11,7 +11,7 @@ options = { current_user: admin, new_start_at: (course.start_at + time_shift).iso8601, - new_title: I18n.t('course.duplications.show.new_course_title_prefix') + new_title: "#{course.title} copy" } Course::Duplication::CourseDuplicationService.duplicate_course(course, options) end @@ -48,7 +48,7 @@ # Also test that a course with a registration key can be duplicated. course.registration_key = 'abcde' expect(new_course).to_not be course - expect(new_course.title).to eq I18n.t('course.duplications.show.new_course_title_prefix') + expect(new_course.title).to eq "#{course.title} copy" # Throws error if database contraints are violated. new_course.save!