Flatten /courses

This commit is contained in:
Scott Erickson 2016-04-28 12:08:20 -07:00
parent 64061d60e1
commit 3fed1743fc
2 changed files with 97 additions and 111 deletions
app
styles/courses
templates/courses

View file

@ -1,21 +1,17 @@
#courses-view
#main-content
padding-left: 250px
padding-right: 250px
h1
margin-bottom: 30px
#main-content
max-width: 720px
margin: 0 auto
#play-now-to-learn-header
margin-top: 60px
ul
#benefits-ul
margin: 0 auto 40px
width: 320px
#begin-hoc-area
width: 50%
margin: 0 auto
width: 360px
hr
border-top: 1px solid grey
@ -32,9 +28,6 @@
margin: 0 -20px
padding: 0 20px
h3
margin-top: 20px
.course-instance-entry
padding-left: 40px

View file

@ -1,98 +1,90 @@
extends /templates/base
extends /templates/base-flat
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()
a(href="/teachers/signup")
span(data-i18n="courses.teachers_click")
span !
else
a(href="/teachers/classes")
span(data-i18n="courses.teachers_click")
span !
#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
.text-center
h1(data-i18n="courses.welcome_to_page") Welcome to your Courses page!
if view.classrooms.size()
h3.text-uppercase(data-i18n="courses.my_classes")
hr
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")
//- sigh
div(class=classroomClass)
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
.course-instance-entry
- var course = view.courses.get(courseInstance.get('courseID'));
h3
span.spr= course.get('name')
small
a(href="/courses/"+courseInstance.get('courseID')+'/'+courseInstance.id, data-i18n="courses.view_levels")
+course-instance-body(courseInstance, classroom)
.clearfix
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-default(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
.container
.row.m-y-3
.col-xs-12
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.
#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
h1(data-i18n="courses.welcome_to_page") Welcome to your Courses page!
if view.classrooms.size()
h3.text-uppercase(data-i18n="courses.my_classes")
hr
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")
//- sigh
div(class=classroomClass)
h5
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
.course-instance-entry
- var course = view.courses.get(courseInstance.get('courseID'));
h6
span.spr= course.get('name')
small
a(href="/courses/"+courseInstance.get('courseID')+'/'+courseInstance.id, data-i18n="courses.view_levels")
+course-instance-body(courseInstance, classroom)
.clearfix
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
mixin course-instance-body(courseInstance, classroom)
@ -108,19 +100,19 @@ mixin course-instance-body(courseInstance, classroom)
- var arenaLevel = stats.levels.arena;
if arenaLevel
- var arenaURL = "/play/ladder/"+arenaLevel.get('slug')+"/course/"+courseInstance.id;
a.btn.btn-warning.btn-lg(href=arenaURL)
a.btn.btn-burgandy.btn-lg.m-b-1(href=arenaURL)
span(data-i18n="courses.play_arena")
else
a.btn.btn-default.btn-lg(disabled=true, data-i18n="courses.course_complete")
a.btn.btn-default.btn-lg.m-b-1(disabled=true, data-i18n="courses.course_complete")
else if courseInstance.sessions.size()
- var lastLevel = stats.levels.lastPlayed;
- var levelURL = "/play/level/"+lastLevel.get('slug')+"?course="+courseInstance.get('courseID')+"&course-instance="+courseInstance.id;
a.btn.btn-success.btn-lg(href=levelURL)
a.btn.btn-forest.btn-lg.m-b-1(href=levelURL)
span(data-i18n="common.continue")
else
- var firstLevel = stats.levels.first;
- var levelURL = "/play/level/"+firstLevel.get('slug')+"?course="+courseInstance.get('courseID')+"&course-instance="+courseInstance.id;
a.btn.btn-info.btn-lg(href=levelURL)
a.btn.btn-navy.btn-lg.m-b-1(href=levelURL)
span(data-i18n="courses.start")
div
@ -132,7 +124,8 @@ mixin course-instance-body(courseInstance, classroom)
div
span(data-i18n="courses.last_level")
span.spr :
span= stats.levels.lastPlayed.name
span= stats.levels.lastPlayed.get('name')
.clearfix
.progress
.progress-bar(style="width:"+stats.levels.pctDone)= stats.levels.pctDone