Skip to content

Commit

Permalink
Consent garden template (#81)
Browse files Browse the repository at this point in the history
* Add consent-garden template

* Update style for consent trial

* Update translation helper to include marking text as "html safe"

* Ignore "python-version" file created by pyenv

* Changeset

* Update tests for templates

* Spelling mistake
  • Loading branch information
okaycj authored Oct 22, 2024
1 parent ce8afc6 commit 9385555
Show file tree
Hide file tree
Showing 8 changed files with 353 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/cold-chairs-confess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@lookit/style": patch
---

Update consent trial style
6 changes: 6 additions & 0 deletions .changeset/strange-bottles-invent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@lookit/templates": patch
"@lookit/record": patch
---

Add Garden's consent template
4 changes: 3 additions & 1 deletion packages/record/scss/consent-video-trial.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ div#consent-video-trial {
font-size: 15px;
}

ol {
ol,
ul {
padding-left: 30px;
font-size: 15px;
}

li {
Expand Down
4 changes: 4 additions & 0 deletions packages/style/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -8937,6 +8937,10 @@ div#consent-video-trial p {
div#consent-video-trial ol {
padding-left: 30px;
}
div#consent-video-trial ol, div#consent-video-trial ul {
font-size: 15px;
margin-top: 0px;
}
div#consent-video-trial li {
padding-top: 10px;
padding-bottom: 10px;
Expand Down
307 changes: 307 additions & 0 deletions packages/templates/hbs/consent-garden.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,307 @@
<h1>
{{#if header}} {{exp-format header}} {{else}}
{{{t "consent-garden.header" experiment=experiment.name}}}
{{/if}}
</h1>

{{! intro sentence }}
<p>{{#if intro_sentence}} {{exp-format intro_sentence}} {{else}}
{{t
"consent-garden.intro-sentence"
name=PIName
institution=institution
experiment=experiment.name
htmlSafe=true
}}
{{/if}}
{{exp-format summary_statement}}
</p>

{{! overview }}
<h2>
{{#if overview_header}} {{exp-format overview_header}} {{else}}
{{t "consent-garden.overview-header" htmlSafe=true}}
{{/if}}
</h2>

<p>
{{#if overview_content}} {{exp-format overview_content}} {{else}}
{{t
"consent-garden.overview-content"
contact=PIContact
experiment=experiment.name
htmlSafe=true
}}
{{/if}}
</p>

{{! study info }}
<h2>
{{#if study_info_header}} {{exp-format study_info_header}} {{else}}
{{t "consent-garden.study-info-header" htmlSafe=true}}
{{/if}}
</h2>
<p>
{{#if study_info_content}} {{exp-format study_info_content}} {{else}}
{{t
"consent-garden.study-info-content"
description=study_info_description
lab=lab
institution=institution
experiment=experiment.name
htmlSafe=true
}}
{{/if}}
</p>

{{! purpose }}
<h2>
{{#if purpose_header}} {{exp-format purpose_header}} {{else}}
{{t "consent-garden.purpose-header" htmlSafe=true}}
{{/if}}
</h2>
<p>
{{exp-format purpose_content}}
</p>

{{! eligibility }}
<h2>
{{#if eligibility_header}} {{exp-format eligibility_header}} {{else}}
{{t "consent-garden.eligibility-header" htmlSafe=true}}
{{/if}}</h2>
<p>{{exp-format eligibility_content}}</p>

{{! procedures }}
<h2>{{#if procedures_header}} {{exp-format procedures_header}} {{else}}
{{t "consent-garden.procedures-header" htmlSafe=true}}
{{/if}}</h2>
<p>
{{#if include_duration_in_procedures}}
{{#if duration_statment}} {{exp-format duration_statment}} {{else}}
{{t
"consent-garden.duration-statement"
duration=experiment.duration
htmlSafe=true
}}
{{exp-format procedures_content}}
{{/if}}
{{else}}
{{exp-format procedures_content}}
{{/if}}
</p>

{{! payment }}
<h2>{{#if payment_header}} {{exp-format payment_header}} {{else}}
{{t "consent-garden.payment-header" htmlSafe=true}}
{{/if}}</h2>
<p>{{#if payment_content}} {{exp-format payment_content}} {{else}}
{{t "consent-garden.payment-content" htmlSafe=true}}
{{/if}}</p>

{{! benefits }}
<h2>{{#if benefits_header}} {{exp-format benefits_header}} {{else}}
{{t "consent-garden.benefits-header" htmlSafe=true}}
{{/if}}</h2>
<p>{{exp-format benefits_content}}</p>

{{! risks }}
<h2>{{#if risk_header}} {{exp-format risk_header}} {{else}}
{{t "consent-garden.risk-header" htmlSafe=true}}
{{/if}}</h2>
<p>
{{#if risk_content}}
{{exp-format risk_content}}
{{else}}
{{t
"consent-garden.risk-content-1"
duration=experiment.duration
experiment=experiment.name
htmlSafe=true
}}
{{#if risk_content_additional}}
{{exp-format risk_content_additional}}
{{/if}}
{{t
"consent-garden.risk-content-2"
risk_content_discontinue_options=risk_content_discontinue_options
htmlSafe=true
}}
{{#if risk_content_breach_of_confidentiality}}
{{exp-format risk_content_breach_of_confidentiality}}
{{/if}}
{{t "consent-garden.risk-content-3" htmlSafe=true}}
{{/if}}
</p>

{{! data collection }}
<h2>{{#if data_collection_header}}
{{exp-format data_collection_header}}
{{else}}
{{t "consent-garden.data-collection-header" htmlSafe=true}}
{{/if}}</h2>
<p>{{#if data_collection_content}}
{{exp-format data_collection_content}}
{{else}}
{{t
"consent-garden.data-collection-content"
institution=institution
omit_video=data_collection_omit_video
htmlSafe=true
}}
{{/if}}</p>

{{! data use }}
<h2>{{#if data_use_header}} {{exp-format data_use_header}} {{else}}
{{t "consent-garden.data-use-researchers-header" htmlSafe=true}}
{{/if}}</h2>
<p>{{#if data_use_content}} {{exp-format data_use_content}} {{else}}
{{t "consent-garden.data-use-researchers-content" htmlSafe=true}}
{{/if}}</p>

{{! data access }}
<h2>{{#if data_access_header}} {{exp-format data_access_header}} {{else}}
{{t "consent-garden.data-access-header" htmlSafe=true}}
{{/if}}</h2>
<p>{{#if data_access_content}} {{exp-format data_access_content}} {{else}}
{{t
"consent-garden.data-access-content"
institution=institution
htmlSafe=true
}}
{{/if}}</p>

{{! data management }}
<h2>{{#if data_management_header}}
{{exp-format data_management_header}}
{{else}}
{{t "consent-garden.data-management-header" htmlSafe=true}}
{{/if}}</h2>
<p>{{#if data_management_content}}
{{exp-format data_management_content}}
{{else}}
{{t "consent-garden.data-management-content" htmlSafe=true}}
{{/if}}</p>

{{! data sharing }}
<h2>{{#if data_sharing_header}} {{exp-format data_sharing_header}} {{else}}
{{t "consent-garden.data-sharing-header" htmlSafe=true}}
{{/if}}</h2>
<p>{{#if data_sharing_content}} {{exp-format data_sharing_content}} {{else}}
{{t
"consent-garden.data-sharing-content"
data_sharing_learn=data_sharing_learn
experiment=experiment.name
htmlSafe=true
}}
{{/if}}</p>

{{! research rights and irb info }}
<h2>{{#if research_rights_irb_header}}
{{exp-format research_rights_irb_header}}
{{else}}
{{t
"consent-garden.research-rights-irb-header"
institution=institution
htmlSafe=true
}}
{{/if}}</h2>
<p>{{#if research_rights_irb_content}}
{{exp-format research_rights_irb_content}}
{{else}}
{{t
"consent-garden.research-rights-irb-content"
institution=institution
include_irb_contact_statement=include_irb_contact_statement
irb_contact=irb_contact
irb_extra=irb_extra
htmlSafe=true
}}
{{/if}}</p>

{{! lookit info }}
<h2>{{#if lookit_info_header}} {{exp-format lookit_info_header}} {{else}}
{{t "consent-garden.lookit-info-header" htmlSafe=true}}
{{/if}}</h2>
<p>{{#if lookit_info_content}} {{exp-format lookit_info_content}} {{else}}
{{t "consent-garden.lookit-info-content" htmlSafe=true}}
{{/if}}</p>

{{! voluntary participation }}
<h2>{{#if voluntary_participation_header}}
{{exp-format voluntary_participation_header}}
{{else}}
{{t "consent-garden.voluntary-participation-header" htmlSafe=true}}
{{/if}}</h2>
<p>{{#if voluntary_participation_content}}
{{exp-format voluntary_participation_content}}
{{else}}
{{t "consent-garden.voluntary-participation-content" htmlSafe=true}}
{{/if}}</p>

{{! video sharing }}
<h2>{{#if video_sharing_header}} {{exp-format video_sharing_header}} {{else}}
{{t "consent-garden.video-sharing-header" htmlSafe=true}}
{{/if}}</h2>
<p>
{{#if video_sharing_consent}} {{exp-format video_sharing_consent}} {{else}}
{{t "consent-garden.video-sharing-consent" htmlSafe=true}}
{{/if}}
{{#unless data_collection_omit_video}}

{{#if video_sharing_study}}
{{exp-format video_sharing_study}}
{{else}}
{{#if private_level_only}}
{{t "consent-garden.video-sharing-study-private" htmlSafe=true}}
{{else}}
{{t "consent-garden.video-sharing-study-all-1" htmlSafe=true}}
{{#if include_databrary}}
{{t "consent-garden.video-sharing-study-all-databrary" htmlSafe=true}}
{{/if}}
{{t "consent-garden.video-sharing-study-all-2" htmlSafe=true}}
{{/if}}
{{/if}}
{{/unless}}

{{! additional video privacy statement }}
{{#if additional_video_privacy_statement}}
{{exp-format additional_video_privacy_statement}}
{{/if}}
</p>

{{! databrary sharing }}
{{#if include_databrary}}
<h2>{{#if databrary_header}} {{exp-format databrary_header}} {{else}}
{{t "consent-garden.databrary-header" htmlSafe=true}}
{{/if}}</h2>
<p>
{{#if databrary_content}} {{exp-format databrary_content}} {{else}}
{{t "consent-garden.databrary-content" htmlSafe=true}}
{{/if}}
</p>
{{/if}}

{{! additional segments }}
{{#if additional_segments}}
{{#each additional_segments as |segment|}}
<h2> {{exp-format segment.title}} </h2>
<p> {{exp-format segment.text}} </p>
{{/each}}
{{/if}}

{{! contact }}
<h2>
{{#if contact_header}} {{exp-format contact_header}} {{else}}
{{{t "consent-garden.contact-header" htmlSafe=true}}}
{{/if}}</h2>
<p>
{{#if contact_content}} {{exp-format contact_content}} {{else}}
{{t
"consent-garden.contact-content"
name=PIName
institution=institution
contact=PIContact
htmlSafe=true
}}
{{/if}}
</p>
3 changes: 3 additions & 0 deletions packages/templates/src/consentVideoTemplate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { LookitWindow } from "@lookit/data/dist/types";
import Handlebars from "handlebars";
import { PluginInfo, TrialType } from "jspsych";
import consent_garden from "../hbs/consent-garden.hbs";
import consent_template_5 from "../hbs/consent-template-5.hbs";
import consentVideoTrialTemplate from "../hbs/consent-video-trial.hbs";
import { ConsentTemplateNotFound } from "./errors";
Expand Down Expand Up @@ -48,6 +49,8 @@ const consentDocument = (trial: TrialType<PluginInfo>) => {
switch (trial.template) {
case "consent-template-5":
return consent_template_5;
case "consent-garden":
return consent_garden;
default:
throw new ConsentTemplateNotFound(trial.template);
}
Expand Down
Loading

0 comments on commit 9385555

Please sign in to comment.