Skip to content

Commit

Permalink
Merge pull request #1989 from uwcirg/eproms-initial-queries-fix
Browse files Browse the repository at this point in the history
bug fix - initial queries fix for eproms
  • Loading branch information
ivan-c authored Mar 30, 2018
2 parents 610aed8 + c72f54a commit 7f17b06
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
36 changes: 23 additions & 13 deletions portal/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1363,6 +1363,11 @@ var fillContent = {
arrTypes.forEach(function(type) {
if (typeInTous(type, "active")) {
item_found++;
/*
* set the data-agree attribute for the corresponding consent item
*/
$("#termsCheckbox [data-tou-type='" + type + "']").attr("data-agree", "true");

};
});

Expand All @@ -1382,20 +1387,21 @@ var fillContent = {
}

if (item_found > 0) {
self.find("i").removeClass("fa-square-o").addClass("fa-check-square-o").addClass("edit-view");
/*
* make sure that all items are agreed upon before checking the box
*/
if (!($(this).find("[data-agree='false']").length > 0)) {
self.find("i").removeClass("fa-square-o").addClass("fa-check-square-o").addClass("edit-view");
var vs = self.find(".display-view");
if (vs.length > 0) {
self.show();
vs.show();
(self.find(".edit-view")).each(function() {
$(this).hide();
});
}
}
self.show().removeClass("tnth-hide");
self.attr("data-agree", "true");
self.find("[data-type='terms']").each(function() {
$(this).attr("data-agree", "true");
});
var vs = self.find(".display-view");
if (vs.length > 0) {
self.show();
vs.show();
(self.find(".edit-view")).each(function() {
$(this).hide();
});
};
};
});

Expand Down Expand Up @@ -2847,6 +2853,10 @@ var Profile = function(subjectId, currentUserId) {
};
$("#btnPasswordResetEmail").on("click", function(event) {
event.preventDefault();
/*
* stop bubbling of events
*/
event.stopImmediatePropagation();
email = $("#email").val();
if (email) {
tnthAjax.passwordReset(self.subjectId, function(data) {
Expand Down
4 changes: 2 additions & 2 deletions portal/templates/initial_queries_macros.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ <h4 class="tnth-headline">{{ _("Terms of Use") }}</h4>
<!-- display message specific to patient who has already consented - possible in EPROMs -->
{% if user.has_role(ROLE.PATIENT) %}
<div class="display-view text-warning tnth-hide">{{_("You have previously provided your consent to the website during a visit at your treating site. If you would like a copy of this please contact your study contact.")}}<br/></div>
{% endif %}
<input type="hidden"
data-agree="false"
data-type="terms"
data-tou-type="subject website consent"
data-core-data-type="subject_website_consent"
data-url="{{tou_url}}" />
<input type="hidden"
{% endif %}
<input type="hidden"
data-agree="false"
data-type="terms"
data-tou-type="website terms of use"
Expand Down

0 comments on commit 7f17b06

Please sign in to comment.