Commit a61a5ca2 by gradyward

Merge pull request #502 from edx/grady/student-training-authoring-templates

Grady/student training authoring templates
parents 749ee0e0 927433f5
......@@ -15,8 +15,20 @@
<p class="openassessment_description">
{% trans "Enter one or more sample responses that you've created, together with the scores you would give those responses. Be sure to format the responses and scores according to the placeholder text below." %}
</p>
<textarea id="student_training_examples">{{ assessments.student_training.examples }}</textarea>
<ol>
{% for example in assessments.training.examples %}
{% include "openassessmentblock/edit/oa_training_example.html" with example=example %}
{% endfor %}
</ol>
<div>
<h2 class='openassessment_add_training_example'>{% trans "Add Scored Response" %}</h2>
</div>
</div>
</div>
</li>
<div id="openassessment_training_example_template" class="is--hidden">
{% include "openassessmentblock/edit/oa_training_example.html" with example=assessments.training.template %}
</div>
{% endspaceless %}
\ No newline at end of file
{% load i18n %}
{% spaceless %}
<li class="openassessment_training_example is-collapsible">
<div class="openassessment_training_example_header view-outline">
<a class="action expand-collapse collapse">
<i class="icon-caret-down ui-toggle-expansion"></i>
</a>
<h6 class="openassessment_training_example_header_title">
{% blocktrans %} Scored Response {% endblocktrans %}
</h6>
<div class="openassessment_training_example_remove">
<h2>{% trans "Remove" %}</h2>
</div>
</div>
<div class="openassessment_training_example_body">
<div class="openassessment_training_example_scored_rubric wrapper-comp-settings">
<h2>{% trans "Scored Rubric" %}</h2>
<ol class="openassessment_training_example_criteria_selections list-input settings-list">
{% for criterion in example.criteria %}
<li class="field comp-setting-entry">
<div class="wrapper-comp-setting">
<label class="openassessment_training_example_criterion_name setting-label">
{{criterion.name}}
<select class="openassessment_training_example_criterion_option setting-input">
<option value="Not Scored">{% trans "Not Scored" %}</option>
{% for option in criterion.options %}
<option value={{option.name}}
{% if criterion.option_selected == option.name %} selected {% endif %}
>
{{option.name}} - {{option.points}} {% trans "points" %}
</option>
{% endfor %}
</select>
</label>
</div>
</li>
{% endfor %}
</ol>
</div>
<div class="openassessment_training_example_essay_wrapper">
<h2>{% trans "Response" %}</h2>
<textarea class="openassessment_training_example_essay">{{example.answer}}</textarea>
</div>
</div>
</li>
{% endspaceless %}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -90,7 +90,8 @@ describe("OpenAssessment edit assessment views", function() {
});
it("Enables and disables", function() { testEnableAndDisable(view); });
it("Loads a description", function() { testLoadXMLExamples(view); });
// This test was deleted because it is obsolete due to Context Changes, but has not yet been
// Replaced by functionality in the JavaScript (which will be tested)
});
describe("OpenAssessment.EditExampleBasedAssessmentView", function() {
......
......@@ -265,7 +265,7 @@
}
.openassessment_assessment_module_settings_editor{
padding: 5px;
padding: 5px 20px 5px 5px;
margin: 10px;
border: 1px solid $edx-gray-l3;
border-radius: 3px;
......@@ -696,6 +696,139 @@
height: 100%;
}
#student_training_settings_editor {
.openassessment_training_example {
.openassessment_training_example_header {
margin: 10px;
padding: 5px;
border-bottom: 1px solid $edx-gray-d3;
overflow: auto;
.action.expand-collapse {
float: left;
.ui-toggle-expansion {
.icon-caret-down:before {
color: $edx-gray-d3;
}
}
}
.openassessment_training_example_header_title {
text-transform: uppercase;
width: 50%;
display: inline-block;
float: left;
}
.openassessment_training_example_remove {
h2:after {
font-family: FontAwesome;
content: "\f00d";
display: inline-block;
color: inherit;
margin: 0 5px;
}
h2 {
text-transform: uppercase;
font-size: 80%;
float: right;
display: inline-block;
}
margin: 0 5px;
float: right;
}
}
.openassessment_training_example_body {
padding: 0 15px;
position: relative;
overflow: hidden;
.openassessment_training_example_essay_wrapper {
width: 58%;
display: inline-block;
position: absolute;
left: 15px;
height: 100%;
textarea {
min-height: 90px;
height: Calc(100% - 35px);
resize: none;
box-sizing: border-box;
border: 1px solid #b2b2b2;
border-radius: 2px;
padding: 6px 8px 8px;
background-color: #f2f2f2;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
font-family: 'Open Sans', sans-serif;
font-size: 11px;
color: #4c4c4c;
outline: 0;
margin: 5px 15px 0 10px;
width: Calc(100% - 25px);
}
}
.openassessment_training_example_scored_rubric {
width: 40%;
display: inline-block;
float: right;
min-height: 150px;
.openassessment_training_example_criteria_selections {
.comp-setting-entry {
.wrapper-comp-setting{
min-width: 100px;
}
margin: 0;
padding: 10px;
label{
width: 100%;
margin-left: 0;
select {
width: 60%;
float: right;
}
}
}
}
}
}
}
.openassessment_add_training_example {
color: #009fe6;
}
.openassessment_add_training_example:before {
font-family: "FontAwesome";
display: inline-block;
margin-left: 5px;
margin-right: 10px;
width: auto;
height: auto;
content: "\f067";
margin-left: 10px;
}
.openassessment_training_example.collapsed {
.openassessment_training_example_body {
display: none;
}
.openassessment_training_example_header {
.action.expand-collapse {
float: left;
.ui-toggle-expansion {
@include transform(rotate(-90deg));
@include transform-origin(50% 50%);
.icon-caret-down:before {
color: #009fe6;
}
}
}
}
}
}
//---------------------------
// Developer Styles for Image Submission
//---------------------------
......
......@@ -77,21 +77,9 @@ class StudioMixin(object):
submission_start, submission_due = date_ranges[0]
assessments = self._assessments_editor_context(date_ranges[1:])
used_assessments = assessments.keys()
used_assessments = set(assessments.keys()) - {'training'}
all_assessments = set(['student_training', 'peer_assessment', 'self_assessment', 'example_based_assessment'])
unused_assessments = all_assessments - set(used_assessments)
student_training_module = self.get_assessment_module('student-training')
if student_training_module:
student_training_module = copy.deepcopy(student_training_module)
try:
examples = xml.serialize_examples_to_xml_str(student_training_module )
student_training_module["examples"] = examples
assessments['training'] = student_training_module
# We do not expect serialization to raise an exception, but if it does,
# handle it gracefully.
except:
logger.exception("An error occurred while serializing the XBlock")
unused_assessments = all_assessments - used_assessments
# Every rubric requires one criterion. If there is no criteria
# configured for the XBlock, return one empty default criterion, with
......@@ -208,4 +196,36 @@ class StudioMixin(object):
assessments[template_name]['start'] = date_range[0]
assessments[template_name]['due'] = date_range[1]
# In addition to the data in the student training assessment, we need to include two additional
# pieces of information: a blank context to render the empty template with, and the criteria
# for each example (so we don't have any complicated logic within the template). Though this
# could be accomplished within the template, we are opting to remove logic from the template.
student_training_module = self.get_assessment_module('student-training')
student_training_template = {'answer': ""}
criteria_list = copy.deepcopy(self.rubric_criteria)
for criterion in criteria_list:
criterion['option_selected'] = ""
student_training_template['criteria'] = criteria_list
if student_training_module:
example_list = []
# Adds each example to a modified version of the student training module dictionary.
for example in student_training_module['examples']:
criteria_list = copy.deepcopy(self.rubric_criteria)
# Equivalent to a Join Query, this adds the selected option to the Criterion's dictionary, so that
# it can be easily referenced in the template without searching through the selected options.
for criterion in criteria_list:
for option_selected in example['options_selected']:
if option_selected['criterion'] == criterion['name']:
criterion['option_selected'] = option_selected['option']
example_list.append({
'answer': example['answer'],
'criteria': criteria_list,
})
assessments['training'] = {'examples': example_list, 'template': student_training_template}
# If we don't have student training enabled, we still need to render a single (empty, or default) example
else:
assessments['training'] = {'examples': [student_training_template], 'template': student_training_template}
return assessments
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