liquid_feedback_frontend
view static/js/xhr.js @ 1627:181cf093becd
Reworked incoming vote delegation view
| author | bsw | 
|---|---|
| date | Mon Feb 08 01:04:25 2021 +0100 (2021-02-08) | 
| parents | 62856200414d | 
| children | 123eb46b4d3e | 
 line source
     1 function toggleInterest(issueId) {
     2   var linkEl = document.getElementById("issue_" + issueId + "_interest_link");
     3   var iconEl = document.getElementById("issue_" + issueId + "_interest_icon");
     4   var interested = iconEl.innerHTML == "star_outline";
     6   if (interested) {
     7     linkEl.classList.add("mdl-button--accent");
     8     linkEl.classList.add("mdl-button--feature-on");
     9     linkEl.classList.remove("mdl-button--feature-off");
    10     iconEl.innerHTML = "star";
    11   } else {
    12     linkEl.classList.remove("mdl-button--accent");
    13     linkEl.classList.remove("mdl-button--feature-on");
    14     linkEl.classList.add("mdl-button--feature-off");
    15     iconEl.innerHTML = "star_outline";
    16   }
    18   var data = new FormData();
    19   data.append("issue_id", issueId);
    20   data.append("interested", interested);
    22   fetch("/lf/interest/xhr_update", {
    23       method : "POST",
    24       body: data
    25   }).then(
    26       response => {
    27         if (response.status != 200) {
    28           window.alert("Error during update");
    29         }
    30       }
    31   );
    33 }
