diff options
author | Tim Zallmann <tzallmann@gitlab.com> | 2017-09-22 11:39:47 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-09-22 11:39:47 +0300 |
commit | 55f772bb98a67ad346442a2cacb5646f6719b987 (patch) | |
tree | fdcda42d5ee9c746b5654a50fa88a0fd1464d3a8 /app/assets/javascripts/lib | |
parent | d103e95513704314a38ab8ae441851524031c4a1 (diff) |
Resolve "Better SVG Usage in the Frontend"
Diffstat (limited to 'app/assets/javascripts/lib')
-rw-r--r-- | app/assets/javascripts/lib/utils/common_utils.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/assets/javascripts/lib/utils/common_utils.js b/app/assets/javascripts/lib/utils/common_utils.js index ead1b8f99d3..ea2d61af9be 100644 --- a/app/assets/javascripts/lib/utils/common_utils.js +++ b/app/assets/javascripts/lib/utils/common_utils.js @@ -408,6 +408,10 @@ export const setCiStatusFavicon = (pageUrl) => { }); }; +export const spriteIcon = icon => `<svg><use xlink:href="${gon.sprite_icons}#${icon}" /></svg>`; + +export const imagePath = imgUrl => `${gon.asset_host || ''}${gon.relative_url_root || ''}/assets/${imgUrl}`; + window.gl = window.gl || {}; window.gl.utils = { ...(window.gl.utils || {}), @@ -434,4 +438,6 @@ window.gl.utils = { getSelectedFragment, insertText, nodeMatchesSelector, + spriteIcon, + imagePath, }; |