IE9 hacks

* GET params in a url sent through router.navigate are lost on IE9, use document.location.href = url instead
* Temporarily put raster images in the DOM to give them dimensions so they are rendered in the spritesheet correctly
* Add {cache: false} to fetches for /hoc course instances and sessions
This commit is contained in:
Scott Erickson 2015-12-04 15:50:07 -08:00
parent a573f49c98
commit 31b65ef247
2 changed files with 9 additions and 4 deletions
app

View file

@ -480,10 +480,15 @@ module.exports = LayerAdapter = class LayerAdapter extends CocoClass
unless thangType.rasterImage
console.error("Cannot render the LayerAdapter SpriteSheet until the raster image for <#{thangType.get('name')}> is loaded.")
# hack for IE9, otherwise width/height are not set
$img = $(thangType.rasterImage[0])
$('body').append($img)
bm = new createjs.Bitmap(thangType.rasterImage[0])
scale = thangType.get('scale') or 1
frame = spriteSheetBuilder.addFrame(bm, null, scale)
spriteSheetBuilder.addAnimation(@renderGroupingKey(thangType), [frame], false)
$img.remove()
#- Distributing new Segmented/Singular/RasterSprites to Lanks

View file

@ -28,7 +28,7 @@ module.exports = class HourOfCodeView extends RootView
@courseInstances = new CocoCollection([], { url: "/db/user/#{me.id}/course_instances", model: CourseInstance})
@listenToOnce @courseInstances, 'sync', @onCourseInstancesLoaded
@courseInstances.comparator = (ci) -> return ci.get('classroomID') + ci.get('courseID')
@supermodel.loadCollection(@courseInstances, 'course_instances')
@supermodel.loadCollection(@courseInstances, 'course_instances', { cache: false })
onCourseInstancesLoaded: ->
@hourOfCodeCourseInstance = @courseInstances.findWhere({hourOfCode: true})
@ -39,7 +39,7 @@ module.exports = class HourOfCodeView extends RootView
})
@sessions.comparator = 'created'
@listenTo @sessions, 'sync', @onSessionsLoaded
@supermodel.loadCollection(@sessions, 'sessions')
@supermodel.loadCollection(@sessions, 'sessions', { cache: false })
onSessionsLoaded: ->
@lastSession = @sessions.last()
@ -88,10 +88,10 @@ module.exports = class HourOfCodeView extends RootView
@$('#main-content').hide()
@$('#begin-hoc-area').removeClass('hide')
hocCourseInstance = new CourseInstance()
hocCourseInstance.upsertForHOC()
hocCourseInstance.upsertForHOC({cache: false})
@listenToOnce hocCourseInstance, 'sync', ->
url = hocCourseInstance.firstLevelURL()
app.router.navigate(url, { trigger: true })
document.location.href = url
onClickLogInButton: ->
modal = new StudentLogInModal()