Commit 8e7eec3f by Braden MacDonald

Clarify the various messages and what they are supposed to do

parent 2562f54b
...@@ -40,6 +40,52 @@ class MentoringMessageBlock(XBlock, StudioEditableXBlockMixin): ...@@ -40,6 +40,52 @@ class MentoringMessageBlock(XBlock, StudioEditableXBlockMixin):
A message which can be conditionally displayed at the mentoring block level, A message which can be conditionally displayed at the mentoring block level,
for example upon completion of the block for example upon completion of the block
""" """
MESSAGE_TYPES = {
"completed": {
"display_name": _(u"Completed"),
"long_display_name": _(u"Message shown when complete"),
"default": _(u"Great job!"),
"description": _(
u"In standard mode, this message will be shown when the student achieves a "
"perfect score. "
"This message is ignored in assessment mode."
),
},
"incomplete": {
"display_name": _(u"Incomplete"),
"long_display_name": _(u"Message shown when incomplete"),
"default": _(u"Not quite! You can try again, though."),
"description": _(
u"In standard mode, this message will be shown when the student gets at least "
"one question wrong, but is allowed to try again. "
"This message is ignored in assessment mode."
),
},
"max_attempts_reached": {
"display_name": _(u"Reached max. # of attempts"),
"long_display_name": _(u"Message shown when student reaches max. # of attempts"),
"default": _(u"Sorry, you have used up all of your allowed submissions."),
"description": _(
u"In standard mode, this message will be shown when the student has used up "
"all of their allowed attempts without achieving a perfect score. "
"This message is ignored in assessment mode."
),
},
"on-assessment-review": {
"display_name": _(u"Review with attempts left"),
"long_display_name": _(u"Message shown during review when attempts remain"),
"default": _(
u"You may try this assessment again, and only the latest score will be used."
),
"description": _(
u"In assessment mode, this message will be shown when the student is reviewing "
"their answers to the assessment, if the student is allowed to try again. "
"This message is ignored in standard mode and is not shown if the student has "
"used up all of their allowed attempts."
),
},
}
content = String( content = String(
display_name=_("Message"), display_name=_("Message"),
help=_("Message to display upon completion"), help=_("Message to display upon completion"),
...@@ -53,10 +99,10 @@ class MentoringMessageBlock(XBlock, StudioEditableXBlockMixin): ...@@ -53,10 +99,10 @@ class MentoringMessageBlock(XBlock, StudioEditableXBlockMixin):
scope=Scope.content, scope=Scope.content,
default="completed", default="completed",
values=( values=(
{"display_name": "Completed", "value": "completed"}, {"value": "completed", "display_name": MESSAGE_TYPES["completed"]["display_name"]},
{"display_name": "Incompleted", "value": "incomplete"}, {"value": "incomplete", "display_name": MESSAGE_TYPES["incomplete"]["display_name"]},
{"display_name": "Reached max. # of attemps", "value": "max_attempts_reached"}, {"value": "max_attempts_reached", "display_name": MESSAGE_TYPES["max_attempts_reached"]["display_name"]},
{"display_name": "Review with attempts left", "value": "on-assessment-review"} {"value": "on-assessment-review", "display_name": MESSAGE_TYPES["on-assessment-review"]["display_name"]},
), ),
) )
editable_fields = ("content", ) editable_fields = ("content", )
...@@ -77,27 +123,34 @@ class MentoringMessageBlock(XBlock, StudioEditableXBlockMixin): ...@@ -77,27 +123,34 @@ class MentoringMessageBlock(XBlock, StudioEditableXBlockMixin):
""" Normal view of this XBlock, identical to mentoring_view """ """ Normal view of this XBlock, identical to mentoring_view """
return self.mentoring_view(context) return self.mentoring_view(context)
def author_view(self, context=None):
fragment = self.mentoring_view(context)
fragment.content += u'<div class="submission-message-help"><p>{}</p></div>'.format(self.help_text)
return fragment
@property @property
def display_name_with_default(self): def display_name_with_default(self):
if self.type == 'max_attempts_reached': try:
max_attempts = self.get_parent().max_attempts return self._(self.MESSAGE_TYPES[self.type]["long_display_name"])
return self._(u"Message when student reaches max. # of attempts ({limit})").format( except KeyError:
limit=self._(u"unlimited") if max_attempts == 0 else max_attempts return u"INVALID MESSAGE"
)
if self.type == 'completed': @property
return self._(u"Message shown when complete") def help_text(self):
if self.type == 'incomplete': try:
return self._(u"Message shown when incomplete") return self._(self.MESSAGE_TYPES[self.type]["description"])
if self.type == 'on-assessment-review': except KeyError:
return self._(u"Message shown during review when attempts remain") return u"This message is not a valid message type!"
return u"INVALID MESSAGE"
@classmethod @classmethod
def get_template(cls, template_id): def get_template(cls, template_id):
""" """
Used to interact with Studio's create_xblock method to instantiate pre-defined templates. Used to interact with Studio's create_xblock method to instantiate pre-defined templates.
""" """
return {'data': {'type': template_id, 'content': "Message goes here."}} return {'data': {
'type': template_id,
'content': cls.MESSAGE_TYPES[template_id]["default"],
}}
@classmethod @classmethod
def parse_xml(cls, node, runtime, keys, id_generator): def parse_xml(cls, node, runtime, keys, id_generator):
......
...@@ -26,3 +26,11 @@ ...@@ -26,3 +26,11 @@
border-color: #888; border-color: #888;
cursor: default; cursor: default;
} }
.xblock[data-block-type=problem-builder] .submission-message-help p {
border-top: 1px solid #ddd;
font-size: 0.85em;
font-style: italic;
margin-top: 1em;
padding-top: 0.3em;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment