-
Notifications
You must be signed in to change notification settings - Fork 4
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
Improve default settings for DnDv2 blocks #5
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
from .utils import _ | ||
|
||
INCORRECT_FEEDBACK = _("No, this item does not belong here. Try again.") | ||
CORRECT_FEEDBACK = _("Correct! This one belongs to {zone}.") | ||
|
||
DEFAULT_DATA = { | ||
"zones": [ | ||
{ | ||
"index": 1, | ||
"id": "zone-1", | ||
"title": _("Zone 1"), | ||
"title": _("The Top Zone"), | ||
"x": 160, | ||
"y": 30, | ||
"width": 196, | ||
|
@@ -14,43 +17,62 @@ | |
{ | ||
"index": 2, | ||
"id": "zone-2", | ||
"title": _("Zone 2"), | ||
"title": _("The Middle Zone"), | ||
"x": 86, | ||
"y": 210, | ||
"width": 340, | ||
"height": 140, | ||
"height": 138, | ||
}, | ||
{ | ||
"index": 3, | ||
"id": "zone-3", | ||
"title": _("The Bottom Zone"), | ||
"x": 15, | ||
"y": 350, | ||
"width": 485, | ||
"height": 135, | ||
} | ||
], | ||
"items": [ | ||
{ | ||
"displayName": "1", | ||
"displayName": "Goes to the top", | ||
"feedback": { | ||
"incorrect": _("No, 1 does not belong here"), | ||
"correct": _("Yes, it's a 1") | ||
"incorrect": INCORRECT_FEEDBACK, | ||
"correct": CORRECT_FEEDBACK.format(zone="the top") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
}, | ||
"zone": "Zone 1", | ||
"zone": "The Top Zone", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this needs to be translated, or else it would break for users of other languages, since "The Top Zone" would no longer match the translated zone name, e.g. "La zona de la parte superior" |
||
"imageURL": "", | ||
"id": 0, | ||
}, | ||
{ | ||
"displayName": "2", | ||
"displayName": "Goes to the middle", | ||
"feedback": { | ||
"incorrect": _("No, 2 does not belong here"), | ||
"correct": _("Yes, it's a 2") | ||
"incorrect": INCORRECT_FEEDBACK, | ||
"correct": CORRECT_FEEDBACK.format(zone="the middle") | ||
}, | ||
"zone": "Zone 2", | ||
"zone": "The Middle Zone", | ||
"imageURL": "", | ||
"id": 1, | ||
}, | ||
{ | ||
"displayName": "X", | ||
"displayName": "Goes to the bottom", | ||
"feedback": { | ||
"incorrect": INCORRECT_FEEDBACK, | ||
"correct": CORRECT_FEEDBACK.format(zone="the bottom") | ||
}, | ||
"zone": "The Bottom Zone", | ||
"imageURL": "", | ||
"id": 2, | ||
}, | ||
{ | ||
"displayName": "I don't belong anywhere", | ||
"feedback": { | ||
"incorrect": _("You silly, there are no zones for X"), | ||
"incorrect": _("You silly, there are no zones for this one."), | ||
"correct": "" | ||
}, | ||
"zone": "none", | ||
"imageURL": "", | ||
"id": 2, | ||
"id": 3, | ||
}, | ||
], | ||
"feedback": { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -144,11 +144,20 @@ def items_without_answers(): | |
item['inputOptions'] = 'inputOptions' in item | ||
return items | ||
|
||
def title_with_points(): | ||
""" | ||
Build title using `display_name` and `weight` of this Drag and Drop exercise. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the rationale for this change to the title? I'm not sure that course authors will like it in general - some drag and drop assignments will be ungraded, and it might confuse students to talk about how many points they can earn. In addition, authors can always just set a title like "Shapes Drag and Drop Exercise (1 point possible)", manually including the point value in the title string. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bradenmacdonald Good point about ungraded assignments -- this change was basically just me trying to match the screenshots in the README as closely as possible :) I reverted the change. |
||
""" | ||
if self.weight == 1: | ||
return "{title} (1 point possible)".format(title=self.display_name) | ||
else: | ||
return "{title} ({max_grade} points possible)".format(title=self.display_name, max_grade=self.weight) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The strings need to be marked for i18n with |
||
|
||
return { | ||
"zones": self.data.get('zones', []), | ||
"display_zone_labels": self.data.get('displayLabels', False), | ||
"items": items_without_answers(), | ||
"title": self.display_name, | ||
"title": title_with_points(), | ||
"show_title": self.show_title, | ||
"question_text": self.question_text, | ||
"show_question_header": self.show_question_header, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -203,7 +203,15 @@ | |
|
||
.xblock--drag-and-drop--editor .items-form .item-numerical-value, | ||
.xblock--drag-and-drop--editor .items-form .item-numerical-margin { | ||
width: 60px; | ||
margin-right: 1%; | ||
} | ||
|
||
.xblock--drag-and-drop--editor .items-form .item-numerical-value { | ||
width: 620px; | ||
} | ||
|
||
.xblock--drag-and-drop--editor .items-form .item-numerical-margin { | ||
width: 578px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
|
||
.xblock--drag-and-drop--editor .items-form textarea { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ <h3>{% trans "Question title" %}</h3> | |
</label> | ||
|
||
<h3>{% trans "Maximum score" %}</h3> | ||
<input class="weight" value="1" value="{{ self.weight }}"/> | ||
<input class="weight" value="1" value="{{ self.weight }}" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not your fault, but while I notice this, can you please add |
||
|
||
<h3>{% trans "Question text" %}</h3> | ||
<textarea class="question-text">{{ self.question_text }}</textarea> | ||
|
@@ -30,7 +30,7 @@ <h3>{% trans "Question text" %}</h3> | |
{% trans "Show \"Question\" heading" %} | ||
</label> | ||
|
||
<h3>{% trans "Introduction Feedback" %}</h3> | ||
<h3>{% trans "Introductory Feedback" %}</h3> | ||
<textarea class="intro-feedback">{{ self.data.feedback.start }}</textarea> | ||
|
||
<h3>{% trans "Final Feedback" %}</h3> | ||
|
@@ -48,7 +48,10 @@ <h3>{% trans "Zones" %}</h3> | |
<h3 id="background-url-label"> | ||
{% trans "Background URL" %} | ||
</h3> | ||
<input type="text" class="url-input" aria-labelledby="background-url-label"> | ||
<input type="text" | ||
class="url-input" | ||
aria-labelledby="background-url-label" | ||
placeholder="e.g. http://example.com/background.png or /static/background.png"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good placeholder - just add |
||
<h3 id="background-description-label"> | ||
{% trans "Background description" %} | ||
</h3> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,12 +113,20 @@ | |
value="{{ height }}" /> | ||
</div> | ||
<div class="row"> | ||
<label for="item-{{id}}-numerical-value">{{i18n "Optional numerical value"}}</label> | ||
<input type="text" | ||
<label for="item-{{id}}-numerical-value"> | ||
{{i18n "Optional numerical value (if you set this, students will be prompted for this value after dropping this item)"}} | ||
</label> | ||
<input type="number" | ||
step="0.1" | ||
id="item-{{id}}-numerical-value" | ||
class="item-numerical-value" value="{{ numericalValue }}" /> | ||
<label for="item-{{id}}-numerical-margin">{{i18n "Margin ±"}}</label> | ||
<input type="text" | ||
</div> | ||
<div class="row"> | ||
<label for="item-{{id}}-numerical-margin"> | ||
{{i18n "Margin ± (to be considered correct, value entered by user must not differ from expected value by more than this)"}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This need to be crystal-clear that this value is only used if the "numerical value" is set. How about "when a numerical value is required, the value entered by user must not differ from expected value by more than this margin; default is zero" |
||
</label> | ||
<input type="number" | ||
step="0.1" | ||
id="item-{{id}}-numerical-margin" | ||
class="item-numerical-margin" value="{{ numericalMargin }}" /> | ||
</div> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This string (and other strings below) should be translated, no?