Skip to content

Commit

Permalink
Custom section summaries (#17)
Browse files Browse the repository at this point in the history
Add custom section summary definitions
  • Loading branch information
JamesGardiner authored Mar 25, 2020
1 parent b78c537 commit 69db303
Show file tree
Hide file tree
Showing 28 changed files with 299 additions and 330 deletions.
2 changes: 1 addition & 1 deletion scripts/run_validator.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash

branch=latest
branch=custom-section-summaries
docker pull onsdigital/eq-questionnaire-validator:$branch
docker run -d -p 5001:5000 "onsdigital/eq-questionnaire-validator:$branch"
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ local placeholders = import '../../../lib/placeholders.libsonnet';

{
type: 'ListCollectorDrivingQuestion',
for_list: 'visitor',
for_list: 'visitors',
id: 'any-visitors',
show_on_section_summary: false,
question: {
type: 'General',
id: 'any-visitors-question',
Expand Down Expand Up @@ -35,7 +34,7 @@ local placeholders = import '../../../lib/placeholders.libsonnet';
type: 'RedirectToListAddQuestion',
params: {
block_id: 'add-visitor',
list_name: 'visitor',
list_name: 'visitors',
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,6 @@ local questionTitle = {
],
};

local questionVariantTitle = {
text: 'Did anyone else usually live at {household_address} on Sunday {census_date}?',
placeholders: [
placeholders.address,
placeholders.censusDate,
],
};

local summaryTitlePersonName = {
text: '{person_name}',
placeholders: [
placeholders.personName,
],
};

local addPersonQuestionTitle = {
text: 'Who do you need to add to {household_address}?',
placeholders: [
placeholders.address,
],
};

local primaryEditPersonQuestionTitle = {
text: 'Change details for {person_name} (You)',
placeholders: [
Expand All @@ -45,13 +23,6 @@ local nonPrimaryEditPersonQuestionTitle = {
],
};

local removePersonQuestionTitle = {
text: 'Are you sure you want to remove {person_name}?',
placeholders: [
placeholders.personName,
],
};

local editQuestion(questionTitle) = {
id: 'edit-question',
type: 'General',
Expand Down Expand Up @@ -128,7 +99,13 @@ local editQuestion(questionTitle) = {
question: {
id: 'anyone-usually-live-at-question',
type: 'General',
title: questionVariantTitle,
title: {
text: 'Did anyone else usually live at {household_address} on Sunday {census_date}?',
placeholders: [
placeholders.address,
placeholders.censusDate,
],
},
guidance: {
contents: [
{
Expand Down Expand Up @@ -165,7 +142,12 @@ local editQuestion(questionTitle) = {
question: {
id: 'add-question',
type: 'General',
title: addPersonQuestionTitle,
title: {
text: 'Who do you need to add to {household_address}?',
placeholders: [
placeholders.address,
],
},
instruction: 'Enter a full stop (.) if the respondent does not know a person’s “First name” or “Last name”',
answers: [
{
Expand Down Expand Up @@ -214,7 +196,12 @@ local editQuestion(questionTitle) = {
title: 'All of the data entered about this person will be deleted',
}],
},
title: removePersonQuestionTitle,
title: {
text: 'Are you sure you want to remove {person_name}?',
placeholders: [
placeholders.personName,
],
},
answers: [
{
id: 'remove-confirmation',
Expand All @@ -236,8 +223,11 @@ local editQuestion(questionTitle) = {
},
summary: {
title: 'Household members',
item_title: summaryTitlePersonName,
add_link_text: 'Add someone to this household',
empty_list_text: 'There are no householders',
item_title: {
text: '{person_name}',
placeholders: [
placeholders.personName,
],
},
},
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
local placeholders = import '../../../lib/placeholders.libsonnet';
local rules = import 'rules.libsonnet';

local summaryTitlePersonName = {
text: '{person_name}',
placeholders: [
placeholders.personName,
],
};

local addPersonQuestionTitle = {
text: 'Who do you need to add to {household_address}?',
placeholders: [
placeholders.address,
],
};

local primaryEditPersonQuestionTitle = {
text: 'Change details for {person_name} (You)',
placeholders: [
Expand All @@ -29,13 +15,6 @@ local nonPrimaryEditPersonQuestionTitle = {
],
};

local removePersonQuestionTitle = {
text: 'Are you sure you want to remove {person_name}?',
placeholders: [
placeholders.personName,
],
};

local editQuestion(questionTitle) = {
id: 'anyone-else-temp-away-edit-question',
type: 'General',
Expand Down Expand Up @@ -121,7 +100,12 @@ local editQuestion(questionTitle) = {
question: {
id: 'anyone-else-temp-away-add-question',
type: 'General',
title: addPersonQuestionTitle,
title: {
text: 'Who do you need to add to {household_address}?',
placeholders: [
placeholders.address,
],
},
instruction: 'Enter a full stop (.) if the respondent does not know a person’s “First name” or “Last name”',
answers: [
{
Expand Down Expand Up @@ -170,7 +154,12 @@ local editQuestion(questionTitle) = {
title: 'All of the data entered about this person will be deleted',
}],
},
title: removePersonQuestionTitle,
title: {
text: 'Are you sure you want to remove {person_name}?',
placeholders: [
placeholders.personName,
],
},
answers: [
{
id: 'anyone-else-temp-away-remove-confirmation',
Expand All @@ -192,9 +181,11 @@ local editQuestion(questionTitle) = {
},
summary: {
title: 'Household members',
item_title: summaryTitlePersonName,
add_link_text: 'Add another visitor to this household',
empty_list_text: 'There are no visitors',
item_title: {
text: '{person_name}',
placeholders: [
placeholders.personName,
],
},
},
show_on_section_summary: false,
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
local placeholders = import '../../../lib/placeholders.libsonnet';

local questionTitle = {
text: 'Was anyone in your current household usually living at {household_address} on Sunday {census_date}?',
placeholders: [
placeholders.address,
placeholders.censusDate,
],
};

{
type: 'Question',
id: 'anyone-else-usually-living',
show_on_section_summary: false,
question: {
id: 'anyone-else-usually-living-question',
title: questionTitle,
title: {
text: 'Was anyone in your current household usually living at {household_address} on Sunday {census_date}?',
placeholders: [
placeholders.address,
placeholders.censusDate,
],
},
type: 'General',
answers: [{
id: 'anyone-else-usually-living-answer',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
local placeholders = import '../../../lib/placeholders.libsonnet';

local questionTitle = {
text: 'Were you usually living at {household_address} on Sunday {census_date}?',
placeholders: [
placeholders.address,
placeholders.censusDate,
],
};

{
id: 'primary-person-list-collector',
type: 'PrimaryPersonListCollector',
Expand Down Expand Up @@ -48,7 +40,13 @@ local questionTitle = {
question: {
id: 'primary-confirmation-question',
type: 'General',
title: questionTitle,
title: {
text: 'Were you usually living at {household_address} on Sunday {census_date}?',
placeholders: [
placeholders.address,
placeholders.censusDate,
],
},
instruction: 'Tell respondent to turn to <strong>Showcard 1</strong>',
answers: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
],
},
],
show_on_section_summary: false,
question: {
id: 'relationships-question',
title: 'Are any of these people related to each other?',
Expand Down
Loading

0 comments on commit 69db303

Please sign in to comment.