Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion problem_builder/mentoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,11 @@ def author_edit_view(self, context):
fragment = Fragment(u'<div class="mentoring">') # This DIV is needed for CSS to apply to the previews
self.render_children(context, fragment, can_reorder=True, can_add=False)
fragment.add_content(u'</div>')
fragment.add_content(loader.render_template('templates/html/mentoring_add_buttons.html', {}))

# Show buttons to add review-related child blocks only in assessment mode.
fragment.add_content(loader.render_template('templates/html/mentoring_add_buttons.html', {
"show_review": self.is_assessment,
}))
fragment.add_content(loader.render_template('templates/html/mentoring_url_name.html', {
"url_name": self.url_name
}))
Expand Down
8 changes: 3 additions & 5 deletions problem_builder/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,14 @@ class MentoringMessageBlock(XBlock, StudioEditableXBlockMixin, XBlockWithTransla
},
"on-assessment-review-question": {
"display_name": _(u"Study tips if this question was wrong"),
"long_display_name": _(u"Study tips shown during assessment review if wrong"),
"long_display_name": _(u"Study tips shown if question was answered incorrectly"),
"default": _(
u"Review ____."
),
"description": _(
u"In assessment mode, this message will be shown when the student is reviewing "
u"This message will be shown when the student is reviewing "
"their answers to the assessment, if the student got this specific question "
"wrong and 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."
"wrong and is allowed to try again."
),
},
}
Expand Down
6 changes: 4 additions & 2 deletions problem_builder/public/css/problem-builder-edit.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@
.xblock[data-block-type=step-builder] .add-xblock-component .new-component .new-component-type .add-xblock-component-button,
.xblock[data-block-type=problem-builder] .add-xblock-component .new-component .new-component-type .add-xblock-component-button,
.xblock[data-block-type=mentoring] .add-xblock-component .new-component .new-component-type .add-xblock-component-button {
width: 200px;
height: 30px;
width: auto;
height: auto;
line-height: 30px;
padding-left: 1em;
padding-right: 1em;
}

.xblock[data-block-type=sb-plot] .add-xblock-component .new-component .new-component-type .add-xblock-component-button.disabled,
Expand Down
6 changes: 4 additions & 2 deletions problem_builder/public/css/questionnaire-edit.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/* Custom appearance for our "Add" buttons */
.xblock .add-xblock-component .new-component .new-component-type .add-xblock-component-button {
width: 200px;
height: 30px;
width: auto;
height: auto;
line-height: 30px;
padding-left: 1em;
padding-right: 1em;
}

.xblock .add-xblock-component .new-component .new-component-type .add-xblock-component-button.disabled,
Expand Down
9 changes: 8 additions & 1 deletion problem_builder/questionnaire.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,14 @@ def author_edit_view(self, context):
Add some HTML to the author view that allows authors to add choices and tips.
"""
fragment = self.get_author_edit_view_fragment(context)
fragment.add_content(loader.render_template('templates/html/questionnaire_add_buttons.html', {}))

# Let the parent block determine whether to display buttons to add review-related child blocks.
# * Problem Builder units use MentoringBlock parent components, which define an 'is_assessment' property,
# indicating whether the (deprecated) assessment mode is enabled.
# * Step Builder units can show review components in the Review Step.
fragment.add_content(loader.render_template('templates/html/questionnaire_add_buttons.html', {
'show_review': getattr(self.get_parent(), 'is_assessment', True),
}))
fragment.add_css_url(self.runtime.local_resource_url(self, 'public/css/problem-builder.css'))
fragment.add_css_url(self.runtime.local_resource_url(self, 'public/css/questionnaire-edit.css'))
fragment.add_javascript_url(self.runtime.local_resource_url(self, 'public/js/util.js'))
Expand Down
2 changes: 2 additions & 0 deletions problem_builder/templates/html/mentoring_add_buttons.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ <h5>{% trans "Add New Component" %}</h5>
<li><a href="#" class="single-template add-xblock-component-button" data-category="pb-message" data-boilerplate="completed">{% trans "Message (Complete)" %}</a></li>
<li><a href="#" class="single-template add-xblock-component-button" data-category="pb-message" data-boilerplate="incomplete">{% trans "Message (Incomplete)" %}</a></li>
<li><a href="#" class="single-template add-xblock-component-button" data-category="pb-message" data-boilerplate="max_attempts_reached">{% trans "Message (Max # Attempts)" %}</a></li>
{% if show_review %}
<li><a href="#" class="single-template add-xblock-component-button" data-category="pb-message" data-boilerplate="on-assessment-review">{% trans "Message (Assessment Review)" %}</a></li>
{% endif %}
</ul>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
<ul class="new-component-type">
<li><a href="#" class="single-template add-xblock-component-button" data-category="pb-choice" data-boilerplate="studio_default">{% trans "Add Custom Choice" %}</a></li>
<li><a href="#" class="single-template add-xblock-component-button" data-category="pb-tip">{% trans "Add Tip" %}</a></li>
<li><a href="#" class="single-template add-xblock-component-button" data-category="pb-message" data-boilerplate="on-assessment-review-question">{% trans "Message (Assessment Review)" %}</a></li>
{% if show_review %}
<li><a href="#" class="single-template add-xblock-component-button" data-category="pb-message" data-boilerplate="on-assessment-review-question">{% trans "Message (Review)" %}</a></li>
{% endif %}
</ul>
</div>
</div>