Skip to content

Commit

Permalink
T1643 - Letter writing child selection (#34)
Browse files Browse the repository at this point in the history
* Current child id injected in the links using a querySelector

* Formatting fix

* Formatting fix
  • Loading branch information
alexis-allemann authored Aug 12, 2024
1 parent c7a7041 commit ca6c80c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions my_compassion/static/src/js/my_children.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ const child_images = document.getElementsByClassName("child-image");
const child_name = document.getElementsByClassName("child-name");
const child_local_id = document.getElementsByClassName("child-local_id");

// Change the href of the links to include the child_id
const current_child_id = new URLSearchParams(window.location.search).get(
"child_id"
);
selector = document.querySelector('a[href="/my/letter"]');
selector.href = selector.href + "?child_id=" + current_child_id;
selector = document.querySelector('a[href="/my/children"]');
selector.href = selector.href + "?child_id=" + current_child_id;

function selectChild(selected_child_id, reload) {
// Change url to display selected child
const search_params = new URLSearchParams(window.location.search);
Expand Down

0 comments on commit ca6c80c

Please sign in to comment.