From 629963f4d33d2e44c162e87026c45d53954988f5 Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Fri, 27 Aug 2021 10:55:33 -0400 Subject: [PATCH] add survey-likert demos --- .../demos/jspsych-survey-likert-demo1.html | 67 ++++++++++++++ .../demos/jspsych-survey-likert-demo2.html | 69 +++++++++++++++ docs/plugins/jspsych-survey-likert.md | 88 +++++++++++-------- 3 files changed, 188 insertions(+), 36 deletions(-) create mode 100644 docs/plugins/demos/jspsych-survey-likert-demo1.html create mode 100644 docs/plugins/demos/jspsych-survey-likert-demo2.html diff --git a/docs/plugins/demos/jspsych-survey-likert-demo1.html b/docs/plugins/demos/jspsych-survey-likert-demo1.html new file mode 100644 index 00000000..d8b195d7 --- /dev/null +++ b/docs/plugins/demos/jspsych-survey-likert-demo1.html @@ -0,0 +1,67 @@ + + + + + + + + + + + + diff --git a/docs/plugins/demos/jspsych-survey-likert-demo2.html b/docs/plugins/demos/jspsych-survey-likert-demo2.html new file mode 100644 index 00000000..1d064594 --- /dev/null +++ b/docs/plugins/demos/jspsych-survey-likert-demo2.html @@ -0,0 +1,69 @@ + + + + + + + + + + + + diff --git a/docs/plugins/jspsych-survey-likert.md b/docs/plugins/jspsych-survey-likert.md index 07adb516..f6aa0537 100644 --- a/docs/plugins/jspsych-survey-likert.md +++ b/docs/plugins/jspsych-survey-likert.md @@ -27,44 +27,60 @@ question_order | array | An array with the order of questions. For example `[2,0 ## Examples -#### Basic example +???+ example "Single Question" + === "Code" + ```javascript + var trial = { + type: 'survey-likert', + questions: [ + { + prompt: "I like vegetables.", + labels: [ + "Strongly Disagree", + "Disagree", + "Neutral", + "Agree", + "Strongly Agree" + ] + } + ] + }; + ``` -```javascript -var scale_1 = [ - "Strongly Disagree", - "Disagree", - "Neutral", - "Agree", - "Strongly Agree" -]; + === "Demo" +
+ +
-var likert_page = { - type: 'survey-likert', - questions: [ - {prompt: "I like vegetables.", labels: scale_1} - ] -}; -``` + Open demo in new tab -#### Multiple questions in a random order +???+ example "Multiple questions in a random order" + === "Code" + ```javascript + var likert_scale = [ + "Strongly Disagree", + "Disagree", + "Neutral", + "Agree", + "Strongly Agree" + ]; -```javascript -var scale_1 = [ - "Strongly Disagree", - "Disagree", - "Neutral", - "Agree", - "Strongly Agree" -]; + var trial = { + type: 'survey-likert', + questions: [ + {prompt: "I like vegetables.", name: 'Vegetables', labels: likert_scale}, + {prompt: "I like fruit.", name: 'Fruit', labels: likert_scale}, + {prompt: "I like meat.", name: 'Meat', labels: likert_scale}, + ], + randomize_question_order: true + }; + ``` -var likert_page = { - type: 'survey-likert', - questions: [ - {prompt: "I like vegetables.", name: 'Vegetables', labels: scale_1}, - {prompt: "I like fruit.", name: 'Fruit', labels: scale_1}, - {prompt: "I like meat.", name: 'Meat', labels: scale_1}, - {prompt: "I like dairy.", name: 'Dairy', labels: scale_1} - ], - randomize_question_order: true -}; -``` + === "Demo" +
+ +
+ + Open demo in new tab + +