-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update breadcrumb to use text instead of an icon * new search template * update search js location * search page amends & fixes Co-authored-by: Nathan Rogan <nathan.rogan@wmca.org.uk>
- Loading branch information
1 parent
0687c44
commit 956347b
Showing
7 changed files
with
91 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 29 additions & 25 deletions
54
src/www/pages/templates/campaign-two-columns/campaign-template.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,37 @@ | ||
const pageContents = () => { | ||
const headings = document.querySelectorAll('main h2'); | ||
const contents = document.querySelector('.wmcads-page-contents'); | ||
|
||
headings.forEach(heading => { | ||
const str = heading.innerHTML; | ||
const linkStr = str.toLowerCase().replaceAll(' ', '-'); | ||
const link = `#${linkStr}`; | ||
if (contents != null) { | ||
const headings = document.querySelectorAll('main h2'); | ||
|
||
// add id to all the h2 | ||
heading.setAttribute('id', linkStr); | ||
headings.forEach(heading => { | ||
const str = heading.innerHTML; | ||
const linkStr = str.toLowerCase().replaceAll(' ', '-'); | ||
const link = `#${linkStr}`; | ||
|
||
// function to decode htmlentities | ||
function decodeHtml(html) { | ||
const txt = document.createElement('textarea'); | ||
txt.innerHTML = html; | ||
return txt.value; | ||
} | ||
// function to add a link to the page contents | ||
function createMenuItem() { | ||
const li = document.createElement('a'); | ||
li.textContent = decodeHtml(str); | ||
li.setAttribute('href', link); | ||
return li; | ||
} | ||
// add id to all the h2 | ||
heading.setAttribute('id', linkStr); | ||
|
||
// get the page contents | ||
const menu = document.querySelector('.wmcads-page-contents'); | ||
// add page contents link | ||
menu.appendChild(createMenuItem()); | ||
}); | ||
// function to decode htmlentities | ||
function decodeHtml(html) { | ||
const txt = document.createElement('textarea'); | ||
txt.innerHTML = html; | ||
return txt.value; | ||
} | ||
// function to add a link to the page contents | ||
function createMenuItem() { | ||
const li = document.createElement('a'); | ||
li.textContent = decodeHtml(str); | ||
li.setAttribute('href', link); | ||
return li; | ||
} | ||
|
||
// get the page contents | ||
const menu = document.querySelector('.wmcads-page-contents'); | ||
// add page contents link | ||
menu.appendChild(createMenuItem()); | ||
}); | ||
} | ||
}; | ||
|
||
export default pageContents; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters