From 98730f314109620427b5a959964fcb83ff434382 Mon Sep 17 00:00:00 2001 From: Nick Parlante Date: Thu, 25 Jun 2015 15:08:15 -0700 Subject: [PATCH] Fix hint-problem tab bug TNL-2542 Revert the removal of hint templates. Move the 'tab' attribute in the new-problem yaml files out one level, out of the 'metadata' section. --- .../contentstore/views/component.py | 4 +- ...d-xblock-component-menu-problem.underscore | 3 + .../problem/checkboxes_response_hint.yaml | 69 +++++++++++++++++++ .../problem/multiplechoice_hint.yaml | 46 +++++++++++++ .../problem/numericalresponse_hint.yaml | 54 +++++++++++++++ .../problem/optionresponse_hint.yaml | 51 ++++++++++++++ .../problem/string_response_hint.yaml | 54 +++++++++++++++ 7 files changed, 279 insertions(+), 2 deletions(-) create mode 100644 common/lib/xmodule/xmodule/templates/problem/checkboxes_response_hint.yaml create mode 100644 common/lib/xmodule/xmodule/templates/problem/multiplechoice_hint.yaml create mode 100644 common/lib/xmodule/xmodule/templates/problem/numericalresponse_hint.yaml create mode 100644 common/lib/xmodule/xmodule/templates/problem/optionresponse_hint.yaml create mode 100644 common/lib/xmodule/xmodule/templates/problem/string_response_hint.yaml diff --git a/cms/djangoapps/contentstore/views/component.py b/cms/djangoapps/contentstore/views/component.py index 8169f5499e..391a62d6b7 100644 --- a/cms/djangoapps/contentstore/views/component.py +++ b/cms/djangoapps/contentstore/views/component.py @@ -282,8 +282,8 @@ def get_component_templates(courselike, library=False): tab = 'common' if template['metadata'].get('markdown') is None: tab = 'advanced' - # Then the problem can override that with a tab: setting - tab = template['metadata'].get('tab', tab) + # Then the problem can override that with a tab: attribute (note: not nested in metadata) + tab = template.get('tab', tab) templates_for_category.append( create_template_dict( diff --git a/cms/templates/js/add-xblock-component-menu-problem.underscore b/cms/templates/js/add-xblock-component-menu-problem.underscore index d3324d1b62..301064935c 100644 --- a/cms/templates/js/add-xblock-component-menu-problem.underscore +++ b/cms/templates/js/add-xblock-component-menu-problem.underscore @@ -3,6 +3,9 @@
  • <%= gettext("Common Problem Types") %>
  • +
  • + <%= gettext("Common Problems with Hints and Feedback") %> +
  • <%= gettext("Advanced") %>
  • diff --git a/common/lib/xmodule/xmodule/templates/problem/checkboxes_response_hint.yaml b/common/lib/xmodule/xmodule/templates/problem/checkboxes_response_hint.yaml new file mode 100644 index 0000000000..b0882e6b3b --- /dev/null +++ b/common/lib/xmodule/xmodule/templates/problem/checkboxes_response_hint.yaml @@ -0,0 +1,69 @@ +--- +metadata: + display_name: Checkboxes with Hints and Feedback + markdown: | + + You can provide feedback for each option in a checkbox problem, with distinct feedback depending on whether or not the learner selects that option. + + You can also provide compound feedback for a specific combination of answers. For example, if you have three possible answers in the problem, you can configure specific feedback for when a learner selects each combination of possible answers. + + You can also add hints for learners. + + Be sure to select Settings to specify a Display Name and other values that apply. + + Use the following example problem as a model. + + >>Which of the following is a fruit? Check all that apply.<< + + [x] apple {{ selected: You are correct that an apple is a fruit because it is the fertilized ovary that comes from an apple tree and contains seeds. }, { unselected: Remember that an apple is also a fruit.}} + [x] pumpkin {{ selected: You are correct that a pumpkin is a fruit because it is the fertilized ovary of a squash plant and contains seeds. }, { unselected: Remember that a pumpkin is also a fruit.}} + [ ] potato {{ U: You are correct that a potato is a vegetable because it is an edible part of a plant in tuber form.}, { S: A potato is a vegetable, not a fruit, because it does not come from a flower and does not contain seeds.}} + [x] tomato {{ S: You are correct that a tomato is a fruit because it is the fertilized ovary of a tomato plant and contains seeds. }, { U: Many people mistakenly think a tomato is a vegetable. However, because a tomato is the fertilized ovary of a tomato plant and contains seeds, it is a fruit.}} + + + {{ ((A B D)) An apple, pumpkin, and tomato are all fruits as they all are fertilized ovaries of a plant and contain seeds. }} + {{ ((A B C D)) You are correct that an apple, pumpkin, and tomato are all fruits as they all are fertilized ovaries of a plant and contain seeds. However, a potato is not a fruit as it is an edible part of a plant in tuber form and is a vegetable. }} + + ||A fruit is the fertilized ovary from a flower.|| + ||A fruit contains seeds of the plant.|| + +tab: hint +data: | + + +

    You can provide feedback for each option in a checkbox problem, with distinct feedback depending on whether or not the learner selects that option.

    + +

    You can also provide compound feedback for a specific combination of answers. For example, if you have three possible answers in the problem, you can configure specific feedback for when a learner selects each combination of possible answers.

    + +

    You can also add hints for learners.

    + +

    Use the following example problem as a model.

    + +

    Which of the following is a fruit? Check all that apply.

    + + + apple + You are correct that an apple is a fruit because it is the fertilized ovary that comes from an apple tree and contains seeds. + Remember that an apple is also a fruit. + + pumpkin + You are correct that a pumpkin is a fruit because it is the fertilized ovary of a squash plant and contains seeds. + Remember that a pumpkin is also a fruit. + + potato + A potato is a vegetable, not a fruit, because it does not come from a flower and does not contain seeds. + You are correct that a potato is a vegetable because it is an edible part of a plant in tuber form. + + tomato + You are correct that a tomato is a fruit because it is the fertilized ovary of a tomato plant and contains seeds. + Many people mistakenly think a tomato is a vegetable. However, because a tomato is the fertilized ovary of a tomato plant and contains seeds, it a fruit. + + An apple, pumpkin, and tomato are all fruits as they all are fertilized ovaries of a plant and contain seeds. + You are correct that an apple, pumpkin, and tomato are all fruits as they all are fertilized ovaries of a plant and contain seeds. However, a potato is not a fruit as it is an edible part of a plant in tuber form and is classified as a vegetable. + + + + A fruit is the fertilized ovary from a flower. + A fruit contains seeds of the plant. + +
    diff --git a/common/lib/xmodule/xmodule/templates/problem/multiplechoice_hint.yaml b/common/lib/xmodule/xmodule/templates/problem/multiplechoice_hint.yaml new file mode 100644 index 0000000000..acace4cc9f --- /dev/null +++ b/common/lib/xmodule/xmodule/templates/problem/multiplechoice_hint.yaml @@ -0,0 +1,46 @@ +--- +metadata: + display_name: Multiple Choice with Hints and Feedback + markdown: | + + You can provide feedback for each option in a multiple choice problem. + + You can also add hints for learners. + + Be sure to select Settings to specify a Display Name and other values that apply. + + Use the following example problem as a model. + + >>Which of the following is a vegetable?<< + ( ) apple {{An apple is the fertilized ovary that comes from an apple tree and contains seeds, meaning it is a fruit.}} + ( ) pumpkin {{A pumpkin is the fertilized ovary of a squash plant and contains seeds, meaning it is a fruit.}} + (x) potato {{A potato is an edible part of a plant in tuber form and is a vegetable.}} + ( ) tomato {{Many people mistakenly think a tomato is a vegetable. However, because a tomato is the fertilized ovary of a tomato plant and contains seeds, it is a fruit.}} + + ||A fruit is the fertilized ovary from a flower.|| + ||A fruit contains seeds of the plant.|| + +tab: hint +data: | + + +

    You can provide feedback for each option in a multiple choice problem.

    + +

    You can also add hints for learners.

    + +

    Use the following example problem as a model.

    + +

    Which of the following is a vegetable?

    + + + apple An apple is the fertilized ovary that comes from an apple tree and contains seeds, meaning it is a fruit. + pumpkin A pumpkin is the fertilized ovary of a squash plant and contains seeds, meaning it is a fruit. + potato A potato is an edible part of a plant in tuber form and is a vegetable. + tomato Many people mistakenly think a tomato is a vegetable. However, because a tomato is the fertilized ovary of a tomato plant and contains seeds, it is a fruit. + + + + A fruit is the fertilized ovary from a flower. + A fruit contains seeds of the plant. + +
    diff --git a/common/lib/xmodule/xmodule/templates/problem/numericalresponse_hint.yaml b/common/lib/xmodule/xmodule/templates/problem/numericalresponse_hint.yaml new file mode 100644 index 0000000000..0f00b7760b --- /dev/null +++ b/common/lib/xmodule/xmodule/templates/problem/numericalresponse_hint.yaml @@ -0,0 +1,54 @@ +--- +metadata: + display_name: Numerical Input with Hints and Feedback + markdown: | + + You can provide feedback for correct answers in numerical input problems. You cannot provide feedback for incorrect answers. + + Use feedback for the correct answer to reinforce the process for arriving at the numerical value. + + You can also add hints for learners. + + Be sure to select Settings to specify a Display Name and other values that apply. + + Use the following example problem as a model. + + >>What is the arithmetic mean for the following set of numbers? (1, 5, 6, 3, 5)<< + + = 4 {{The mean for this set of numbers is 20 / 5, which equals 4.}} + + ||The mean is calculated by summing the set of numbers and dividing by n.|| + ||n is the count of items in the set.|| + + [explanation] + The mean is calculated by summing the set of numbers and dividing by n. In this case: (1 + 5 + 6 + 3 + 5) / 5 = 20 / 5 = 4. + [explanation] + +tab: hint +data: | + + +

    You can provide feedback for correct answers in numerical input problems. You cannot provide feedback for incorrect answers.

    + +

    Use feedback for the correct answer to reinforce the process for arriving at the numerical value.

    + +

    Use the following example problem as a model.

    + +

    What is the arithmetic mean for the following set of numbers? (1, 5, 6, 3, 5)

    + + + The mean for this set of numbers is 20 / 5, which equals 4. + + + +
    +

    Explanation

    +

    The mean is calculated by summing the set of numbers and dividing by n. In this case: (1 + 5 + 6 + 3 + 5) / 5 = 20 / 5 = 4.

    +
    +
    + + + The mean is calculated by summing the set of numbers and dividing by n. + n is the count of items in the set. + +
    \ No newline at end of file diff --git a/common/lib/xmodule/xmodule/templates/problem/optionresponse_hint.yaml b/common/lib/xmodule/xmodule/templates/problem/optionresponse_hint.yaml new file mode 100644 index 0000000000..c7674648f6 --- /dev/null +++ b/common/lib/xmodule/xmodule/templates/problem/optionresponse_hint.yaml @@ -0,0 +1,51 @@ +--- +metadata: + display_name: Dropdown with Hints and Feedback + markdown: | + + You can provide feedback for each available option in a dropdown problem. + + You can also add hints for learners. + + Be sure to select Settings to specify a Display Name and other values that apply. + + Use the following example problem as a model. + + >> A/an ________ is a vegetable.<< + + [[ + apple {{An apple is the fertilized ovary that comes from an apple tree and contains seeds, meaning it is a fruit.}} + pumpkin {{A pumpkin is the fertilized ovary of a squash plant and contains seeds, meaning it is a fruit.}} + (potato) {{A potato is an edible part of a plant in tuber form and is a vegetable.}} + tomato {{Many people mistakenly think a tomato is a vegetable. However, because a tomato is the fertilized ovary of a tomato plant and contains seeds, it is a fruit.}} + ]] + + ||A fruit is the fertilized ovary from a flower.|| + ||A fruit contains seeds of the plant.|| + +tab: hint +data: | + + +

    You can provide feedback for each available option in a dropdown problem.

    + +

    You can also add hints for learners.

    + +

    Use the following example problem as a model.

    + +

    A/an ________ is a vegetable.

    +
    + + + + + + + + + + + A fruit is the fertilized ovary from a flower. + A fruit contains seeds of the plant. + +
    diff --git a/common/lib/xmodule/xmodule/templates/problem/string_response_hint.yaml b/common/lib/xmodule/xmodule/templates/problem/string_response_hint.yaml new file mode 100644 index 0000000000..bcd6bf6813 --- /dev/null +++ b/common/lib/xmodule/xmodule/templates/problem/string_response_hint.yaml @@ -0,0 +1,54 @@ +--- +metadata: + display_name: Text Input with Hints and Feedback + markdown: | + + You can provide feedback for the correct answer in text input problems, as well as for specific incorrect answers. + + Use feedback on expected incorrect answers to address common misconceptions and to provide guidance on how to arrive at the correct answer. + + Be sure to select Settings to specify a Display Name and other values that apply. + + Use the following example problem as a model. + + >>Which U.S. state has the largest land area?<< + + =Alaska {{Alaska is 576,400 square miles, more than double the land area + of the second largest state, Texas.}} + + not=Texas {{While many people think Texas is the largest state, it is actually the second largest, with 261,797 square miles.}} + + not=California {{California is the third largest state, with 155,959 square miles.}} + + ||Consider the square miles, not population.|| + ||Consider all 50 states, not just the continental United States.|| + +tab: hint +data: | + + +

    You can provide feedback for the correct answer in text input problems, as well as for specific incorrect answers.

    + +

    Use feedback on expected incorrect answers to address common misconceptions and to provide guidance on how to arrive at the correct answer.

    + +

    Use the following example problem as a model.

    + +

    Which U.S. state has the largest land area?

    + + + + Alaska is 576,400 square miles, more than double the land area of the second largest state, Texas. + + While many people think Texas is the largest state, it is actually the second largest, with 261,797 square miles. + + California is the third largest state, with 155,959 square miles. + + + + + + Consider the square miles, not population. + Consider all 50 states, not just the continental United States. + + +