codecombat/app/templates/courses/student-courses-view.jade
Scott Erickson a0212da789 Improve StudentCoursesView
* Add alert explaining when a user joins a course, and links directly to the course
* Add header to My Courses list
* Have My Courses list sorted by classroom creation then course creation
2015-11-10 12:08:44 -08:00

70 lines
No EOL
2.3 KiB
Text

extends /templates/base
block content
p To join a class, ask your teacher for an unlock code.
#join-classroom-form.form-horizontal
.form-group
.col-sm-2
button#join-class-btn.btn.btn-default.btn-block(disabled=view.state==='enrolling') Join Class
.col-sm-6
input#classroom-code-input.form-control(
placeholder='<enter unlock code here>',
value=view.classCode,
disabled=view.state==='enrolling')
if view.state === 'enrolling'
.progress.progress-striped.active
.progress-bar(style="width: 100%") Joining class
if view.state === 'unknown_error'
.alert.alert-danger= view.stateMessage
- var justJoinedCourseInstance = view.courseInstances.find(function(ci) { return ci.justJoined; });
if justJoinedCourseInstance
- var course = view.courses.get(justJoinedCourseInstance.get('courseID'));
- var classroom = view.classrooms.get(justJoinedCourseInstance.get('classroomID'));
if course && classroom
.alert.alert-info
span.spr Successfully joined "#{classroom.get('name')}"!
a(href="/courses/#{course.id}/#{justJoinedCourseInstance.id}")
strong Click here to start taking "#{course.get('name')}".
.panel.panel-default
.panel-heading
.panel-title My Courses
.list-group
.list-group-item
.row
.col-sm-3
strong Classroom
.col-sm-3
strong Course
for courseInstance in view.courseInstances.models
- var classroom = view.classrooms.get(courseInstance.get('classroomID'))
- var course = view.courses.get(courseInstance.get('courseID'))
if !(classroom && course)
- continue;
.list-group-item
.row
.col-sm-3
if classroom
| #{classroom.get('name')}
.col-sm-3
if course
| #{course.get('name')}
.col-sm-6
a.btn.btn-default.btn-sm(href="/courses/#{course.id}/#{courseInstance.id}") Enter
.panel.panel-default
.panel-heading
.panel-title My Classes
.list-group
for classroom in view.classrooms.models
.list-group-item
.row
.col-sm-3= classroom.get('name')
.col-sm-9= classroom.get('description')