Skip to content

Commit

Permalink
[#122][Crum/Flashcards] Pass Active Dialects in the Next and Prev Links.
Browse files Browse the repository at this point in the history
  • Loading branch information
pishoyg committed Aug 11, 2024
1 parent 9acfe13 commit d9d66fd
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions flashcards/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,13 @@ def dialect(col: str) -> field.Field:
el.classList.add('very-light');
}
});
navigateQuery = "?d=" + dialects.filter((d) => {
return dialectStyle.get(d) == 'bold'; }).join(',');
document.querySelectorAll('.navigate').forEach((el) => {
let url = new URL(el.getAttribute('href'));
url.searchParams.delete('d');
el.setAttribute('href', url.toString() + navigateQuery);
});
}
Array.prototype.forEach.call(els, (btn) => {
btn.classList.add('hover-link');
Expand Down Expand Up @@ -389,7 +396,7 @@ def dialect(col: str) -> field.Field:
# TODO: Update the home page, it will no longer be the repo.
f"""<table class="bordered" style="width: 100%; table-layout: fixed;"> <tr> <td><a href="{HOME}">Home</a></td> <td>""",
field.aon(
f'<a href="{PARENT_URL}/',
f'<a class="navigate" href="{PARENT_URL}/',
roots_col("key-prev", force=False),
'.html">prev</a>',
),
Expand All @@ -401,7 +408,7 @@ def dialect(col: str) -> field.Field:
},
),
field.aon(
f'<a href="{PARENT_URL}/',
f'<a class="navigate" href="{PARENT_URL}/',
roots_col("key-next", force=False),
'.html">next</a>',
),
Expand Down

0 comments on commit d9d66fd

Please sign in to comment.