Use placeholder images for item groups
This commit is contained in:
@@ -13,8 +13,10 @@ module.exports = class ImageLoader
|
||||
|
||||
constructor: (options={})->
|
||||
options.defaultUrl ?= null
|
||||
options.onLoading ?= -> @hide()
|
||||
options.onLoad ?= -> @show()
|
||||
|
||||
if not options.defaultUrl?
|
||||
options.onLoading ?= -> @hide()
|
||||
options.onLoad ?= -> @show()
|
||||
|
||||
@defaultUrl = options.defaultUrl
|
||||
@onLoading = options.onLoading
|
||||
@@ -22,6 +24,10 @@ module.exports = class ImageLoader
|
||||
|
||||
@_images = {}
|
||||
|
||||
if @defaultUrl
|
||||
@_defaultImage = new Image
|
||||
@_defaultImage.src = @defaultUrl
|
||||
|
||||
# Class Methods ################################################################################
|
||||
|
||||
@load: (imageUrl, $el, options={}) ->
|
||||
@@ -48,7 +54,11 @@ module.exports = class ImageLoader
|
||||
if data.isLoaded
|
||||
@_loadImageIntoElement data.imageUrl, $el
|
||||
else
|
||||
$el.removeAttr 'src'
|
||||
if @defaultUrl?
|
||||
$el.attr 'src', @defaultUrl
|
||||
else
|
||||
$el.removeAttr 'src'
|
||||
|
||||
if data.elements.indexOf($el) is -1 then data.elements.push $el
|
||||
|
||||
return this
|
||||
|
||||
@@ -129,7 +129,7 @@ module.exports = class ModPageController extends BaseController
|
||||
$link.slideDown duration:Duration.normal
|
||||
$link.attr 'href', url
|
||||
else
|
||||
$link.sludeUp duration:Duration.normal
|
||||
$link.slideUp duration:Duration.normal
|
||||
|
||||
_refreshVersions: ->
|
||||
@$versionSelector.empty()
|
||||
|
||||
Reference in New Issue
Block a user