mirror of
https://github.com/ansible/awx.git
synced 2026-03-07 11:41:08 -03:30
Always render svg icons inline
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
<nav class="SetupMenu Container-main">
|
<nav class="SetupMenu Container-main">
|
||||||
<a href="#/credentials" class="SetupItem HoverIcon Media">
|
<a href="#/credentials" class="SetupItem HoverIcon Media">
|
||||||
<i class="SetupItem-icon HoverIcon-icon HoverIcon-icon--color Media-figure">
|
<i class="SetupItem-icon HoverIcon-icon HoverIcon-icon--color Media-figure">
|
||||||
<aw-icon name="Credentials" inline></aw-icon>
|
<aw-icon name="Credentials"></aw-icon>
|
||||||
</i>
|
</i>
|
||||||
<div class="Media-body">
|
<div class="Media-body">
|
||||||
<h4 class="SetupItem-title">Credentials</h4>
|
<h4 class="SetupItem-title">Credentials</h4>
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
</a>
|
</a>
|
||||||
<a href="#/users" class="SetupItem HoverIcon Media">
|
<a href="#/users" class="SetupItem HoverIcon Media">
|
||||||
<i class="SetupItem-icon HoverIcon-icon HoverIcon-icon--color Media-figure">
|
<i class="SetupItem-icon HoverIcon-icon HoverIcon-icon--color Media-figure">
|
||||||
<aw-icon name="Users" inline></aw-icon>
|
<aw-icon name="Users"></aw-icon>
|
||||||
</i>
|
</i>
|
||||||
<div class="Media-body">
|
<div class="Media-body">
|
||||||
<h4 class="SetupItem-title">Users</h4>
|
<h4 class="SetupItem-title">Users</h4>
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
</a>
|
</a>
|
||||||
<a href="#/teams" class="SetupItem HoverIcon Media">
|
<a href="#/teams" class="SetupItem HoverIcon Media">
|
||||||
<i class="SetupItem-icon HoverIcon-icon HoverIcon-icon--color Media-figure">
|
<i class="SetupItem-icon HoverIcon-icon HoverIcon-icon--color Media-figure">
|
||||||
<aw-icon name="Teams" inline></aw-icon>
|
<aw-icon name="Teams"></aw-icon>
|
||||||
</i>
|
</i>
|
||||||
<div class="Media-block">
|
<div class="Media-block">
|
||||||
<h4 class="SetupItem-title">Teams</h4>
|
<h4 class="SetupItem-title">Teams</h4>
|
||||||
|
|||||||
@@ -3,32 +3,22 @@ export default function() {
|
|||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
templateUrl: '/static/js/shared/icon/icon.partial.html',
|
templateUrl: '/static/js/shared/icon/icon.partial.html',
|
||||||
scope: {
|
scope: {
|
||||||
isInline: '@inline'
|
|
||||||
},
|
},
|
||||||
link: function(scope, element, attrs) {
|
link: function(scope, element, attrs) {
|
||||||
var svg = $('svg', element);
|
var svg = $('svg', element);
|
||||||
var iconPath = '#' + attrs.name;
|
var iconPath = '#' + attrs.name;
|
||||||
|
|
||||||
scope.isInline = scope.isInline === "true";
|
// Make a copy of the <symbol> tag to insert its contents into this
|
||||||
|
// element's svg tag
|
||||||
|
var content = $(iconPath).clone();
|
||||||
|
|
||||||
if(angular.isDefined(attrs.inline)) {
|
// Copy classes off the <symbol> so that we preserve any styling
|
||||||
// Make a copy of the <symbol> tag to insert its contents into this
|
// when we copy the item inline
|
||||||
// element's svg tag
|
var classes = $(iconPath).attr('class');
|
||||||
var content = $(iconPath).clone();
|
|
||||||
|
|
||||||
// Copy classes off the <symbol> so that we preserve any styling
|
svg.attr('class', classes)
|
||||||
// when we copy the item inline
|
.html(content.contents());
|
||||||
var classes = $(iconPath).attr('class');
|
|
||||||
|
|
||||||
svg.attr('class', classes)
|
|
||||||
.html(content.contents());
|
|
||||||
} else {
|
|
||||||
// Using string concatenation here because <use> needs to be
|
|
||||||
// generated without a close tag, but jQuery will NOT allow us
|
|
||||||
// to create it without a closing tag :(
|
|
||||||
var use = '<use xlink:href="' + iconPath + '">';
|
|
||||||
svg.html(use);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user