Skip to content

Commit

Permalink
Move study type field to drop down
Browse files Browse the repository at this point in the history
  • Loading branch information
okaycj committed Jul 31, 2023
1 parent 0d4380d commit e472896
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 25 deletions.
38 changes: 14 additions & 24 deletions studies/templates/studies/_study_fields.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,7 @@
{% bootstrap_field form.lab label_class="form-label fw-bold" wrapper_class="mb-4" %}
{% bootstrap_field form.priority label_class="form-label fw-bold" wrapper_class="mb-4" addon_before="" %}
<hr />
<div class="row">
<div class="col-xs-12 mb-4">
<label class="form-label fw-bold">Study Type</label>
<p>
Choose what type of study you are creating - this will change the fields that appear in the Experiment Details section.
</p>
{% bootstrap_field form.external %}
{% bootstrap_field form.scheduled wrapper_class="" %}
</div>
</div>
{% bootstrap_field form.study_type label_class="form-label fw-bold" wrapper_class="mb-4" %}
<hr />
<div class="row">
<div class="col-xs-12 mb-4">
Expand Down Expand Up @@ -59,7 +50,7 @@
title=""
id="id_min_age_years">
{% for x, y in form.fields.min_age_years.choices %}
<option value="{{ x }}" {% if study.min_age_years == x %} selected{% endif %}>
<option value="{{ x }}" {% if study.min_age_years == x %}selected{% endif %}>
{{ y }}
</option>
{% endfor %}
Expand Down Expand Up @@ -93,7 +84,7 @@
name="min_age_days"
title="">
{% for x, y in form.fields.min_age_days.choices %}
<option value="{{ x }}" {% if study.min_age_days == x %} selected{% endif %}>
<option value="{{ x }}" {% if study.min_age_days == x %}selected{% endif %}>
{{ y }}
</option>
{% endfor %}
Expand Down Expand Up @@ -123,7 +114,7 @@
title=""
id="id_max_age_years">
{% for x, y in form.fields.max_age_years.choices %}
<option value="{{ x }}" {% if study.max_age_years == x %} selected{% endif %}>
<option value="{{ x }}" {% if study.max_age_years == x %}selected{% endif %}>
{{ y }}
</option>
{% endfor %}
Expand All @@ -140,8 +131,7 @@
name="max_age_months"
title="">
{% for x, y in form.fields.max_age_months.choices %}
<option value="{{ x }}"
{% if study.max_age_months == x %} selected{% endif %}>
<option value="{{ x }}" {% if study.max_age_months == x %}selected{% endif %}>
{{ y }}
</option>
{% endfor %}
Expand All @@ -158,7 +148,7 @@
name="max_age_days"
title="">
{% for x, y in form.fields.max_age_days.choices %}
<option value="{{ x }}" {% if study.max_age_days == x %} selected{% endif %}>
<option value="{{ x }}" {% if study.max_age_days == x %}selected{% endif %}>
{{ y }}
</option>
{% endfor %}
Expand All @@ -180,18 +170,18 @@
{% bootstrap_field form.must_have_participated label_class="form-label fw-bold" wrapper_class="mb-4" %}
{% bootstrap_field form.must_not_have_participated label_class="form-label fw-bold" wrapper_class="mb-4" %}
{% bootstrap_field form.criteria_expression label_class="form-label fw-bold" wrapper_class="mb-4" %}
<hr />
<div class="row">
{% comment %} <hr /> {% endcomment %}
{% comment %} <div class="row">
<div class="col-xs-12">
<label class="form-label fw-bold">Experiment Details</label>
<p>
Now it's time for the actual study! For internal studies, you will add a protocol configuration or generator. For external studies, you will paste in your study or scheduling link. If you don't see what you expect, check the "External" and "Scheduled" checkboxes at the top of this form!
</p>
</div>
</div>
<div id="structure-container">{% bootstrap_field form.structure label_class="form-label fw-bold" %}</div>
{% bootstrap_field form.use_generator label_class="form-label" wrapper_class="form-group" %}
<div class="use-generator form-text mb-4">{{ form.generator.help_text|safe }}</div>
<div id="generator-container">
</div> {% endcomment %}
{% comment %} <div id="structure-container">{% bootstrap_field form.structure label_class="form-label fw-bold" %}</div> {% endcomment %}
{% comment %} {% bootstrap_field form.use_generator label_class="form-label" wrapper_class="form-group" %} {% endcomment %}
{% comment %} <div class="use-generator form-text mb-4">{{ form.generator.help_text|safe }}</div> {% endcomment %}
{% comment %} <div id="generator-container">
{% bootstrap_field form.generator show_help=False label_class="form-label fw-bold" %}
</div>
</div> {% endcomment %}
1 change: 0 additions & 1 deletion studies/templates/studies/study_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ <h3 class="card-subtitle my-1">
<form id="study-details-form" enctype="multipart/form-data" method="post">
{% csrf_token %}
{% include "studies/_study_fields.html" with form=form study=study %}
{% include "studies/_study_type.html" with types=types create=0 currentType=study.study_type.id %}
{% form_buttons %}
{% bootstrap_button "Cancel" button_class=btn_secondary_classes href=url_cancel %}
<button type="button"
Expand Down

0 comments on commit e472896

Please sign in to comment.