Skip to content

Commit

Permalink
PR review: Behavioral changes
Browse files Browse the repository at this point in the history
  • Loading branch information
he3lixxx committed Sep 11, 2023
1 parent 0dc731e commit f31c8bf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions evap/evaluation/templates/evap_evaluation_edit_js.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@

<script type="text/javascript">
function makeDoesNotContributeChangeHandler(i) {
return function () {
// don't do anything on disabled buttons
if (this.classList.contains("disabled"))
return () => {
const doesNotContributeInput = document.querySelector("input[name=contributions-" + i + "-does_not_contribute]");

if (doesNotContributeInput.disabled)
return false;

if(document.querySelector("input[name=contributions-" + i + "-does_not_contribute]").checked) {
if(doesNotContributeInput.checked) {
// uncheck and disable all questionnaire checkboxes
document.querySelectorAll("input[name=contributions-" + i + "-questionnaires]").forEach(checkbox => {
checkbox.checked = false;
Expand All @@ -48,7 +49,7 @@
checkbox.disabled = false;
});
}
}
};
}

function getContributorCount() {
Expand All @@ -57,9 +58,8 @@

function assignClickHandlers() {
const count = getContributorCount();
for(var i = 0; i < count; i++)
{
document.querySelector("input[name=contributions-" + i + "-does_not_contribute]").parentElement.addEventListener("click", makeDoesNotContributeChangeHandler(i));
for(var i = 0; i < count; i++) {
document.querySelector(`input[name=contributions-${i}-does_not_contribute]`).parentElement.addEventListener("click", makeDoesNotContributeChangeHandler(i));
}
}

Expand Down
4 changes: 2 additions & 2 deletions evap/staff/templates/staff_semester_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ <h3>
method: "POST",
}).then(response => {
assert(response.ok);
document.getElementById('evaluation-row-'+dataId).remove();
fadeOutThenRemove(document.getElementById('evaluation-row-'+dataId))
}).catch(error => {window.alert("{% trans 'The server is not responding.' %}");});
};
</script>
Expand All @@ -560,7 +560,7 @@ <h3>
method: "POST",
}).then(response => {
assert(response.ok);
document.getElementById('#course-row-'+dataId).remove();
fadeOutThenRemove(document.getElementById('#course-row-'+dataId))
}).catch(error => {window.alert("{% trans 'The server is not responding.' %}");});
};
</script>
Expand Down

0 comments on commit f31c8bf

Please sign in to comment.