Merge branch 'broken_iamge_when_doing_offline_update_check(help_page)' into 'master'

fix broken image when doing offline update check(help page)

Closes #25982

See merge request !8355
This commit is contained in:
Clement Ho 2017-01-24 20:22:49 +00:00
commit 70d29ad858
4 changed files with 19 additions and 1 deletions

View file

@ -261,6 +261,9 @@
case 'projects:artifacts:browse':
new BuildArtifacts();
break;
case 'help:index':
gl.VersionCheckImage.bindErrorEvent($('img.js-version-status-badge'));
break;
case 'search:show':
new Search();
break;

View file

@ -0,0 +1,10 @@
(() => {
class VersionCheckImage {
static bindErrorEvent(imageElement) {
imageElement.off('error').on('error', () => imageElement.hide());
}
}
window.gl = window.gl || {};
gl.VersionCheckImage = VersionCheckImage;
})();

View file

@ -1,7 +1,8 @@
module VersionCheckHelper
def version_status_badge
if Rails.env.production? && current_application_settings.version_check_enabled
image_tag VersionCheck.new.url
image_url = VersionCheck.new.url
image_tag image_url, class: 'js-version-status-badge'
end
end
end

View file

@ -0,0 +1,4 @@
---
title: Hide version check image if there is no internet connection
merge_request: 8355
author: Ken Ding