Skip to content

Commit c752315

Browse files
Merge pull request #91 from kallewesterling/main
Moving error messages to top of page
2 parents 13370db + d44af15 commit c752315

1 file changed

Lines changed: 23 additions & 5 deletions

File tree

production/skilljar-theme-v2.1.js

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,6 +1374,10 @@ function styleCatalog() {
13741374
.querySelector("#skilljar-content")
13751375
.append(v.global.footerContainer);
13761376

1377+
document
1378+
.querySelector("#skilljar-content")
1379+
.prepend(document.querySelector("#messages"));
1380+
13771381
v.local.catalogBodyParentContainer.append(v.local.catalogContainer);
13781382

13791383
hide(v.local.catalogBodyParentContainer);
@@ -1556,6 +1560,10 @@ function stylePathCourseDetails() {
15561560
document
15571561
.querySelector("#skilljar-content")
15581562
.append(v.global.footerContainer);
1563+
1564+
document
1565+
.querySelector("#skilljar-content")
1566+
.prepend(document.querySelector("#messages"));
15591567
} else {
15601568
console.warn(`Tried to load ${skilljarPath.slug} path unsuccessfully.`);
15611569
}
@@ -1653,6 +1661,10 @@ function stylePathCatalogPage() {
16531661
document
16541662
.querySelector("#skilljar-content")
16551663
.append(v.global.footerContainer);
1664+
1665+
document
1666+
.querySelector("#skilljar-content")
1667+
.prepend(document.querySelector("#messages"));
16561668
} else {
16571669
console.warn(`Tried to load ${skilljarPath.slug} path unsuccessfully.`);
16581670
}
@@ -2936,13 +2948,19 @@ function shoot() {
29362948
});
29372949
}
29382950

2939-
document.addEventListener('DOMContentLoaded', function() {
2940-
const checkbox = document.getElementById('cg-baseurl-staging');
2951+
document.addEventListener("DOMContentLoaded", function () {
2952+
const checkbox = document.getElementById("cg-baseurl-staging");
29412953

29422954
if (checkbox) {
29432955
function updateLinks(useTestDomain) {
2944-
const links = document.querySelectorAll('a[href*="' + DOMAIN.prod.url + '"], a[href*="' + DOMAIN.stage.url + '"]');
2945-
links.forEach(link => {
2956+
const links = document.querySelectorAll(
2957+
'a[href*="' +
2958+
DOMAIN.prod.url +
2959+
'"], a[href*="' +
2960+
DOMAIN.stage.url +
2961+
'"]'
2962+
);
2963+
links.forEach((link) => {
29462964
const url = new URL(link.href);
29472965
if (useTestDomain && url.hostname === DOMAIN.prod.url) {
29482966
url.hostname = DOMAIN.stage.url;
@@ -2957,7 +2975,7 @@ document.addEventListener('DOMContentLoaded', function() {
29572975
updateLinks(checkbox.checked);
29582976

29592977
// toggle behavior
2960-
checkbox.addEventListener('change', function() {
2978+
checkbox.addEventListener("change", function () {
29612979
updateLinks(this.checked);
29622980
});
29632981
}

0 commit comments

Comments
 (0)