js function to ingest icons

This commit is contained in:
Matthias 2021-09-01 02:18:41 +02:00
parent ef6d40bb68
commit 0b8a88e216
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076

View File

@ -130,6 +130,11 @@ function inventreeDocReady() {
minLength: 2, minLength: 2,
classes: {'ui-autocomplete': 'dropdown-menu search-menu'}, classes: {'ui-autocomplete': 'dropdown-menu search-menu'},
}); });
// Generate brand-icons
$('.brand-icon').each(function(i, obj){
loadBrandIcon($(this), $(this).attr('brand_name'));
});
} }
function isFileTransfer(transfer) { function isFileTransfer(transfer) {
@ -381,4 +386,14 @@ function inventreeDel(name) {
var key = 'inventree-' + name; var key = 'inventree-' + name;
localStorage.removeItem(key); localStorage.removeItem(key);
} }
function loadBrandIcon(elem, name) {
// check if icon exists
var icon = window.FontAwesome.icon({prefix: 'fab', iconName: name});
if (icon){
// add icon to button
elem.addClass('fab fa-' + name);
}
}