| 136 | } |
| 137 | |
| 138 | static initClass () { |
| 139 | this.prototype.id = 'ladder-view' |
| 140 | this.prototype.template = require('app/templates/play/ladder/ladder') |
| 141 | this.prototype.usesSocialMedia = true |
| 142 | this.prototype.showBackground = false |
| 143 | |
| 144 | this.prototype.subscriptions = |
| 145 | { |
| 146 | 'application:idle-changed': 'onIdleChanged', |
| 147 | 'ladder:refresh': 'updateSpectateList', |
| 148 | } |
| 149 | |
| 150 | this.prototype.events = { |
| 151 | 'click .play-button': 'onClickPlayButton', |
| 152 | 'click a:not([data-toggle])': 'onClickedLink', |
| 153 | 'click .publish-button': 'onClickPublishButton', |
| 154 | 'click .spectate-button': 'onClickSpectateButton', |
| 155 | 'click .new-spectate-button': 'onClickNewSpectateButton', |
| 156 | 'click .simulate-all-button': 'onClickSimulateAllButton', |
| 157 | 'click .early-results-button': 'onClickEarlyResultsButton', |
| 158 | 'click .join-clan-button': 'onClickJoinClanButton', |
| 159 | } |
| 160 | |
| 161 | this.prototype.onCourseInstanceLoaded = co.wrap(function * (courseInstance) { |
| 162 | this.courseInstance = courseInstance |
| 163 | if (this.destroyed) { return } |
| 164 | this.classroomID = this.courseInstance.get('classroomID') |
| 165 | this.ownerID = this.courseInstance.get('ownerID') |
| 166 | this.isSchoolAdmin = yield userClassroomHelper.isSchoolAdminOf({ user: me, classroomId: this.classroomID }) |
| 167 | this.isTeacher = yield userClassroomHelper.isTeacherOf({ user: me, classroomId: this.classroomID }) |
| 168 | const course = new Course({ _id: this.courseInstance.get('courseID') }) |
| 169 | this.course = this.supermodel.loadModel(course).model |
| 170 | return this.listenToOnce(this.course, 'sync', this.render) |
| 171 | }) |
| 172 | |
| 173 | this.prototype.teamOffers = [ |
| 174 | { slug: 'hyperx', clanId: '60a4378875b540004c78f121', name: 'Team HyperX', clanSlug: 'hyperx' }, |
| 175 | { slug: 'derbezt', clanId: '601351bb4b79b4013e198fbe', name: 'Team DerBezt', clanSlug: 'team-derbezt' }, |
| 176 | ] |
| 177 | } |
| 178 | |
| 179 | calcTimeOffset () { |
| 180 | return $.ajax({ |