Skip to content

Commit

Permalink
Merge pull request #7 from SPANDigital/hotfix/tooltip-broken-link
Browse files Browse the repository at this point in the history
Fix broken link on tooltip.
  • Loading branch information
dominicfollett authored Jun 19, 2017
2 parents 878f242 + 1268127 commit d3c7ff1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/tooltips/tooltips.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function addToDom(term, content, url) {
*/
export function createTooltip(term, page, url) {

let title = url ? url.substr(url.lastIndexOf('/') + 1).replace('#', '') : slugify(term.innerText);
let title = url.substr(url.lastIndexOf('/') + 1).replace('#', '')
let match = parser.parseFromString(page, "text/html").querySelector(`span.anchor[id="${title}"]`);

if (match) {
Expand Down Expand Up @@ -72,7 +72,8 @@ export function loadTooltips(config = {}) {
if (glossaryTerms.length > 0) {
axios.get(`${config.baseurl}/glossary/`).then((response) => {
glossaryTerms.forEach((term) => {
createTooltip(term, response.data)
let url = `${config.baseurl}/glossary/#${slugify(term.innerText)}`;
createTooltip(term, response.data, url);
});
}).catch((error) => {
tooltipError(error, glossaryTerms)
Expand Down

0 comments on commit d3c7ff1

Please sign in to comment.