Skip to content

Commit e297020

Browse files
committed
Fix GTT settings view and dynamically create font-face rule for Material Design Icons
1 parent 043ef7f commit e297020

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

app/views/settings/gtt/_settings.html.erb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,17 @@
2323
});
2424
}
2525

26-
// Activate tab if it is specified in the URL
2726
document.addEventListener('DOMContentLoaded', function() {
27+
28+
// Activate tab if it is specified in the URL
2829
var tab = getQueryParam('tab');
2930
if (tab) {
3031
activateTab(tab);
3132
}
32-
});
3333

34-
// Apply settings
35-
window.gtt_setting();
34+
// Apply GTT settings
35+
if (typeof window.gtt_setting === 'function') {
36+
window.gtt_setting();
37+
}
38+
});
3639
<% end %>

src/styles/icons/material-design/material-design-def.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7304,6 +7304,19 @@ const iconMappings: { [key: string]: any } = {
73047304
const mdiWebfontMeta = document.querySelector('meta[name="gtt-font-mdi-webfont"]');
73057305
const mdiWebfontUrl = mdiWebfontMeta ? mdiWebfontMeta.getAttribute('content') : 'data:application/font-woff2;base64,'; // Provide a data URL for an empty font
73067306

7307+
// Dynamically create the @font-face rule
7308+
const style = document.createElement('style');
7309+
style.type = 'text/css';
7310+
style.innerHTML = `
7311+
@font-face {
7312+
font-family: 'Material Design Icons';
7313+
src: url(${mdiWebfontUrl}) format('woff2');
7314+
font-weight: normal;
7315+
font-style: normal;
7316+
}
7317+
`;
7318+
document.head.appendChild(style);
7319+
73077320
// Define the font face
73087321
let mdiFont: FontFace;
73097322
mdiFont = new FontFace('materialdesignicons', `url(${mdiWebfontUrl})`);

0 commit comments

Comments
 (0)