codecombat/app/templates/courses/courses-view.jade

148 lines
6.5 KiB
Text
Raw Normal View History

2016-04-28 15:08:20 -04:00
extends /templates/base-flat
2015-11-03 19:41:06 -05:00
block content
2016-04-28 15:08:20 -04:00
.container
.row.m-y-3
.col-xs-12
if me.isTeacher()
2016-04-28 15:08:20 -04:00
.alert.alert-danger.text-center
// DNT: Temporary
h3 ATTENTION TEACHERS:
p We are transitioning to a new classroom management system; this page will soon be student-only.
a(href="/teachers/classes") Go to teachers area.
#main-content
if me.isAnonymous()
h1.text-center(data-i18n="courses.welcome_to_courses")
.text-center
p
h2(data-i18n="courses.ready_to_play")
p
button#start-new-game-btn.btn.btn-navy(data-i18n="courses.start_new_game")
p
span.spr -
span.text-uppercase(data-i18n="general.or")
span.spl -
p
button#log-in-btn.btn.btn-forest(data-i18n="login.log_in")
h2#play-now-to-learn-header.text-center.text-uppercase(data-i18n="courses.play_now_learn_header")
ul#benefits-ul
li(data-i18n="courses.play_now_learn_1")
li(data-i18n="courses.play_now_learn_2")
li(data-i18n="courses.play_now_learn_3")
li(data-i18n="courses.play_now_learn_4")
else
.text-center
2016-08-17 17:15:36 -04:00
h1(data-i18n="courses.welcome_to_page")
.current-hero-container.text-center.row
.hero-avatar
img(src=view.hero.getPortraitURL())
.current-hero-right-col
.semibold.current-hero-text
2016-08-12 16:27:30 -04:00
span.spr(data-i18n="courses.current_hero")
span.current-hero-name= view.hero.getHeroShortName()
button.change-hero-btn.btn.btn-lg.btn-forest
2016-08-12 16:27:30 -04:00
span(data-i18n="courses.change_hero")
2016-04-28 15:08:20 -04:00
if view.classrooms.size()
2016-08-17 17:15:36 -04:00
br
h3(data-i18n="courses.my_classes")
2016-04-28 15:08:20 -04:00
for classroom in view.classrooms.models
2016-08-17 17:15:36 -04:00
hr.class-break
2016-04-28 15:08:20 -04:00
- var justAdded = classroom.id === view.classroomJustAdded;
- var classroomClass = justAdded ? 'just-added' : '';
if justAdded
#just-added-text.text-center(data-i18n="courses.class_added")
//- sigh
div(class=classroomClass)
h5
span.spr= classroom.get('name')
span.spr (#{(classroom.get('aceConfig') || {}).language === 'javascript' ? 'JavaScript' : 'Python'})
2016-08-17 17:15:36 -04:00
p
span(data-i18n="courses.teacher")
span :
if view.ownerNameMap && view.ownerNameMap[classroom.get('ownerID')]
span.spl= view.ownerNameMap[classroom.get('ownerID')]
2016-04-28 15:08:20 -04:00
- var courseInstances = view.courseInstances.where({classroomID: classroom.id});
for courseInstance in courseInstances
.course-instance-entry
- var course = view.courses.get(courseInstance.get('courseID'));
h6
span.spr= i18n(course.attributes, 'name')
2016-04-28 15:08:20 -04:00
small
a.view-levels-btn(data-course-id=courseInstance.get('courseID'), data-courseinstance-id=courseInstance.id, data-i18n="courses.view_levels")
2016-04-28 15:08:20 -04:00
+course-instance-body(courseInstance, classroom)
.clearfix
2016-08-17 17:15:36 -04:00
2016-04-28 15:08:20 -04:00
h3.text-uppercase(data-i18n="courses.join_class")
hr
form#join-class-form.form-inline
.help-block
em(data-i18n="courses.ask_teacher_for_code")
.form-group
input#class-code-input.form-control(data-i18n="[placeholder]courses.enter_c_code", placeholder="<Enter Class Code>", value=view.classCode)
input#join-class-button.btn.btn-navy(type="submit", data-i18n="[value]courses.join", value="Join")
if view.state === 'enrolling'
.progress.progress-striped.active
.progress-bar(style="width: 100%", data-i18n="courses.joining") Joining class
if view.errorMessage
.alert.alert-danger= view.errorMessage
2016-04-13 12:54:24 -04:00
mixin course-instance-body(courseInstance, classroom)
- var course = view.courses.get(courseInstance.get('courseID'));
2016-04-13 12:54:24 -04:00
- var stats = classroom.statsForSessions(courseInstance.sessions, course.id);
2015-11-29 17:18:24 -05:00
if stats.levels.done
.text-success
span.glyphicon.glyphicon-ok
span.spl(data-i18n="courses.course_complete")
span !
.pull-right
2015-11-29 17:18:24 -05:00
if stats.levels.done
- var arenaLevel = stats.levels.arena;
2016-08-11 19:38:14 -04:00
- var projectLevel = stats.levels.project;
if arenaLevel
2016-04-13 12:54:24 -04:00
- var arenaURL = "/play/ladder/"+arenaLevel.get('slug')+"/course/"+courseInstance.id;
2016-08-17 17:15:36 -04:00
a.play-btn.btn.btn-forest-alt.btn-lg.m-b-1(data-href=arenaURL, data-level-slug=arenaLevel.get('slug'), data-event-action="Students Play Arena")
span(data-i18n="courses.play_arena")
2016-08-11 19:38:14 -04:00
else if projectLevel
- var projectURL = "/play/level/"+projectLevel.get('slug')+"?course="+course.id+"&course-instance="+courseInstance.id;
2016-08-17 17:15:36 -04:00
a.play-btn.btn.btn-forest-alt.btn-lg.m-b-1(data-href=projectURL, data-level-slug=projectLevel.get('slug'), data-event-action="Students Play Project")
2016-08-11 19:38:14 -04:00
span(data-i18n="courses.view_project")
else
2016-04-28 15:08:20 -04:00
a.btn.btn-default.btn-lg.m-b-1(disabled=true, data-i18n="courses.course_complete")
else if stats.levels.next != stats.levels.first
- var next = stats.levels.next;
- var levelURL = "/play/level/"+next.get('slug')+"?course="+courseInstance.get('courseID')+"&course-instance="+courseInstance.id;
a.play-btn.btn.btn-forest.btn-lg.m-b-1(data-href=levelURL, data-level-slug=next.get('slug'), data-event-action="Students Continue Course")
span(data-i18n="common.continue")
else
2015-11-29 17:18:24 -05:00
- var firstLevel = stats.levels.first;
2016-04-13 12:54:24 -04:00
- var levelURL = "/play/level/"+firstLevel.get('slug')+"?course="+courseInstance.get('courseID')+"&course-instance="+courseInstance.id;
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")
2015-11-29 17:18:24 -05:00
if stats.levels.lastPlayed
div
span(data-i18n="courses.last_level")
2016-08-17 17:15:36 -04:00
span : #{stats.levels.lastPlayedNumber}.
span.spl= stats.levels.lastPlayed.get('name')
2015-11-29 17:18:24 -05:00
2016-04-28 15:08:20 -04:00
.clearfix
2015-11-29 17:18:24 -05:00
.progress
.progress-bar(style="width:"+stats.levels.pctDone)= stats.levels.pctDone