| 51 | schoolAdministratorBackUrl () { return this.classroom && `/school-administrator/teacher/${(this.classroom != null ? this.classroom.ownerID : undefined)}/classroom/${(this.classroom != null ? this.classroom._id : undefined)}` } |
| 52 | }, |
| 53 | created () { |
| 54 | return Promise.all([ |
| 55 | api.courseInstances.getProjectGallery({ courseInstanceID: this.courseInstanceID }).then(levelSessions => { |
| 56 | this.levelSessions = levelSessions |
| 57 | }), |
| 58 | api.courseInstances.get({ courseInstanceID: this.courseInstanceID }).then(courseInstance => { |
| 59 | this.courseInstance = courseInstance |
| 60 | return Promise.all([ |
| 61 | api.classrooms.get({ classroomID: this.courseInstance.classroomID }).then(classroom => { |
| 62 | this.classroom = classroom |
| 63 | }).then(() => { |
| 64 | return api.classrooms.getMembers({ classroom: this.classroom }, { removeDeleted: true }).then(users => { |
| 65 | this.users = users |
| 66 | }) |
| 67 | }), |
| 68 | api.courses.get({ courseID: this.courseInstance.courseID }).then(course => { |
| 69 | this.course = course |
| 70 | }), |
| 71 | api.classrooms.getCourseLevels({ classroomID: this.courseInstance.classroomID, courseID: this.courseInstance.courseID }).then(levels => { |
| 72 | this.levels = levels |
| 73 | }) |
| 74 | ]) |
| 75 | }) |
| 76 | ]).then(() => { |
| 77 | userClassroomHelper.isSchoolAdminOf({ user: me, classroomId: this.courseInstance.classroomID }).then(res => { return this.amSchoolAdministratorOfGallery = res }) |
| 78 | userClassroomHelper.isTeacherOf({ user: me, classroomId: this.courseInstance.classroomID }).then(res => { return this.amTeacherOfGallery = res }) |
| 79 | this.level = _.find(this.levels, Level.isProject) |
| 80 | return this.users.forEach(user => { |
| 81 | return Vue.set(user, 'broadName', User.broadName(user)) |
| 82 | }) |
| 83 | }) |
| 84 | }, |
| 85 | methods: { |
| 86 | getProjectViewUrl (session) { |
| 87 | return `/play/${(this.level != null ? this.level.type : undefined)}-level/${(this.level != null ? this.level.slug : undefined)}/${session._id}` |