mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-14 07:00:01 -04:00
parent
9f93c0ed18
commit
ed8e36f5cd
27 changed files with 45 additions and 40 deletions
|
@ -1,5 +1,5 @@
|
|||
go = (path, options) -> -> @routeDirectly path, arguments, options
|
||||
redirect = (path) -> -> @navigate(path, { trigger: true, replace: true })
|
||||
redirect = (path) -> -> @navigate(path + document.location.search, { trigger: true, replace: true })
|
||||
utils = require './utils'
|
||||
|
||||
module.exports = class CocoRouter extends Backbone.Router
|
||||
|
@ -72,15 +72,15 @@ module.exports = class CocoRouter extends Backbone.Router
|
|||
'contribute/diplomat': go('contribute/DiplomatView')
|
||||
'contribute/scribe': go('contribute/ScribeView')
|
||||
|
||||
'courses': go('courses/CoursesView')
|
||||
'Courses': go('courses/CoursesView')
|
||||
'courses/students': redirect('/courses')
|
||||
'courses': redirect('/students') # Redirected 9/3/16
|
||||
'Courses': redirect('/students') # Redirected 9/3/16
|
||||
'courses/students': redirect('/students') # Redirected 9/3/16
|
||||
'courses/teachers': redirect('/teachers/classes')
|
||||
'courses/purchase': redirect('/teachers/licenses')
|
||||
'courses/enroll(/:courseID)': redirect('/teachers/licenses')
|
||||
'courses/update-account': go('courses/CoursesUpdateAccountView')
|
||||
'courses/:classroomID': go('courses/ClassroomView', { studentsOnly: true })
|
||||
'courses/:courseID/:courseInstanceID': go('courses/CourseDetailsView', { studentsOnly: true })
|
||||
'courses/update-account': redirect('students/update-account') # Redirected 9/3/16
|
||||
'courses/:classroomID': -> @navigate("/students/#{arguments[0]}", {trigger: true, replace: true}) # Redirected 9/3/16
|
||||
'courses/:courseID/:courseInstanceID': -> @navigate("/students/#{arguments[0]}/#{arguments[1]}", {trigger: true, replace: true}) # Redirected 9/3/16
|
||||
|
||||
'db/*path': 'routeToServer'
|
||||
'demo(/*subpath)': go('DemoView')
|
||||
|
@ -147,6 +147,11 @@ module.exports = class CocoRouter extends Backbone.Router
|
|||
'seen': go('HomeView')
|
||||
'SEEN': go('HomeView')
|
||||
|
||||
'students': go('courses/CoursesView')
|
||||
'students/update-account': go('courses/CoursesUpdateAccountView')
|
||||
'students/:classroomID': go('courses/ClassroomView', { studentsOnly: true })
|
||||
'students/:courseID/:courseInstanceID': go('courses/CourseDetailsView', { studentsOnly: true })
|
||||
|
||||
'teachers': redirect('/teachers/classes')
|
||||
'teachers/classes': go('courses/TeacherClassesView', { teachersOnly: true })
|
||||
'teachers/classes/:classroomID': go('courses/TeacherClassView', { teachersOnly: true })
|
||||
|
|
|
@ -82,6 +82,7 @@
|
|||
contact: "Contact"
|
||||
twitter_follow: "Follow"
|
||||
teachers: "Teachers"
|
||||
students: "Students"
|
||||
careers: "Careers"
|
||||
facebook: "Facebook"
|
||||
twitter: "Twitter"
|
||||
|
|
|
@ -36,7 +36,7 @@ mixin accountLinks
|
|||
li
|
||||
a(href="/about", data-i18n="nav.about")
|
||||
li
|
||||
a(href="/courses", data-i18n="courses.students")
|
||||
a(href="/students", data-i18n="nav.students")
|
||||
li
|
||||
a(href="/teachers/classes", data-i18n="nav.teachers")
|
||||
li
|
||||
|
|
|
@ -9,7 +9,7 @@ block header
|
|||
a(href="/")
|
||||
span.glyphicon.glyphicon-home
|
||||
a(href='/teachers', data-i18n="nav.teachers")
|
||||
a(href='/courses', data-i18n="courses.students")
|
||||
a(href='/students', data-i18n="nav.students")
|
||||
a(href=view.forumLink(), data-i18n="nav.forum")
|
||||
a(href='/community', data-i18n="nav.community")
|
||||
|
||||
|
|
|
@ -69,12 +69,12 @@
|
|||
li
|
||||
strong(data-i18n="courses.students")
|
||||
li
|
||||
a(href="/courses/students", data-i18n="nav.learn_to_code")
|
||||
a(href="/students", data-i18n="nav.learn_to_code")
|
||||
if me.isAnonymous()
|
||||
li
|
||||
a.login-btn(data-i18n="login.log_in")
|
||||
li
|
||||
a(href="/courses", data-i18n="courses.join_class")
|
||||
a(href="/students", data-i18n="courses.join_class")
|
||||
|
||||
.col-sm-3
|
||||
ul.list-unstyled
|
||||
|
@ -97,4 +97,4 @@
|
|||
li
|
||||
a(href="https://www.facebook.com/codecombat", data-i18n="nav.facebook")
|
||||
li
|
||||
a(href="https://twitter.com/codecombat", data-i18n="nav.twitter")
|
||||
a(href="https://twitter.com/codecombat", data-i18n="nav.twitter")
|
||||
|
|
|
@ -13,7 +13,7 @@ block content
|
|||
if isOwner
|
||||
a(href="/teachers/classes", data-i18n="courses.back_classrooms")
|
||||
else
|
||||
a(href="/courses", data-i18n="courses.back_courses")
|
||||
a(href="/students", data-i18n="courses.back_courses")
|
||||
|
||||
if !me.isAnonymous()
|
||||
h1
|
||||
|
|
|
@ -4,8 +4,7 @@ block content
|
|||
|
||||
.container.m-t-3
|
||||
p
|
||||
a(href="/courses", data-i18n="courses.back_courses")
|
||||
|
||||
a(href="/students", data-i18n="courses.back_courses")
|
||||
p
|
||||
strong
|
||||
if view.courseInstance.get('name')
|
||||
|
|
|
@ -13,7 +13,7 @@ block content
|
|||
.login-button.btn.btn-lg.btn-primary(data-i18n='login.log_in')
|
||||
.signup-button.btn.btn-lg.btn-primary-alt(data-i18n="login.sign_up")
|
||||
else
|
||||
a.btn.btn-lg.btn-primary(href="/courses/update-account" data-i18n="courses.update_account_update_student")
|
||||
a.btn.btn-lg.btn-primary(href="/students/update-account" data-i18n="courses.update_account_update_student")
|
||||
button#logout-button.btn.btn-lg.btn-primary-alt(data-i18n="login.log_out")
|
||||
|
||||
if me.isTeacher()
|
||||
|
|
|
@ -30,7 +30,7 @@ block content
|
|||
.alert.alert-info
|
||||
span.spr(data-i18n="courses.successfully_joined")
|
||||
span.spr "#{classroom.get('name')}"!
|
||||
a(href="/courses/#{course.id}/#{justJoinedCourseInstance.id}")
|
||||
a(href="/students/#{course.id}/#{justJoinedCourseInstance.id}")
|
||||
strong
|
||||
span.spr(data-i18n="courses.click_to_start")
|
||||
span "#{course.get('name')}".
|
||||
|
@ -61,7 +61,7 @@ block content
|
|||
if course
|
||||
| #{course.get('name')}
|
||||
.col-sm-6
|
||||
a.btn.btn-default.btn-sm(href="/courses/#{course.id}/#{courseInstance.id}", data-i18n="courses.enter")
|
||||
a.btn.btn-default.btn-sm(href="/students/#{course.id}/#{courseInstance.id}", data-i18n="courses.enter")
|
||||
|
||||
.panel.panel-default
|
||||
.panel-heading
|
||||
|
|
|
@ -7,7 +7,7 @@ block content
|
|||
if view.leagueType === 'course' && view.course
|
||||
#course-header
|
||||
#course-details-link
|
||||
a(href="/courses/#{view.course.id}/#{view.league.id}")
|
||||
a(href="/students/#{view.course.id}/#{view.league.id}")
|
||||
span.glyphicon.glyphicon-arrow-left
|
||||
span.spl Levels
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
.course-membership-required
|
||||
span(data-i18n="courses.course_membership_required_to_play") You'll need to join a course to play this level.
|
||||
a.btn.btn-lg.btn-warning(data-i18n="courses.go_to_courses", href="/courses") Go To Courses
|
||||
a.btn.btn-lg.btn-warning(data-i18n="courses.go_to_courses", href="/students") Go To Courses
|
||||
|
||||
#tip-wrapper.picoctf-hide
|
||||
strong.tip(data-i18n='play_level.tip_toggle_play') Toggle play/paused with Ctrl+P.
|
||||
|
|
|
@ -17,9 +17,9 @@ block content
|
|||
span(data-i18n="new_home.goto_classes")
|
||||
else if me.isStudent()
|
||||
div.m-b-1
|
||||
a.btn.btn-forest.btn-lg(href="/courses", data-i18n="courses.continue_playing")
|
||||
a.btn.btn-forest.btn-lg(href="/students", data-i18n="courses.continue_playing")
|
||||
div
|
||||
a.btn.btn-primary.btn-lg.play-btn(href="/courses", data-i18n="new_home.view_progress")
|
||||
a.btn.btn-primary.btn-lg.play-btn(href="/students", data-i18n="new_home.view_progress")
|
||||
else
|
||||
div.m-b-1
|
||||
a.btn.btn-forest.btn-lg.play-btn(href="/play", data-i18n="courses.continue_playing")
|
||||
|
|
|
@ -50,7 +50,7 @@ module.exports = class HomeView extends RootView
|
|||
@playURL = '/hoc?go=true'
|
||||
else if me.isStudent()
|
||||
# Save players who might be in a classroom from getting into the campaign
|
||||
@playURL = '/courses'
|
||||
@playURL = '/students'
|
||||
else
|
||||
@playURL = '/play'
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ formSchema = {
|
|||
|
||||
loginNavigate = ->
|
||||
if me.isStudent()
|
||||
application.router.navigate('/courses', {trigger: true})
|
||||
application.router.navigate('/students', {trigger: true})
|
||||
else if me.isTeacher()
|
||||
application.router.navigate('/teachers/classes', {trigger: true})
|
||||
window.location.reload()
|
||||
|
|
|
@ -15,9 +15,9 @@ module.exports = class ConfirmationView extends CocoView
|
|||
onClickStartButton: ->
|
||||
classroom = @signupState.get('classroom')
|
||||
if @signupState.get('path') is 'student'
|
||||
# force clearing of _cc GET param from url if on /courses
|
||||
# force clearing of _cc GET param from url if on /students
|
||||
application.router.navigate('/', {replace: true})
|
||||
application.router.navigate('/courses')
|
||||
application.router.navigate('/students')
|
||||
else
|
||||
application.router.navigate('/play')
|
||||
document.location.reload()
|
||||
|
|
|
@ -124,7 +124,7 @@ module.exports = class CreateAccountModal extends ModalView
|
|||
if @signupState.get('accountCreated') and not application.testing
|
||||
# ensure logged in state propagates through the entire app
|
||||
if me.isStudent()
|
||||
application.router.navigate('/courses', {trigger: true})
|
||||
application.router.navigate('/students', {trigger: true})
|
||||
else if me.isTeacher()
|
||||
application.router.navigate('/teachers/classes', {trigger: true})
|
||||
window.location.reload()
|
||||
|
|
|
@ -107,7 +107,7 @@ module.exports = class CourseEnrollView extends RootView
|
|||
# TODO: handle fetch errors
|
||||
me.fetch(cache: false).always =>
|
||||
courseID = @selectedCourse?.id ? @courses.models[0]?.id
|
||||
route = "/courses/#{courseID}"
|
||||
route = "/students/#{courseID}"
|
||||
viewArgs = [{}, courseID]
|
||||
if data?.length > 0
|
||||
courseInstanceID = data[0]._id
|
||||
|
|
|
@ -53,7 +53,7 @@ module.exports = class CoursesUpdateAccountView extends RootView
|
|||
me.becomeStudent({
|
||||
success: ->
|
||||
application.tracker?.trackEvent trackEventMsg, category: 'Courses Update Account'
|
||||
application.router.navigate('/courses', {trigger: true})
|
||||
application.router.navigate('/students', {trigger: true})
|
||||
error: ->
|
||||
$(targetElem).prop('disabled', false)
|
||||
errors.showNotyNetworkError(arguments...)
|
||||
|
|
|
@ -168,7 +168,7 @@ module.exports = class CoursesView extends RootView
|
|||
@state = null
|
||||
@renderSelectors '#join-class-form'
|
||||
|
||||
# Super hacky way to patch users being able to join class while hiding /courses from others
|
||||
# Super hacky way to patch users being able to join class while hiding /students from others
|
||||
onClassLoadError: ->
|
||||
_.defer ->
|
||||
application.router.routeDirectly('courses/RestrictedToStudentsView')
|
||||
|
@ -211,10 +211,10 @@ module.exports = class CoursesView extends RootView
|
|||
onClickViewClass: (e) ->
|
||||
classroomID = $(e.target).data('classroom-id')
|
||||
window.tracker?.trackEvent 'Students View Class', category: 'Students', classroomID: classroomID, ['Mixpanel']
|
||||
application.router.navigate("/courses/#{classroomID}", { trigger: true })
|
||||
application.router.navigate("/students/#{classroomID}", { trigger: true })
|
||||
|
||||
onClickViewLevels: (e) ->
|
||||
courseID = $(e.target).data('course-id')
|
||||
courseInstanceID = $(e.target).data('courseinstance-id')
|
||||
window.tracker?.trackEvent 'Students View Levels', category: 'Students', courseID: courseID, courseInstanceID: courseInstanceID, ['Mixpanel']
|
||||
application.router.navigate("/courses/#{courseID}/#{courseInstanceID}", { trigger: true })
|
||||
application.router.navigate("/students/#{courseID}/#{courseInstanceID}", { trigger: true })
|
||||
|
|
|
@ -12,7 +12,7 @@ module.exports = class InviteToClassroomModal extends ModalView
|
|||
initialize: (options) ->
|
||||
@classroom = options.classroom
|
||||
@classCode = @classroom.get('codeCamel') || @classroom.get('code')
|
||||
@joinURL = document.location.origin + "/courses?_cc=" + @classCode
|
||||
@joinURL = document.location.origin + "/students?_cc=" + @classCode
|
||||
|
||||
onClickSendInvitesButton: ->
|
||||
emails = @$('#invite-emails-textarea').val()
|
||||
|
|
|
@ -137,7 +137,7 @@ module.exports = class TeacherClassView extends RootView
|
|||
classCode = @classroom.get('codeCamel') or @classroom.get('code')
|
||||
@state.set {
|
||||
classCode: classCode
|
||||
joinURL: document.location.origin + "/courses?_cc=" + classCode
|
||||
joinURL: document.location.origin + "/students?_cc=" + classCode
|
||||
}
|
||||
@listenTo @courses, 'sync change update', ->
|
||||
@setCourseMembers() # Is this necessary?
|
||||
|
|
|
@ -98,7 +98,7 @@ module.exports = class ControlBarView extends CocoView
|
|||
@homeViewArgs.push leagueID
|
||||
@homeLink += "/#{leagueType}/#{leagueID}"
|
||||
else if @level.isType('course') or @courseID
|
||||
@homeLink = '/courses'
|
||||
@homeLink = '/students'
|
||||
@homeViewClass = 'views/courses/CoursesView'
|
||||
if @courseID
|
||||
@homeLink += "/#{@courseID}"
|
||||
|
|
|
@ -111,7 +111,7 @@ module.exports = class CourseVictoryModal extends ModalView
|
|||
if me.isSessionless()
|
||||
link = '/teachers/courses'
|
||||
else
|
||||
link = '/courses'
|
||||
link = '/students'
|
||||
application.router.navigate(link, {trigger: true})
|
||||
|
||||
onLadder: ->
|
||||
|
|
|
@ -437,7 +437,7 @@ module.exports = class HeroVictoryModal extends ModalView
|
|||
link += "?course=#{@courseID}"
|
||||
link += "&course-instance=#{@courseInstanceID}" if @courseInstanceID
|
||||
else if @level.isType('course')
|
||||
link = "/courses"
|
||||
link = "/students"
|
||||
if @courseID
|
||||
link += "/#{@courseID}"
|
||||
link += "/#{@courseInstanceID}" if @courseInstanceID
|
||||
|
|
|
@ -33,7 +33,7 @@ while (cursor.hasNext()) {
|
|||
classes.push({
|
||||
courseID: doc.courseID,
|
||||
courseInstanceID: doc._id,
|
||||
url: 'codecombat.com/courses/' + doc.courseID.valueOf() + '/' + doc._id.valueOf(),
|
||||
url: 'codecombat.com/students/' + doc.courseID.valueOf() + '/' + doc._id.valueOf(),
|
||||
ownerID: doc.ownerID,
|
||||
createDate: ownerID.getTimestamp(),
|
||||
memberCount: doc.members.length,
|
||||
|
|
|
@ -280,7 +280,7 @@ module.exports =
|
|||
email_data:
|
||||
teacher_name: req.user.broadName()
|
||||
class_name: classroom.get('name')
|
||||
join_link: "https://codecombat.com/courses?_cc=" + joinCode
|
||||
join_link: "https://codecombat.com/students?_cc=" + joinCode
|
||||
join_code: joinCode
|
||||
sendwithus.api.send context, _.noop
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
CoursesUpdateAccountView = require 'views/courses/CoursesUpdateAccountView'
|
||||
factories = require 'test/app/factories'
|
||||
|
||||
describe '/courses/update-account', ->
|
||||
describe '/students/update-account', ->
|
||||
|
||||
describe 'when logged out', ->
|
||||
beforeEach (done) ->
|
||||
|
|
Loading…
Reference in a new issue