Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhaul Adjustments Based on Testing #284

Merged
merged 9 commits into from
Aug 23, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Post-testing adjustments
cassidysymons committed Aug 22, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 133a64ea3b884c330d1d89fbe22fd22876412b8e
250 changes: 216 additions & 34 deletions microsetta_interface/implementation.py

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions microsetta_interface/routes.yaml
Original file line number Diff line number Diff line change
@@ -467,6 +467,18 @@ paths:
schema:
type: string

'/accounts/{account_id}/sources/{source_id}/decline_reconsent':
get:
operationId: microsetta_interface.implementation.decline_reconsent
tags:
- Source
parameters:
- $ref: '#/components/parameters/account_id'
- $ref: '#/components/parameters/source_id'
responses:
'302':
description: Set session variable for declined reconsent and redirect to profile page

'/accounts/{account_id}/sources/{source_id}/consents':
get:
operationId: microsetta_interface.implementation.get_consents
22 changes: 18 additions & 4 deletions microsetta_interface/static/css/minimal_interface.css
Original file line number Diff line number Diff line change
@@ -791,6 +791,13 @@ li.active-profile {
color: var(--tmi-blue);
}

.alert-consent {
background: var(--tmi-orange-bg);
border-left: 8px solid var(--tmi-orange);
border-radius: 12px;
color: var(--tmi-gray-90);
}

.blue-bg-card {
background: var(--tmi-blue-bg);
box-shadow: none;
@@ -978,6 +985,10 @@ li.active-profile {
z-index: -1;
}

.tmi-survey-radio-axis > .field-wrap > .radio-list::after {
display: none;
}

.tmi-survey-radio-axis > .field-wrap > .radio-list > label {
display: inline-block !important;
width: 100% !important;
@@ -1191,7 +1202,7 @@ input.barcode-checkbox[type=checkbox]:checked+label {
padding: 36px;
}

@media (max-width: 575.98px) {
@media (max-width: 767.98px) {
.kit-sample-container {
border: 1px solid var(--tmi-blue-bg);
border-radius: 25px;
@@ -1275,15 +1286,18 @@ input.barcode-checkbox[type=checkbox]:checked+label {
}

#bristol-chart-1 {
height: 100px;
max-height: 100px;
max-width: 100%;
}

#bristol-chart-2 {
height: 100px;
max-height: 100px;
max-width: 100%;
}

#bristol-chart-3 {
height: 100px;
max-height: 100px;
max-width: 100%;
}

.ffq-info {
12 changes: 10 additions & 2 deletions microsetta_interface/templates/kits.jinja2
Original file line number Diff line number Diff line change
@@ -162,6 +162,14 @@
document.getElementById('add_kit_card').style.display = '';
document.getElementById('kit_name').focus();
}

function checkHiddenState() {
if(document.getElementById('hidden_plus_stuff').style.display == '') {
document.getElementById('hidden_plus_stuff').style.display = 'none';
} else {
document.getElementById('hidden_plus_stuff').style.display = '';
}
}
</script>
{% endblock %}
{% block breadcrumb %}
@@ -198,10 +206,10 @@
</div>
<div class="card mt-4 p-4">
<div class="row">
<div class="col col-md-2">
<div class="col col-lg-2">
<h1>{{ _('My Kits') }}</h1>
</div>
<div class="plus-button-wrapper p-0" onclick="document.getElementById('hidden_plus_stuff').style.display = '';" onfocusout="document.getElementById('hidden_plus_stuff').style.display = 'none';">
<div class="plus-button-wrapper p-0" onclick="checkHiddenState();" onfocusout="document.getElementById('hidden_plus_stuff').style.display = 'none';">
<div class="plus-button-white-bg">
<img src="/static/img/plus_button.svg" class="plus-button-img">
<span id="hidden_plus_stuff" style="display: none; padding-right: 6px;">
20 changes: 15 additions & 5 deletions microsetta_interface/templates/new_participant.jinja2
Original file line number Diff line number Diff line change
@@ -16,10 +16,14 @@

function goHome() {
{% if source_id is not none %}
{% if form_type == "biospecimen" %}
window.location.replace("/accounts/{{ account_id |e }}/sources/{{ source_id |e }}/kits");
{% if reconsent is not none %}
window.location.replace("/accounts/{{ account_id |e }}/sources/{{ source_id |e }}/decline_reconsent");
{% else %}
window.location.replace("/accounts/{{ account_id |e }}/sources/{{ source_id |e }}");
{% if form_type == "biospecimen" %}
window.location.replace("/accounts/{{ account_id |e }}/sources/{{ source_id |e }}/kits");
{% else %}
window.location.replace("/accounts/{{ account_id |e }}/sources/{{ source_id |e }}");
{% endif %}
{% endif %}
{% else %}
window.location.replace("/accounts/{{ account_id |e }}");
@@ -149,9 +153,9 @@

if($form_name.valid()) {
var duplicate_source_check_msg = "{{ _('It looks like you are creating a new profile that may be similar or the same as an existing profile. If this is the same person as an existing profile, please consider providing new samples or survey responses under that profile.') }}"
var reconsent = "{{ reconsent |e }}";
var skip_dupe_check = "{{ skip_dupe_check |e }}";

if(reconsent == false) {
if(skip_dupe_check == false) {
var name = $('#'+$form_id+'_participant_name').val();
$.ajax({
url: '{{ duplicate_source_check }}',
@@ -207,6 +211,12 @@
{% block content%}

<div class="container default-container">
{% if reconsent is not none %}
<div id="consent_alert" class="alert alert-consent" role="alert">
<strong>{{ _('Your consent is needed to proceed.') }}</strong><br />
{{ _('We\'ve made some changes to the project since you last logged in, including an update to our consent agreement. To proceed, please provide your updated consent.') }}
</div>
{% endif %}
{% if age_range != None %}
<input type="hidden" name="age-range" value="{{ age_range }}" />
<div class="row mb-4">
24 changes: 9 additions & 15 deletions microsetta_interface/templates/new_results_page.jinja2
Original file line number Diff line number Diff line change
@@ -917,7 +917,7 @@
$("#n_archaea_background").text(result["Archaea"].toLocaleString()).addClass("microbe-count").removeClass("spinner-grow spinner-grow-sm");
});
retrieveNeighbors(state, 1)
.then(queryNeighborAndSelfMetadata(state, ["age_years", "sugary_sweets_frequency"]))
.then(queryNeighborAndSelfMetadata(state, ["age_cat", "sugary_sweets_frequency"]))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this looks good, then let's keep it, but the corresponding variable would I think be host_age followign the metadata updates

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...same for below

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

host_age doesn't work relative to the current results from microsetta-processing (just tried and reverted). We can poke at that separately.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from wgs? maybe lack of samples and okay

.then(fillResults(state, ["#age_nearest_neighbor", "#more_or_less_sweets_nearest_neighbor"]));
}

@@ -1050,7 +1050,7 @@
"types_of_plants": ["#beta_diversity_plants_per_week_response", "#beta_diversity_plants_per_week_value"],
"probiotic_frequency": ["#beta_diversity_probiotics_response", "#beta_diversity_probiotics_value"],
"exercise_frequency": ["#beta_diversity_exercise_response", "#beta_diversity_exercise_value"],
"age_years": ["#beta_diversity_age_response", "#beta_diversity_age_value"],
"age_cat": ["#beta_diversity_age_response", "#beta_diversity_age_value"],
//"diet": ["",""],
"diet_type": ["#beta_diversity_diet_type_response", "#beta_diversity_diet_type_value"],
"multivitamin": ["#beta_diversity_multivitamin_response", "#beta_diversity_multivitamin_value"],
@@ -1061,7 +1061,7 @@
"types_of_plants": {"type": "max"},
"probiotic_frequency": {"type": "max"},
"exercise_frequency": {"type": "max"},
"age_years": {"type": "same"},
"age_cat": {"type": "same"},
//"diet": {"type": "same"},
"diet_type": {"type": "same"},
"multivitamin": {"type": "specified", "value": "Yes"},
@@ -1193,13 +1193,13 @@
return
$("#dataset_title").text(info.title).removeClass("spinner-grow spinner-grow-sm");
if (info.datatype === "WGS"){
$("#dataset_datatype").text("{{ _('whole genome sequencing, a technique that produces a large number of small DNA sequences from all of the microbial genomes in your sample. With enough sequences you can even see the variation that exists between microbes of the same species.') }} ").removeClass("spinner-grow spinner-grow-sm");
$("#dataset-info-processing-text").text("{{ _('For your sample, we performed a technique called shotgun metagenomic sequencing where we grab random snippets from all of the DNA present. We then sequenced these random snippets to get a picture of all the kinds of life that is in your sample. Because your cells also contain DNA, some of the snippets came from your own genome, but all of the sequences from those snippets have been removed.') }} ").removeClass("spinner-grow spinner-grow-sm");
}
else if (info.datatype === "16S"){
$("#dataset_datatype").text("{{ _('16S. This technique produces DNA sequences from a specific variable region (V4) within a microbial gene (the 16S small subunit ribosomal gene). DNA sequences from this region of this gene can be used like a microbial barcode, providing researchers evidence of the types of microbes that may be present in your sample.') }}").removeClass("spinner-grow spinner-grow-sm");
$("#dataset-info-processing-text").text("{{ _('For your sample, we performed a technique called Polymerase Chain Reaction (PCR) to make many copies of a piece of DNA corresponding to a particular gene that is present in bacteria and archaea; specifically, the fourth variable region (V4) of the 16S rRNA small subunit ribosomal gene. We then sequenced these copies. DNA sequences from this region of this gene can be used like a microbial barcode, providing researchers evidence of the types of microbes that may be present in your sample.') }}").removeClass("spinner-grow spinner-grow-sm");
}
else {
$("#dataset_datatype").text(info.datatype).removeClass("spinner-grow spinner-grow-sm");
$("#dataset-info-processing-text").text(info.datatype).removeClass("spinner-grow spinner-grow-sm");

}
},
@@ -1646,19 +1646,13 @@
<h3>{{ _('How can I learn more?') }}</h3>
<br/>
<p>
{{ _('Microbiome analysis is a burgeoning new field, and the information displayed here is only an example of what is becoming possible thanks to the data that you helped collect.') }}
{{ _('Microbiome analysis is a burgeoning field, and the information displayed here is only an example of what is becoming possible thanks to the data that you\'ve helped collect. If you\'d like to learn more, you can even take a look at the dataset for yourself via the links below.') }}
</p>

<p>
{{ _('So if you want to learn more, you can even take a look at the dataset for yourself!') }}
</p>

<p>
{{ _("For your sample, we performed a technique called amplicon sequencing where we examine pieces of DNA corresponding to a particular gene. Specifically, we sequenced the fourth variable region (V4) of the 16S rRNA small subunit ribosomal gene. DNA sequences from this region of this gene can be used like a microbial barcode, providing researchers evidence of the types of microbes that may be present in your sample.") }}
</p>
<p id="dataset-info-processing-text"></p>

<p>
{{ _('There are many resources for microbiome information available online. If you\'d like to learn more, we recommend the <a href="https://asm.org/Browse-By-Topic/Newsroom/Clinical/Microbiome">American Society for Microbiology</a>, <a href="https://microbe.net/">microBEnet</a>, the <a href="http://www.probioticchart.ca/">Canadian Probiotics Chart</a>, and the <a href="https://gastro.org/aga-leadership/centers/aga-center-for-gut-microbiome-research-education/">American Gastroenterological Association</a>.') }}
{{ _('There are many resources for microbiome information available online. If you\'d like to learn more, we recommend the site hosted by the <a href="https://asm.org/Browse-By-Topic/Newsroom/Clinical/Microbiome">American Society for Microbiology</a>, <a href="https://microbe.net/">microBEnet</a>, the <a href="http://www.probioticchart.ca/">Canadian Probiotics Chart</a>, and the <a href="https://gastro.org/aga-leadership/centers/aga-center-for-gut-microbiome-research-education/">American Gastroenterological Association</a>.') }}
</p>

<h4 style="color:black;">{{ _('Datasets used in your results report') }}</h4>
14 changes: 11 additions & 3 deletions microsetta_interface/templates/nutrition.jinja2
Original file line number Diff line number Diff line change
@@ -91,6 +91,14 @@
link_obj.style.pointerEvents = "none";
return true;
}

function checkHiddenState() {
if(document.getElementById('hidden_plus_stuff').style.display == '') {
document.getElementById('hidden_plus_stuff').style.display = 'none';
} else {
document.getElementById('hidden_plus_stuff').style.display = '';
}
}
</script>
{% endblock %}
{% block breadcrumb %}
@@ -127,13 +135,13 @@
<div class="col col-md-3">
<h1>{{ _('My FFQs') }}</h1>
</div>
<div class="plus-button-wrapper p-0" onclick="document.getElementById('hidden_plus_stuff').style.display = '';" onfocusout="document.getElementById('hidden_plus_stuff').style.display = 'none';">
<div class="plus-button-wrapper p-0" onclick="checkHiddenState();" onfocusout="document.getElementById('hidden_plus_stuff').style.display = 'none';">
<div class="plus-button-white-bg">
<img src="/static/img/plus_button.svg" class="plus-button-img">
<span id="hidden_plus_stuff" style="display: none; padding-right: 6px;">
<a href="javascript: openCodePanel();" class="add-kit-link">{{ _('Have an FFQ Code') }}</a>
<a href="javascript: openCodePanel();" class="add-kit-link">{{ _('Have an FFQ') }}</a>
&nbsp;&nbsp;&nbsp;
<a href="{{ fundrazr_url }}" class="add-kit-link" target="_blank">{{ _('Get an FFQ Code') }}</a>
<a href="{{ fundrazr_url }}" class="add-kit-link" target="_blank">{{ _('Get an FFQ') }}</a>
</span>
</div>
</div>
13 changes: 13 additions & 0 deletions microsetta_interface/templates/reports.jinja2
Original file line number Diff line number Diff line change
@@ -76,6 +76,19 @@
</div>
</div>
{% endfor %}
{% for sample in pending_samples %}
<div class="row mb-2">
<div class="barcode-col">
<img src="/static/img/tube_icon.svg" width="24" height="24" />
</div>
<div class="barcode-col barcode-text">
{{ sample.sample_barcode }}
</div>
<div class="barcode-col barcode-col-end" id="btn-view-{{ sample.sample_id }}">
<span class="sample-label">{{ _('Not Received Yet') }}</span>
</div>
</div>
{% endfor %}
</div>
<div class="card mt-4 p-4">
<div class="row">
6 changes: 3 additions & 3 deletions microsetta_interface/templates/sample.jinja2
Original file line number Diff line number Diff line change
@@ -234,13 +234,13 @@
<div class="row">
<div class="col-12 mt-4 text-end">
{% if not sample.sample_remove_locked and not admin_mode %}
<button class="btn btn-white-red-border me-5" name="remove_button" onClick="return verifyDissociateSample();">{{ _('Remove') }}</button>
<button class="btn btn-white-red-border m-2" name="remove_button" onClick="return verifyDissociateSample();">{{ _('Remove') }}</button>
{% endif %}
{% if sample.sample_edit_locked and not admin_mode %}
<span class="kit-tooltip-text">{{ _('Your sample has been received by our lab and can no longer be edited. Please <a href="mailto:[email protected]">contact us</a> with any questions.') }}</span>
{% else %}
<button class="btn btn-white-blue-border" name="cancel_button" onClick="return goToKits();">{{ _('Cancel') }}</button>
<button type="submit" class="btn btn-blue-gradient" name="kit_id_button" id="kit_id_button">{{ _('Save') }}</button>
<button class="btn btn-white-blue-border m-2" name="cancel_button" onClick="return goToKits();">{{ _('Cancel') }}</button>
<button type="submit" class="btn btn-blue-gradient m-2" name="kit_id_button" id="kit_id_button">{{ _('Save') }}</button>
{% endif %}
</div>
</div>
2 changes: 1 addition & 1 deletion microsetta_interface/templates/sitebase.jinja2
Original file line number Diff line number Diff line change
@@ -190,7 +190,7 @@
{{ profile_header_name }}
</h1>
<div class="header-nav-container">
<nav class="navbar navbar-expand-md profile-nav-container">
<nav class="navbar navbar-expand-lg profile-nav-container">
<div class="container-fluid ps-0 pe-0">
<button class="navbar-toggler nav-toggle" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span>
54 changes: 28 additions & 26 deletions microsetta_interface/templates/source.jinja2
Original file line number Diff line number Diff line change
@@ -21,6 +21,12 @@
</style>
<script type="text/javascript">
{% if need_reconsent %}
function takeExternalSurvey(survey_link, survey_title, survey_description) {
window.location.href = survey_link;
return false;
}
{% else %}
function takeExternalSurvey(survey_link, survey_title, survey_description) {
$("#modal-title").empty();
$("#modal-title").text(survey_title);
@@ -37,6 +43,7 @@
$("#source_modal").modal('show');
return false;
}
{% endif %}
function hideModal() {
$("#source_modal").modal('hide');
@@ -60,7 +67,12 @@
</p>
<div class="row mt-5">
{% for detail in local_surveys %}
<div class="col-6 col-md-4 p-2">
<div class="col-12 col-sm-6 col-md-4 p-2">
{% if detail.new_tab %}
<a style="text-decoration: none" href="/accounts/{{ account_id }}/sources/{{ source_id }}/take_survey?survey_template_id={{ detail.survey_template_id }}" target="_blank">
{% else %}
<a style="text-decoration: none" href="/accounts/{{ account_id }}/sources/{{ source_id }}/take_survey?survey_template_id={{ detail.survey_template_id }}">
{% endif %}
<div class="card card-survey {% if detail.date_last_taken is none and detail.survey_template_id == basic_info_template_id %}card-survey-highlight{% endif %}">
<div class="row m-2 survey-info-row">
{% if detail.date_last_taken is not none %}
@@ -80,24 +92,15 @@
<div class="card-survey-bg-progress mx-auto mb-4" style="background-color: #D9ECDB;">
<img src="/static/img/survey_complete.svg" class="survey-complete-icon" />
{% endif %}
<div class="card-survey-bg-blank">
{% if detail.new_tab %}
<a class="survey-title mx-auto" href="/accounts/{{ account_id }}/sources/{{ source_id }}/take_survey?survey_template_id={{ detail.survey_template_id }}" target="_blank">
{% else %}
<a class="survey-title mx-auto" href="/accounts/{{ account_id }}/sources/{{ source_id }}/take_survey?survey_template_id={{ detail.survey_template_id }}">
{% endif %}
<img src="/static/img/{{ detail.icon }}" class="card-survey-icon">
</a>
<div class="card-survey-bg-blank survey-title mx-auto">
<img src="/static/img/{{ detail.icon }}" class="card-survey-icon">
</div>
</div>
{% if detail.new_tab %}
<a class="survey-title mx-auto" href="/accounts/{{ account_id }}/sources/{{ source_id }}/take_survey?survey_template_id={{ detail.survey_template_id }}" target="_blank">
{% else %}
<a class="survey-title mx-auto" href="/accounts/{{ account_id }}/sources/{{ source_id }}/take_survey?survey_template_id={{ detail.survey_template_id }}">
{% endif %}
<div class="survey-title mx-auto">
{{ detail.survey_template_title|e }}
</a>
</div>
</div>
</a>
</div>
{% endfor %}
</div>
@@ -106,7 +109,10 @@
</p>
<div class="row mt-4">
{% for detail in remote_surveys %}
<div class="col-6 col-md-4 p-2">
<div class="col-12 col-sm-6 col-md-4 p-2">
{% if not detail.answered %}
<a style="text-decoration: none" onClick="return takeExternalSurvey('/accounts/{{ account_id }}/sources/{{ source_id }}/take_survey?survey_template_id={{ detail.survey_template_id }}', '{{ detail.survey_template_title }}', '{{ detail.description }}');" href="/accounts/{{ account_id }}/sources/{{ source_id }}/take_survey?survey_template_id={{ detail.survey_template_id }}" target="_blank">
{% endif %}
<div class="card card-survey-external">
<div class="row m-2 survey-info-row">
{% if detail.answered %}
@@ -116,28 +122,24 @@
{% endif %}
<div class="col-4 small-text survey-info text-end">{{ detail.est_minutes }} {{ _('min') }}</div>
</div>
<div class="row m-3 text-center">
<div class="row m-3 text-center survey-title">
{% if not detail.answered %}
<a class="survey-title" onClick="return takeExternalSurvey('/accounts/{{ account_id }}/sources/{{ source_id }}/take_survey?survey_template_id={{ detail.survey_template_id }}', '{{ detail.survey_template_title }}', '{{ detail.description }}');" href="/accounts/{{ account_id }}/sources/{{ source_id }}/take_survey?survey_template_id={{ detail.survey_template_id }}" target="_blank">
<img src="/static/img/survey_external.svg" class="card-survey-icon-external">
</a>
<img src="/static/img/survey_external.svg" class="card-survey-icon-external">
{% else %}
<img src="/static/img/survey_external_taken.svg" class="card-survey-icon-external">
{% endif %}
{% if not detail.answered %}
</a>
{% endif %}
</div>
<div class="row text-center">
{% if not detail.answered %}
<a class="survey-title" onClick="return takeExternalSurvey('/accounts/{{ account_id }}/sources/{{ source_id }}/take_survey?survey_template_id={{ detail.survey_template_id }}', '{{ detail.survey_template_title }}', '{{ detail.description }}');" href="/accounts/{{ account_id }}/sources/{{ source_id }}/take_survey?survey_template_id={{ detail.survey_template_id }}" target="_blank">
{{ detail.survey_template_title|e }}
</a>
<span class="survey-title">{{ detail.survey_template_title|e }}</span>
{% else %}
<span class="survey-title-taken">{{ detail.survey_template_title|e }}</span>
{% endif %}
</div>
</div>
{% if not detail.answered %}
</a>
{% endif %}
</div>
{% endfor %}
</div>
195 changes: 109 additions & 86 deletions microsetta_interface/templates/survey.jinja2
Original file line number Diff line number Diff line change
@@ -98,6 +98,10 @@
padding-right: 10px;
}
}
.vue-form-generator .form-control {
color: #212519 !important;
}
</style>
<script>
// Overwrite and localize the messages used, based on the example from:
@@ -157,7 +161,12 @@
field.visible = function() {
let visible = false;
for (let entry of field.triggered_by) {
visible |= (model[entry['q_id']] === entry['response']);
// Triggering from checkbox lists needs a special casing to check whether the triggering value is in the array of checked boxes, rather than a strict equality
if(model[entry['q_id']] instanceof Array) {
visible |= (model[entry['q_id']].includes(entry['response']));
} else {
visible |= (model[entry['q_id']] === entry['response']);
}
}
// If a triggered question is switched from visible to hidden, we're going to remove the answer from the model
if(visible == false) {
@@ -176,13 +185,25 @@
{% endblock %}
{% block content %}
<div class="container default-container">
{% if need_reconsent %}
<div id="consent_alert" class="alert alert-consent" role="alert">
{{ _('<strong>Please note</strong>: Since you opted to not update your consent agreement, you may view your existing profile data, but may not update or revise your responses.') }}
</div>
{% endif %}
<div class="row align-items-center mb-4">
<div class="col-xs-12 col-md-2 survey-header-icon">
<img src="/static/img/{{ survey_icon}}" />
</div>
<div class="col-xs-12 col-md-10">
<h1 class="h1-survey">{{ survey_schema['groups'][0]['legend'] }}</h1>
<span class="survey-subheader">{{ survey_est_minutes }} {{ _('minutes') }} - {{ survey_question_count }} {{ _('questions') }}</span>
<span class="survey-subheader">
{{ survey_est_minutes }} {{ _('minutes') }} - {{ survey_question_count }}
{% if survey_question_count > 1 %}
{{ _('questions') }}
{% else %}
{{ _('question') }}
{% endif %}
</span>
</div>
</div>
</div>
@@ -247,90 +268,92 @@
}
}
last_group = survey_schema.groups[survey_schema.groups.length-1];
{% if previous_survey is none %}
last_group.fields.push(
{
buttonText: "{{ _('Save & Go to Profile') }}",
styleClasses: "tmi-survey-button-white-noborder tmi-survey-centered col-6 col-md-10",
type: "submit",
validateBeforeSubmit: true,
onSubmit: function(){
$("input").prop('disabled', true);
return postSurvey("home");
}
},{
buttonText: "{{ _('Next') }}",
styleClasses: "tmi-survey-button-blue col-6 col-md-2",
type: "submit",
validateBeforeSubmit: true,
onSubmit: function(){
$("input").prop('disabled', true);
return postSurvey({{ next_survey['survey_template_id'] }});
}
});
{% elif next_survey is none %}
last_group.fields.push(
{
buttonText: "{{ _('Previous') }}",
styleClasses: "tmi-survey-button-white col-4 col-md-2",
type: "submit",
validateBeforeSubmit: true,
onSubmit: function(){
$("input").prop('disabled', true);
return postSurvey({{ previous_survey['survey_template_id'] }});
}
},
{
buttonText: "{{ _('Save & Go to Profile') }}",
styleClasses: "tmi-survey-button-white-noborder tmi-survey-centered col-4 col-md-8",
type: "submit",
validateBeforeSubmit: true,
onSubmit: function(){
$("input").prop('disabled', true);
return postSurvey("home");
}
},{
buttonText: "{{ _('Finish') }}",
styleClasses: "tmi-survey-button-blue col-4 col-md-2",
type: "submit",
validateBeforeSubmit: true,
onSubmit: function(){
$("input").prop('disabled', true);
return postSurvey("home");
}
});
{% else %}
last_group.fields.push(
{
buttonText: "{{ _('Previous') }}",
styleClasses: "tmi-survey-button-white col-4 col-md-2",
type: "submit",
validateBeforeSubmit: true,
onSubmit: function(){
$("input").prop('disabled', true);
return postSurvey({{ previous_survey['survey_template_id'] }});
}
},
{
buttonText: "{{ _('Save & Go to Profile') }}",
styleClasses: "tmi-survey-button-white-noborder tmi-survey-centered col-4 col-md-8",
type: "submit",
validateBeforeSubmit: true,
onSubmit: function(){
$("input").prop('disabled', true);
return postSurvey("home");
}
},{
buttonText: "{{ _('Next') }}",
styleClasses: "tmi-survey-button-blue col-4 col-md-2",
type: "submit",
validateBeforeSubmit: true,
onSubmit: function(){
$("input").prop('disabled', true);
return postSurvey({{ next_survey['survey_template_id'] }});
}
});
{% if not need_reconsent %}
last_group = survey_schema.groups[survey_schema.groups.length-1];
{% if previous_survey is none %}
last_group.fields.push(
{
buttonText: "{{ _('Save & Go to Profile') }}",
styleClasses: "tmi-survey-button-white-noborder tmi-survey-centered col-6 col-md-10",
type: "submit",
validateBeforeSubmit: true,
onSubmit: function(){
$("input").prop('disabled', true);
return postSurvey("home");
}
},{
buttonText: "{{ _('Next') }}",
styleClasses: "tmi-survey-button-blue col-6 col-md-2",
type: "submit",
validateBeforeSubmit: true,
onSubmit: function(){
$("input").prop('disabled', true);
return postSurvey({{ next_survey['survey_template_id'] }});
}
});
{% elif next_survey is none %}
last_group.fields.push(
{
buttonText: "{{ _('Previous') }}",
styleClasses: "tmi-survey-button-white col-4 col-md-2",
type: "submit",
validateBeforeSubmit: true,
onSubmit: function(){
$("input").prop('disabled', true);
return postSurvey({{ previous_survey['survey_template_id'] }});
}
},
{
buttonText: "{{ _('Save & Go to Profile') }}",
styleClasses: "tmi-survey-button-white-noborder tmi-survey-centered col-4 col-md-8",
type: "submit",
validateBeforeSubmit: true,
onSubmit: function(){
$("input").prop('disabled', true);
return postSurvey("home");
}
},{
buttonText: "{{ _('Finish') }}",
styleClasses: "tmi-survey-button-blue col-4 col-md-2",
type: "submit",
validateBeforeSubmit: true,
onSubmit: function(){
$("input").prop('disabled', true);
return postSurvey("home");
}
});
{% else %}
last_group.fields.push(
{
buttonText: "{{ _('Previous') }}",
styleClasses: "tmi-survey-button-white col-4 col-md-2",
type: "submit",
validateBeforeSubmit: true,
onSubmit: function(){
$("input").prop('disabled', true);
return postSurvey({{ previous_survey['survey_template_id'] }});
}
},
{
buttonText: "{{ _('Save & Go to Profile') }}",
styleClasses: "tmi-survey-button-white-noborder tmi-survey-centered col-4 col-md-8",
type: "submit",
validateBeforeSubmit: true,
onSubmit: function(){
$("input").prop('disabled', true);
return postSurvey("home");
}
},{
buttonText: "{{ _('Next') }}",
styleClasses: "tmi-survey-button-blue col-4 col-md-2",
type: "submit",
validateBeforeSubmit: true,
onSubmit: function(){
$("input").prop('disabled', true);
return postSurvey({{ next_survey['survey_template_id'] }});
}
});
{% endif %}
{% endif %}
var errors_on_page = 0;
49 changes: 22 additions & 27 deletions microsetta_interface/templates/update_address.jinja2
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@
.text("-- SELECT --");
$("#state").append(option);
if (user_country == "United States") {
if (user_country == "US") {
for (var state of US_STATES)
{
if(user_state == state[0]) {
@@ -37,7 +37,7 @@
$("#state").append(option);
}
}
} else if (selected_country == "Spain") {
} else if (selected_country == "ES") {
for (var state of SPAIN_STATES)
{
var option = $('<option></option>')
@@ -46,12 +46,6 @@
$("#state").append(option);
}
$("#form_group_address_3, #form_group_address_type").show();
$("#phone").rules("remove");
$("#phone").rules( "add", {
required: true,
phoneSPAIN: true
});
} else {
for (var country of COUNTRIES_LIST)
{
@@ -198,55 +192,57 @@ $(document).ready(function(){
<div id="sorry_modal_content">{{ _('Sorry, it appears you are having trouble verifying your address. Please contact our support team at microsetta@ucsd.edu and they can assist with confirming your address.') }}</div>
</div>
</div>
<div class="card" style="max-width: 800px; text-align: left;">
<p class="tmi-content">
{{ _('We encountered the following issue when we attempted to verify your shipping address:') }}
</p>
{% for error in error_text %}
<p class="tmi-content">{{ error |e }}</p>
{% endfor %}
<p class="tmi-content">
{{ _('If you believe this is in error or need assistance correcting your address, please contact us at <a href="mailto:microsetta@ucsd.edu">microsetta@ucsd.edu</a>.') }}
</p>
<div class="card card-account" style="max-width: 800px; text-align: left;">
<h5 class="card-header" style="text-align: center">{{ _('Update Your Address') }}</h5>
<div class="card-body">
<form id="address_form" name="address_form" method="post">
<input type="hidden" name="interested_user_id" value="{{ user_info['interested_user_id'] |e }}" />
<input type="hidden" name="email" value="{{ user_info['email'] |e }}" />
<fieldset id="address">
<div class="form-group">
<div class="form-group mb-2">
<label for="address_1" name="address_1_label">{{ _('Address 1') }}*</label>
<input id="address_1" name="address_1" class="form-control" type="text" value="{{ user_info['address_1'] |e }}" />
</div>
<div class="form-group">
<div class="form-group mb-2">
<label for="address_2" name="address_2_label">{{ _('Address 2') }}</label>
<input id="address_2" name="address_2" class="form-control" type="text" value="{{ user_info['address_2'] |e }}" />
</div>
<div class="form-group" id="form_group_address_3">
<div class="form-group mb-2" id="form_group_address_3">
<label for="address_3" name="address_3_label">{{ _('Address 3') }}</label>
<input id="address_3" name="address_3" class="form-control" value="{{ user_info['address_3'] |e }}" type="text" />
</div>
<div class="form-group">
<div class="form-group mb-2">
<label for="city" name="city_label">{{ _('City') }}*</label>
<input id="city" name="city" class="form-control" type="text" value="{{ user_info['city'] |e }}" />
</div>
<div class="form-group">
<div class="form-group mb-2">
<label for="state" name="state_label">{{ _('State') }}*</label>
<select id="state" name="state" class="form-control">
<option value="">-- {{ _('SELECT') }}</option>
</select>
</div>
<div class="form-group">
<div class="form-group mb-2">
<label for="postal" name="postal_label">{{ _('Postal Code') }}*</label>
<input id="postal" name="postal" class="form-control" type="text" value="{{ user_info['postal_code'] |e }}" />
</div>
<div class="form-group" id="form_group_address_type">
<label for="residential_address" name="residential_address_label">{{ _('Address Type') }}</label>
<select id="residential_address" name="residential_address" class="form-control">
<option value="true" {% if user_info['residential_address']=="true" %} selected="selected"{% endif %}>{{ _('Residential') }}</option>
<option value="false" {% if user_info['residential_address']=="false" %} selected="selected"{% endif %}>{{ _('Commercial') }}</option>
</select>
</div>
<div class="form-group">
<label for="phone" name="phone_label">{{ _('Phone Number') }}*</label>
<div class="form-group mb-2">
<label for="phone" name="phone_label">{{ _('Phone Number') }}</label>
<input id="phone" name="phone" class="form-control" type="text" value="{{ user_info['phone'] |e }}" />
</div>
<div class="form-group">
<div class="form-group mb-2">
<label for="country" name="country_label">{{ _('Country')}}</label>
<input id="country" name="country" class="form-control" type="text" disabled value="{{ user_info['country'] |e }}">
</div>
<div class="form-group">
<div class="form-group mb-2">
<label for="postal" class="error" style="display: none;">{{ _('Sorry, we were unable to verify your address. Please check your information and try again.') }}</label>
</div>
</fieldset>
@@ -257,7 +253,6 @@ $(document).ready(function(){
</div>
</div>
</center>

<script type="text/javascript">
populateStates('{{ user_info['state'] |e }}','{{ user_info['country'] |e }}');
</script>
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@

{% block content %}
<center>
<div class="card" style="max-width: 800px; text-align: left;">
<div class="card card-account" style="max-width: 800px; text-align: left;">
<h5 class="card-header" style="text-align: center">{{ _('Address Updated') }}</h5>
<div class="card-body">
<center>