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

182 lines
6.6 KiB
Text
Raw Normal View History

2015-11-03 19:41:06 -05:00
extends /templates/base
block content
if me.isTeacher() || view.ownedClassrooms.size()
.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.
h3.text-right
if me.isAnonymous()
2016-03-09 17:40:52 -05:00
a(href="/teachers/signup")
span(data-i18n="courses.teachers_click")
span !
else
a(href="/teachers/classes")
span(data-i18n="courses.teachers_click")
span !
2015-11-03 19:41:06 -05:00
#main-content
if me.isAnonymous()
h1.text-center(data-i18n="courses.welcome_to_courses")
.text-center
p
h3(data-i18n="courses.ready_to_play")
p
button#start-new-game-btn.btn.btn-default(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-default(data-i18n="login.log_in")
h3#play-now-to-learn-header.text-center.text-uppercase(data-i18n="courses.play_now_learn_header")
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
- var showHOCComplete = false;
2015-11-29 17:18:24 -05:00
if view.hocCourseInstance
- var course = view.courses.get(view.hocCourseInstance.get('courseID'));
- var campaign = view.campaigns.get(course.get('campaignID'));
- var stats = campaign.statsForSessions(view.hocCourseInstance.sessions);
2015-11-29 18:26:42 -05:00
- showHOCComplete = stats.levels.done && !view.classrooms.size();
.text-center
if !showHOCComplete
h1(data-i18n="courses.welcome_to_page") Welcome to your Courses page!
else
h1(data-i18n="courses.completed_hoc")
h2(data-i18n="courses.ready_for_more_header")
2015-11-29 17:23:55 -05:00
ul.text-left
li(data-i18n="courses.ready_for_more_1")
li(data-i18n="courses.ready_for_more_2")
li(data-i18n="courses.ready_for_more_3")
2015-11-29 17:23:55 -05:00
a.btn.btn-lg.btn-success(href="/play") Play Now
2015-11-29 18:26:42 -05:00
if view.hocCourseInstance && !view.classrooms.size()
h3(data-i18n="courses.saved_games")
hr
.course-instance-entry
2015-11-29 13:27:40 -05:00
h3
span(data-i18n="courses.hoc")
span.spr :
span.spr(data-i18n="courses.course")
span 1
span.spr= (me.get('aceConfig') || {}).language === 'javascript' ? 'JavaScript' : 'Python'
small
a#change-language-link(data-i18n="courses.change_language")
2015-11-29 13:27:40 -05:00
+course-instance-body(view.hocCourseInstance)
.clearfix
2015-11-29 17:18:24 -05:00
else if view.classrooms.size()
h3.text-uppercase(data-i18n="courses.my_classes")
2015-11-29 13:27:40 -05:00
hr
2015-11-29 13:27:40 -05:00
for classroom in view.classrooms.models
- var justAdded = classroom.id === view.classroomJustAdded;
- var classroomClass = justAdded ? 'just-added' : '';
if justAdded
#just-added-text.text-center(data-i18n="courses.class_added")
2015-11-25 18:13:43 -05:00
//- sigh
div(class=classroomClass)
2015-11-29 13:27:40 -05:00
h3
span.spr= classroom.get('name')
span.spr (#{(classroom.get('aceConfig') || {}).language === 'javascript' ? 'JavaScript' : 'Python'})
a(href="/courses/"+classroom.id, data-i18n="courses.view_class")
- var courseInstances = view.courseInstances.where({classroomID: classroom.id});
for courseInstance in courseInstances
2015-11-29 13:27:40 -05:00
.course-instance-entry
- var course = view.courses.get(courseInstance.get('courseID'));
2015-11-29 13:27:40 -05:00
h3
span.spr= course.get('name')
small
a(href="/courses/"+courseInstance.get('courseID')+'/'+courseInstance.id, data-i18n="courses.view_levels")
2015-11-29 13:27:40 -05:00
+course-instance-body(courseInstance)
.clearfix
else
.text-center
button#start-new-game-btn.btn.btn-success.btn-lg(data-i18n="courses.start_new_game")
h3.text-uppercase(data-i18n="courses.join_class")
2015-11-29 13:27:40 -05:00
hr
2015-11-29 13:27:40 -05:00
form#join-class-form.form-inline
.help-block
em(data-i18n="courses.ask_teacher_for_code")
2015-11-29 13:27:40 -05:00
.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-default(type="submit", data-i18n="[value]courses.join", value="Join")
2015-11-29 13:27:40 -05:00
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
#begin-hoc-area.hide
2015-11-29 13:27:40 -05:00
h3.text-center(data-i18n="common.loading")
.progress.progress-striped.active
.progress-bar(style="width: 100%")
mixin course-instance-body(courseInstance)
- var course = view.courses.get(courseInstance.get('courseID'));
2015-11-29 13:27:40 -05:00
- var campaign = view.campaigns.get(course.get('campaignID'));
2015-11-29 17:18:24 -05:00
- var stats = campaign.statsForSessions(courseInstance.sessions);
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;
if arenaLevel
2015-11-29 17:18:24 -05:00
- var arenaURL = "/play/ladder/"+arenaLevel.slug+"/course/"+courseInstance.id;
a.btn.btn-warning.btn-lg(href=arenaURL)
span(data-i18n="courses.play_arena")
else
a.btn.btn-default.btn-lg(disabled=true, data-i18n="courses.course_complete")
2015-11-29 13:27:40 -05:00
else if courseInstance.sessions.size()
2015-11-29 17:18:24 -05:00
- var lastLevel = stats.levels.lastPlayed;
- var levelURL = "/play/level/"+lastLevel.slug+"?course="+courseInstance.get('courseID')+"&course-instance="+courseInstance.id;
a.btn.btn-success.btn-lg(href=levelURL)
span(data-i18n="common.continue")
else
2015-11-29 17:18:24 -05:00
- var firstLevel = stats.levels.first;
- var levelURL = "/play/level/"+firstLevel.slug+"?course="+courseInstance.get('courseID')+"&course-instance="+courseInstance.id;
a.btn.btn-info.btn-lg(href=levelURL)
span(data-i18n="courses.start")
2015-11-29 17:18:24 -05:00
div
span(data-i18n="clans.playtime")
2015-11-29 17:18:24 -05:00
span.spr :
span= moment.duration(stats.playtime, 'seconds').humanize()
2015-11-29 17:18:24 -05:00
if stats.levels.lastPlayed
div
span(data-i18n="courses.last_level")
2015-11-29 17:18:24 -05:00
span.spr :
span= stats.levels.lastPlayed.name
.progress
.progress-bar(style="width:"+stats.levels.pctDone)= stats.levels.pctDone