mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 23:58:02 -05:00
Levels link in ControlBarView goes to last visited course instance page for course levels
This commit is contained in:
parent
e1b10183eb
commit
9e04d425cc
4 changed files with 19 additions and 3 deletions
|
@ -315,6 +315,10 @@ _.extend UserSchema.properties,
|
||||||
country: { type: 'string', enum: ['brazil', 'china'] } # New, supports multiple countries for different versions--only set for specific countries where we have premium servers right now
|
country: { type: 'string', enum: ['brazil', 'china'] } # New, supports multiple countries for different versions--only set for specific countries where we have premium servers right now
|
||||||
|
|
||||||
clans: c.array {}, c.objectId()
|
clans: c.array {}, c.objectId()
|
||||||
|
currentCourse: c.object {}, {
|
||||||
|
courseID: c.objectId({})
|
||||||
|
courseInstanceID: c.objectId({})
|
||||||
|
}
|
||||||
|
|
||||||
c.extendBasicProperties UserSchema, 'user'
|
c.extendBasicProperties UserSchema, 'user'
|
||||||
|
|
||||||
|
|
|
@ -125,6 +125,13 @@ module.exports = class CourseDetailsView extends RootView
|
||||||
@supermodel.loadCollection @levelSessions, 'level_sessions', cache: false
|
@supermodel.loadCollection @levelSessions, 'level_sessions', cache: false
|
||||||
@members = new CocoCollection([], { url: "/db/course_instance/#{@courseInstance.id}/members", model: User, comparator: 'nameLower' })
|
@members = new CocoCollection([], { url: "/db/course_instance/#{@courseInstance.id}/members", model: User, comparator: 'nameLower' })
|
||||||
@listenToOnce @members, 'sync', @onMembersSync
|
@listenToOnce @members, 'sync', @onMembersSync
|
||||||
|
me.set({
|
||||||
|
currentCourse: {
|
||||||
|
courseInstanceID: @courseInstance.id,
|
||||||
|
courseID: @course.id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
me.patch()
|
||||||
@supermodel.loadCollection @members, 'members', cache: false
|
@supermodel.loadCollection @members, 'members', cache: false
|
||||||
if @adminMode and prepaidID = @courseInstance.get('prepaidID')
|
if @adminMode and prepaidID = @courseInstance.get('prepaidID')
|
||||||
@prepaid = @supermodel.getModel(Prepaid, prepaidID) or new Prepaid _id: prepaidID
|
@prepaid = @supermodel.getModel(Prepaid, prepaidID) or new Prepaid _id: prepaidID
|
||||||
|
|
|
@ -28,8 +28,9 @@ module.exports = class ControlBarView extends CocoView
|
||||||
'click #control-bar-sign-up-button': 'onClickSignupButton'
|
'click #control-bar-sign-up-button': 'onClickSignupButton'
|
||||||
|
|
||||||
constructor: (options) ->
|
constructor: (options) ->
|
||||||
@courseID = options.courseID
|
currentCourse = me.get('currentCourse') or {}
|
||||||
@courseInstanceID = options.courseInstanceID
|
@courseID = options.courseID or currentCourse.courseID
|
||||||
|
@courseInstanceID = options.courseInstanceID or currentCourse.courseInstanceID
|
||||||
|
|
||||||
@worldName = options.worldName
|
@worldName = options.worldName
|
||||||
@session = options.session
|
@session = options.session
|
||||||
|
|
|
@ -17,6 +17,10 @@ UserSchema = new mongoose.Schema({
|
||||||
dateCreated:
|
dateCreated:
|
||||||
type: Date
|
type: Date
|
||||||
'default': Date.now
|
'default': Date.now
|
||||||
|
currentCourse: {
|
||||||
|
courseID: mongoose.Schema.Types.ObjectId
|
||||||
|
courseInstanceID: mongoose.Schema.Types.ObjectId
|
||||||
|
}
|
||||||
}, {strict: false})
|
}, {strict: false})
|
||||||
|
|
||||||
UserSchema.index({'dateCreated': 1})
|
UserSchema.index({'dateCreated': 1})
|
||||||
|
@ -312,7 +316,7 @@ UserSchema.statics.editableProperties = [
|
||||||
'firstName', 'lastName', 'gender', 'ageRange', 'facebookID', 'gplusID', 'emails',
|
'firstName', 'lastName', 'gender', 'ageRange', 'facebookID', 'gplusID', 'emails',
|
||||||
'testGroupNumber', 'music', 'hourOfCode', 'hourOfCodeComplete', 'preferredLanguage',
|
'testGroupNumber', 'music', 'hourOfCode', 'hourOfCodeComplete', 'preferredLanguage',
|
||||||
'wizard', 'aceConfig', 'autocastDelay', 'lastLevel', 'jobProfile', 'savedEmployerFilterAlerts',
|
'wizard', 'aceConfig', 'autocastDelay', 'lastLevel', 'jobProfile', 'savedEmployerFilterAlerts',
|
||||||
'heroConfig', 'iosIdentifierForVendor', 'siteref', 'referrer'
|
'heroConfig', 'iosIdentifierForVendor', 'siteref', 'referrer', 'currentCourse'
|
||||||
]
|
]
|
||||||
|
|
||||||
UserSchema.plugin plugins.NamedPlugin
|
UserSchema.plugin plugins.NamedPlugin
|
||||||
|
|
Loading…
Reference in a new issue