Closed blackhydrogen closed 9 years ago
I did something like that. Not 100% sure if this is the way to go though. @TheFuzzy can confirm if we should do the below format or use hard-coded paths.
'<img src="' + sewi.staticPath +'images/image_tooltip_grayscale.png">'
Alternatively, do something like the following:
RESOURCE_GALLERY_RESOURCE_THUMBNAIL_CONTAINER_DOM: '<div class="resource-thumbnail-container"></div>',
RESOURCE_GALLERY_RESOURCE_THUMBNAIL_DOM: '<div class="resource-thumbnail-container"><img class="resource-thumbnail"></div>',
RESOURCE_GALLERY_LOADING_THUMBNAIL: 'images/loading.gif',
RESOURCE_GALLERY_DEFAULT_THUMBNAIL: 'images/default_thumbnail.png',
Then later in code you could do something like:
var loadingThumbnailPath = sewi.staticPath + sewi.constants.RESOURCE_GALLERY_LOADING_THUMBNAIL;
var defaultThumbnailPath = sewi.staticPath + sewi.constants.RESOURCE_GALLERY_DEFAULT_THUMBNAIL;
...
var thumbnailContainer = $(sewi.constants.RESOURCE_GALLERY_RESOURCE_THUMBNAIL_CONTAINER_DOM);
var thumbnail = $(sewi.constants.RESOURCE_GALLERY_RESOURCE_THUMBNAIL_DOM).attr('src', loadingThumbnailPath);
...
if (failedToLoad) {
thumbnail.attr('src', defaultThumbnailPath);
}
Found them by chance. The two constants are: RESOURCE_GALLERY_DEFAULT_THUMBNAIL RESOURCE_GALLERY_RESOURCE_THUMBNAIL_DOM