Commit deb56f21 authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett

[ci skip] Use favicon full path

parent 9daf4f64
...@@ -364,9 +364,9 @@ ...@@ -364,9 +364,9 @@
}); });
}; };
w.gl.utils.setFavicon = (iconName) => { w.gl.utils.setFavicon = (faviconPath) => {
if (faviconEl && iconName) { if (faviconEl && faviconPath) {
faviconEl.setAttribute('href', `/assets/${iconName}.ico`); faviconEl.setAttribute('href', faviconPath);
} }
}; };
...@@ -382,7 +382,7 @@ ...@@ -382,7 +382,7 @@
dataType: 'json', dataType: 'json',
success: function(data) { success: function(data) {
if (data && data.icon) { if (data && data.icon) {
gl.utils.setFavicon(`ci_favicons/${data.icon}`); gl.utils.setFavicon(data.favicon);
} else { } else {
gl.utils.resetFavicon(); gl.utils.resetFavicon();
} }
......
...@@ -121,4 +121,8 @@ module CiStatusHelper ...@@ -121,4 +121,8 @@ module CiStatusHelper
status.respond_to?(:label) && status.respond_to?(:label) &&
status.respond_to?(:icon) status.respond_to?(:icon)
end end
def ci_status_favicon_path(favicon_name)
ActionController::Base.helpers.image_path(File.join('ci_favicons', "#{favicon_name}.ico"))
end
end end
class StatusEntity < Grape::Entity class StatusEntity < Grape::Entity
include RequestAwareEntity include RequestAwareEntity
include CiStatusHelper
expose :icon, :favicon, :text, :label, :group format_with(:status_favicon_path) do |favicon_name|
ci_status_favicon_path(favicon_name)
end
expose :icon, :text, :label, :group
expose :has_details?, as: :has_details expose :has_details?, as: :has_details
expose :details_path expose :details_path
expose :favicon, format_with: :status_favicon_path
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment