Skip to content

Commit

Permalink
Study Details Configuration Views (#1244)
Browse files Browse the repository at this point in the history
* Add js2py package for js validation

* html format changes

* Experiment runner config url

* Update study edit forms

* Add exp runner edit button to detail view

* Add runner config edit html

* Update css

* Move study type field to drop down

* Add external runner config

* Remove study type mixin

* populate latest commit sha

* Get other field form data

* Fix field names, add style to forms

* Add preview link to study details, fix view names

* Rename study views

There are two view named "Study details".  The original view is renamed
to "Study" and all urls have been updated.

Additionally, Clicking save on Study Ad moves you to the new Study
Details view.

* Add header text to Study Ad

* Update version of djlint

I updated the version of djlint as it was causing me to have to
re-format text on each commit.

* Move study type field to bottom of form.

* Update preview summary help text

* Update study type field label and help text.

* Update study type name field

In addition to updating the study type field, I am removing the
configuration field.  Forms have replaced the need for this field.

* Add header copy to study details

* Update rep url help text

* Update study create workflow

* Disable study type on study edit form

* Clean up study views

* Fix Study type name issues

* Update Scheduled field to be choice field

* Update tests

* Add runner view tests

* Fix issue with Scheduling Other field

There was a small bug with other field on the external details view.
The other box wouldn't show up when other was selected

* Add test for after effects for updating metadata

* Change study ad link icon

* Remove language from modal that doesn't make sense

* Fix cancel button on study details

* Cancel button goes to study view

* Add rebuilt/rejected warning to study details

* Generator field will always have default code

* Fixed commit url

* Add help text to commit sha field

* Added formatted link to help text

* Fix db migration conflict

* Copy changes

* Update warning message on study details

* Update copy on study type
  • Loading branch information
okaycj authored Aug 28, 2023
1 parent 2a6b0ba commit 273632d
Show file tree
Hide file tree
Showing 92 changed files with 1,715 additions and 1,788 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
hooks:
- id: black
- repo: https://github.com/Riverside-Healthcare/djLint
rev: v1.19.16
rev: v1.32.1
hooks:
- id: djlint-django
args: ['--profile', 'django', '--lint', '--reformat', '--quiet']
Expand Down
14 changes: 7 additions & 7 deletions accounts/templates/accounts/2fa-setup.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ <h3 class="card-title">QR Code</h3>
{% csrf_token %}
{% bootstrap_form form %}
{% form_buttons %}
{% bootstrap_button "Test Code" button_type="submit" button_class=btn_primary_classes %}
{% endform_buttons %}
</form>
</li>
</ol>
</div>
<div class="col d-flex me-4 justify-content-center pt-5">{{ svg_qr_code | safe }}</div>
{% bootstrap_button "Test Code" button_type="submit" button_class=btn_primary_classes %}
{% endform_buttons %}
</form>
</li>
</ol>
</div>
<div class="col d-flex me-4 justify-content-center pt-5">{{ svg_qr_code | safe }}</div>
</div>
</div>
</div>
</div>
{% endblock content %}
94 changes: 47 additions & 47 deletions accounts/templates/accounts/account-update.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,60 +17,60 @@ <h1 class="card-title">{% trans "Account Information" %}</h1>
{% csrf_token %}
{% bootstrap_form update_account_form %}
{% form_buttons %}
{% bootstrap_button "Save" name="form-handle" value="update-account" %}
{% endform_buttons %}
</form>
</div>
{% bootstrap_button "Save" name="form-handle" value="update-account" %}
{% endform_buttons %}
</form>
</div>
{# Change password card #}
<div class="card mb-4">
<div class="card-body">
<h1 class="card-title">{% trans "Change Your Password" %}</h1>
</div>
{# Change password card #}
<div class="card mb-4">
<div class="card-body">
<h1 class="card-title">{% trans "Change Your Password" %}</h1>
<form method="post">
{% csrf_token %}
{% bootstrap_form change_password_form %}
{% form_buttons %}
{% bootstrap_button "Save" name="form-handle" value="change-password" %}
{% endform_buttons %}
</form>
</div>
</div>
{% if request.user.is_researcher %}
{# 2FA card #}
<div class="card mb-4">
<div class="card-body">
<h1 class="card-title">{% trans "Manage Two-Factor Authentication" %}</h1>
{% if otp %}
{# If we have OTP, enable setup completion in the case where it's not yet activated, and allow reset with verified OTP if it is. #}
<form method="post">
{% if otp.activated %}
{# enable reset of OTP #}
<p>
{% trans "If you'd like, you can turn two-factor authentication off here. Just enter your one-time password here, hit submit, and it'll get deleted for you!" %}
</p>
{% else %}
<div class="col-md-4">{{ otp.get_svg_qr_code | safe }}</div>
<p>
{% trans "It looks like you were in the middle of setting up two factor authentication, but didn't complete the process. You can capture the QR code here, verify with a one-time password, and finish the process." %}
</p>
{% endif %}
{% csrf_token %}
{% bootstrap_form change_password_form %}
{% bootstrap_form otp_check_form %}
{% form_buttons %}
{% bootstrap_button "Save" name="form-handle" value="change-password" %}
{% endform_buttons %}
</form>
</div>
</div>
{% if request.user.is_researcher %}
{# 2FA card #}
<div class="card mb-4">
<div class="card-body">
<h1 class="card-title">{% trans "Manage Two-Factor Authentication" %}</h1>
{% if otp %}
{# If we have OTP, enable setup completion in the case where it's not yet activated, and allow reset with verified OTP if it is. #}
<form method="post">
{% if otp.activated %}
{# enable reset of OTP #}
<p>
{% trans "If you'd like, you can turn two-factor authentication off here. Just enter your one-time password here, hit submit, and it'll get deleted for you!" %}
</p>
{% else %}
<div class="col-md-4">{{ otp.get_svg_qr_code | safe }}</div>
<p>
{% trans "It looks like you were in the middle of setting up two factor authentication, but didn't complete the process. You can capture the QR code here, verify with a one-time password, and finish the process." %}
</p>
{% endif %}
{% csrf_token %}
{% bootstrap_form otp_check_form %}
{% form_buttons %}
{% if otp.activated %}
{% bootstrap_button "Submit" name="form-handle" value="deactivate-otp" %}
{% else %}
{% bootstrap_button "Submit" name="form-handle" value="activate-otp" %}
{% endif %}
{% endform_buttons %}
</form>
{% if otp.activated %}
{% bootstrap_button "Submit" name="form-handle" value="deactivate-otp" %}
{% else %}
{# if we don't have OTP, link to 2FA setup directly. #}
<a href="{% url "accounts:2fa-setup" %}">{% trans "Set up Two-Factor Authentication" %}</a>
{% bootstrap_button "Submit" name="form-handle" value="activate-otp" %}
{% endif %}
</div>
</div>
{% endform_buttons %}
</form>
{% else %}
{# if we don't have OTP, link to 2FA setup directly. #}
<a href="{% url "accounts:2fa-setup" %}">{% trans "Set up Two-Factor Authentication" %}</a>
{% endif %}
</div>
</div>
{% endif %}
</div>
</div>
{% endblock content %}
110 changes: 28 additions & 82 deletions accounts/templates/accounts/participant_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,89 +89,47 @@
</tr>
<tr>
<th scope="row">{% trans "Number of Guardians" %}:</th>
<td>
{{ demographics.number_of_guardians|default:"No Response" }}
</td>
<td>{{ demographics.number_of_guardians|default:"No Response" }}</td>
</tr>
<tr>
<th scope="row">
{% trans "Explanation for Guardians:" %}
</th>
<td>
{{ demographics.number_of_guardians_explanation|default:"No Response" }}
</td>
<th scope="row">{% trans "Explanation for Guardians:" %}</th>
<td>{{ demographics.number_of_guardians_explanation|default:"No Response" }}</td>
</tr>
<tr>
<th scope="row">
{% trans "Race" %}:
</th>
<td>
{{ demographics.us_race_ethnicity_identification|default:"No Response" }}
</td>
<th scope="row">{% trans "Race" %}:</th>
<td>{{ demographics.us_race_ethnicity_identification|default:"No Response" }}</td>
</tr>
<tr>
<th scope="row">
Age:
</th>
<td>
{{ demographics.age|default:"No Response" }}
</td>
<th scope="row">Age:</th>
<td>{{ demographics.age|default:"No Response" }}</td>
</tr>
<tr>
<th scope="row">
Gender:
</th>
<td>
{{ demographics.gender|default:"No Response" }}
</td>
<th scope="row">Gender:</th>
<td>{{ demographics.gender|default:"No Response" }}</td>
</tr>
<tr>
<th scope="row">
Education Level:
</th>
<td>
{{ demographics.education_level|default:"No Response" }}
</td>
<th scope="row">Education Level:</th>
<td>{{ demographics.education_level|default:"No Response" }}</td>
</tr>
<tr>
<th scope="row">
Spouse's Education Level:
</th>
<td>
{{ demographics.spouse_education_level|default:"No Response" }}
</td>
<th scope="row">Spouse's Education Level:</th>
<td>{{ demographics.spouse_education_level|default:"No Response" }}</td>
</tr>
<tr>
<th scope="row">
Annual Income:
</th>
<td>
{{ demographics.annual_income|default:"No Response" }}
</td>
<th scope="row">Annual Income:</th>
<td>{{ demographics.annual_income|default:"No Response" }}</td>
</tr>
<tr>
<th scope="row">
Children's Books at Home:
</th>
<td>
{{ demographics.number_of_books|default:"No Response" }}
</td>
<th scope="row">Children's Books at Home:</th>
<td>{{ demographics.number_of_books|default:"No Response" }}</td>
</tr>
<tr>
<th scope="row">
Additional Comments:
</th>
<td>
{{ demographics.additional_comments|default:"No Response" }}
</td>
<th scope="row">Additional Comments:</th>
<td>{{ demographics.additional_comments|default:"No Response" }}</td>
</tr>
<tr>
<th scope="row">
Lookit Referrer:
</th>
<td>
{{ demographics.lookit_referrer|default:"No Response" }}
</td>
<th scope="row">Lookit Referrer:</th>
<td>{{ demographics.lookit_referrer|default:"No Response" }}</td>
</tr>
</table>
</div>
Expand Down Expand Up @@ -201,12 +159,8 @@
{% bs_icon "chevron-down" %}
</a>
</th>
<th scope="col">
Response
</th>
<th scope="col">
Child
</th>
<th scope="col">Response</th>
<th scope="col">Child</th>
<th scope="col">
Completion Status
<a class="text-decoration-none"
Expand Down Expand Up @@ -239,32 +193,24 @@
{% for study in studies %}
<tr>
<td>
<a href="{% url 'exp:study-detail' study.study.id %}">{{ study.study.name }}</a>
</td>
<td>
{{ study.response.uuid }}
</td>
<td>
{{ study.response.child.given_name }}
<a href="{% url 'exp:study' study.study.id %}">{{ study.study.name }}</a>
</td>
<td>{{ study.response.uuid }}</td>
<td>{{ study.response.child.given_name }}</td>
<td>
{% if study.completed %}
Completed
{% else %}
In Progress
{% endif %}
</td>
<td>
{{ study.created |date:"n/d/Y"|default:"N/A" }}
</td>
<td>{{ study.created |date:"n/d/Y"|default:"N/A" }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% include "studies/_paginator.html" with page=studies request=request %}
{% else %}
<p class="fst-italic">
{{ user.nickname }} has not participated in any studies yet!
</p>
<p class="fst-italic">{{ user.nickname }} has not participated in any studies yet!</p>
{% endif %}
{% endblock content %}
8 changes: 4 additions & 4 deletions accounts/templates/accounts/participant_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
placeholder="Filter by nickname or user global ID"
size="50"
type="text"
value="{{ match }}"/>
<input type="hidden" name="sort" value="{{ sort }}"/>
<input type="hidden" name="page" value="1"/>
value="{{ match }}" />
<input type="hidden" name="sort" value="{{ sort }}" />
<input type="hidden" name="page" value="1" />
</form>
<table class="table" aria-describedby="Study participant list">
<thead>
Expand Down Expand Up @@ -49,7 +49,7 @@
{% for user in object_list %}
{% url 'exp:participant-detail' user.id as url_participant_detail %}
<tr>
<td >
<td>
<a href={{ url_participant_detail }}>
{% if user.nickname %}
{{ user.nickname }}
Expand Down
8 changes: 4 additions & 4 deletions accounts/templates/accounts/researcher-registration.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
.
</p>
{% form_buttons %}
{% bootstrap_button bs_icon_plus|add:"Create Account" %}
{% endform_buttons %}
</form>
</div>
{% bootstrap_button bs_icon_plus|add:"Create Account" %}
{% endform_buttons %}
</form>
</div>
</div>
{% endblock content %}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<p>Dear {{ researcher_name }},</p>
<p>You have been given {{ permission }} permissions to collaborate on {{ study_name }}.</p>
<p>
Here is a link to <a href="{{ base_url }}{% url 'exp:study-detail' study_id %}">start collaborating</a>.
Here is a link to <a href="{{ base_url }}{% url 'exp:study' study_id %}">start collaborating</a>.
</p>
<p>
Best,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Dear {{ researcher_name }},

You have been given {{ permission }} permissions to collaborate on {{ study_name }}.

Here is a link to start collaborating: {{ base_url }}{% url 'exp:study-detail' study_id %}.
Here is a link to start collaborating: {{ base_url }}{% url 'exp:study' study_id %}.

Best,
{{ lab_name }} Admin
2 changes: 1 addition & 1 deletion accounts/tests/test_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def setUp(self):
reverse("exp:participant-detail", kwargs={"pk": self.participant.pk}),
reverse("exp:study-participant-analytics"),
reverse("exp:study-create"),
reverse("exp:study-detail", kwargs={"pk": self.study.pk}),
reverse("exp:study", kwargs={"pk": self.study.pk}),
reverse("exp:study-participant-contact", kwargs={"pk": self.study.pk}),
reverse("exp:study-edit", kwargs={"pk": self.study.pk}),
reverse("exp:study-responses-list", kwargs={"pk": self.study.pk}),
Expand Down
8 changes: 2 additions & 6 deletions exp/templates/exp/_navigation.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
id="navbarDropdown"
role="button"
data-bs-toggle="dropdown"
aria-expanded="false">
Help
</a>
aria-expanded="false">Help</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<div>
<a class="dropdown-item"
Expand All @@ -31,9 +29,7 @@
id="navbarDropdown"
role="button"
data-bs-toggle="dropdown"
aria-expanded="false">
{{ request.user.identicon_small_html }} {{ request.user.get_short_name }}
</a>
aria-expanded="false">{{ request.user.identicon_small_html }} {{ request.user.get_short_name }}</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
{% dropdown_item request 'accounts:manage-account' 'Manage Account' %}
{% dropdown_item request 'exp:lab-list' 'Manage Labs' %}
Expand Down
Loading

0 comments on commit 273632d

Please sign in to comment.