From d392f7780e85c74eb393dafec559d572faf4c8ca Mon Sep 17 00:00:00 2001 From: Matt Lott Date: Fri, 19 Aug 2016 14:26:39 -0700 Subject: [PATCH] Force level primer language usage for students --- app/templates/courses/courses-view.jade | 2 ++ app/views/courses/CourseDetailsView.coffee | 1 + app/views/play/level/modal/CourseVictoryModal.coffee | 1 + 3 files changed, 4 insertions(+) diff --git a/app/templates/courses/courses-view.jade b/app/templates/courses/courses-view.jade index 2a09378f6..53b963506 100644 --- a/app/templates/courses/courses-view.jade +++ b/app/templates/courses/courses-view.jade @@ -132,6 +132,8 @@ mixin course-instance-body(courseInstance, classroom) else - var firstLevel = stats.levels.first; - var levelURL = "/play/level/"+firstLevel.get('slug')+"?course="+courseInstance.get('courseID')+"&course-instance="+courseInstance.id; + if firstLevel.get('primerLanguage') + - levelURL += "&codeLanguage=" + firstLevel.get('primerLanguage'); a.play-btn.btn.btn-navy.btn-lg.m-b-1(data-href=levelURL, data-level-slug=firstLevel.get('slug'), data-event-action="Students Start Course") span(data-i18n="courses.start") diff --git a/app/views/courses/CourseDetailsView.coffee b/app/views/courses/CourseDetailsView.coffee index 1796c749b..98ba88666 100644 --- a/app/views/courses/CourseDetailsView.coffee +++ b/app/views/courses/CourseDetailsView.coffee @@ -133,6 +133,7 @@ module.exports = class CourseDetailsView extends RootView viewArgs = viewArgs.concat ['course', @courseInstance.id] else route = @getLevelURL levelSlug + route += "&codeLanguage=" + level.get('primerLanguage') if level.get('primerLanguage') viewClass = 'views/play/level/PlayLevelView' viewArgs = [{courseID: @courseID, courseInstanceID: @courseInstanceID, supermodel: @supermodel}, levelSlug] Backbone.Mediator.publish 'router:navigate', route: route, viewClass: viewClass, viewArgs: viewArgs diff --git a/app/views/play/level/modal/CourseVictoryModal.coffee b/app/views/play/level/modal/CourseVictoryModal.coffee index 2b52e999e..206c38bab 100644 --- a/app/views/play/level/modal/CourseVictoryModal.coffee +++ b/app/views/play/level/modal/CourseVictoryModal.coffee @@ -103,6 +103,7 @@ module.exports = class CourseVictoryModal extends ModalView link = "/play/level/#{@nextLevel.get('slug')}?course=#{@courseID}&codeLanguage=#{utils.getQueryVariable('codeLanguage', 'python')}" else link = "/play/level/#{@nextLevel.get('slug')}?course=#{@courseID}&course-instance=#{@courseInstanceID}" + link += "&codeLanguage=" + @level.get('primerLanguage') if @level.get('primerLanguage') application.router.navigate(link, {trigger: true}) onDone: ->