Commit 0dfc8fe6 by gradyward

Merge branch 'authoring' of https://github.com/edx/edx-ora2 into grady/fix-option-deletion-wrapper

Conflicts:
	openassessment/xblock/static/css/openassessment.css
	openassessment/xblock/static/js/openassessment-lms.min.js
parents 0c1cee0d dfb87ab4
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div class="openassessment_criterion_header view-outline"> <div class="openassessment_criterion_header view-outline">
<a class="action expand-collapse collapse"><i class="icon-caret-down ui-toggle-expansion"></i></a> <a class="action expand-collapse collapse"><i class="icon-caret-down ui-toggle-expansion"></i></a>
<h6 class="openassessment_criterion_header_title">{% trans "Criterion" %}</h6> <h6 class="openassessment_criterion_header_title">{% trans "Criterion" %}</h6>
<div class="openassessment_rubric_remove_button"><h2>{% trans "Remove" %}</h2></div> <div class="openassessment_criterion_remove_button"><h2>{% trans "Remove" %}</h2></div>
</div> </div>
<div class="openassessment_criterion_body wrapper-comp-settings"> <div class="openassessment_criterion_body wrapper-comp-settings">
<ul class="list-input settings-list openassessment_criterion_basic_editor"> <ul class="list-input settings-list openassessment_criterion_basic_editor">
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<li class="openassessment_criterion_option"> <li class="openassessment_criterion_option">
<div class="openassessment_option_header"> <div class="openassessment_option_header">
<span class="openassessment_option_header_title">{% trans "Option" %}</span> <span class="openassessment_option_header_title">{% trans "Option" %}</span>
<div class="openassessment_rubric_remove_button"> <div class="openassessment_criterion_option_remove_button">
<h2>{% trans "Remove" %}</h2> <h2>{% trans "Remove" %}</h2>
</div> </div>
</div> </div>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -10,11 +10,19 @@ For example, to create a container for an item called "test_item", ...@@ -10,11 +10,19 @@ For example, to create a container for an item called "test_item",
the DOM should look something like: the DOM should look something like:
<div id="test_container" /> <div id="test_container" />
<div id="test_item_template"> <div id="test_item_template">
<div class="test_item_remove_button">Remove</div> <div class="test_item">
<p>This is the default value for the item.</p> <div class="test_item_remove_button">Remove</div>
<p>This is the default value for the item.</p>
</div>
</div> </div>
<div id="test_item_add_button">Add</div> <div id="test_item_add_button">Add</div>
A critical property of this setup is that the element you want to
include/duplicate is wrapped inside of a template element which is
the one that your reference when referring to a template. In the
above example, $("#test_item_template") would be the appropriate
reference to the template.
You can then initialize the container: You can then initialize the container:
>>> var container = $("#test_container").get(0); >>> var container = $("#test_container").get(0);
>>> var template = $("#test_item_template").get(0); >>> var template = $("#test_item_template").get(0);
...@@ -82,6 +90,8 @@ OpenAssessment.Container.prototype = { ...@@ -82,6 +90,8 @@ OpenAssessment.Container.prototype = {
// Copy the template into the container // Copy the template into the container
// Remove any CSS IDs (since now the element is not unique) // Remove any CSS IDs (since now the element is not unique)
// and add the item class so we can find it later. // and add the item class so we can find it later.
// Note that the element we add is the first child of the template element.
// For more on the template structure expected, see the class comment
$(this.templateElement) $(this.templateElement)
.children().first() .children().first()
.clone() .clone()
...@@ -94,7 +104,7 @@ OpenAssessment.Container.prototype = { ...@@ -94,7 +104,7 @@ OpenAssessment.Container.prototype = {
// Since we just added the new element to the container, // Since we just added the new element to the container,
// it should be the last one. // it should be the last one.
var container = this; var container = this;
var containerItem = $("." + this.containerItemClass, this.containerElement).last() var containerItem = $("." + this.containerItemClass, this.containerElement).last();
containerItem.find('.' + this.removeButtonClass) containerItem.find('.' + this.removeButtonClass)
.click(function(eventData) { container.remove(eventData.target); } ); .click(function(eventData) { container.remove(eventData.target); } );
......
...@@ -57,7 +57,7 @@ OpenAssessment.RubricCriterion = function(element) { ...@@ -57,7 +57,7 @@ OpenAssessment.RubricCriterion = function(element) {
containerElement: $(".openassessment_criterion_option_list", this.element).get(0), containerElement: $(".openassessment_criterion_option_list", this.element).get(0),
templateElement: $("#openassessment_option_template").get(0), templateElement: $("#openassessment_option_template").get(0),
addButtonElement: $(".openassessment_criterion_add_option", this.element).get(0), addButtonElement: $(".openassessment_criterion_add_option", this.element).get(0),
removeButtonClass: "openassessment_rubric_remove_button", removeButtonClass: "openassessment_criterion_option_remove_button",
containerItemClass: "openassessment_criterion_option", containerItemClass: "openassessment_criterion_option",
} }
); );
......
...@@ -8,7 +8,7 @@ OpenAssessment.EditRubricView = function(element) { ...@@ -8,7 +8,7 @@ OpenAssessment.EditRubricView = function(element) {
containerElement: $("#openassessment_criterion_list", this.element).get(0), containerElement: $("#openassessment_criterion_list", this.element).get(0),
templateElement: $("#openassessment_criterion_template", this.element).get(0), templateElement: $("#openassessment_criterion_template", this.element).get(0),
addButtonElement: $("#openassessment_rubric_add_criterion", this.element).get(0), addButtonElement: $("#openassessment_rubric_add_criterion", this.element).get(0),
removeButtonClass: "openassessment_rubric_remove_button", removeButtonClass: "openassessment_criterion_remove_button",
containerItemClass: "openassessment_criterion", containerItemClass: "openassessment_criterion",
} }
); );
......
...@@ -390,6 +390,10 @@ ...@@ -390,6 +390,10 @@
.openassessment_criterion { .openassessment_criterion {
padding-bottom: 10px; padding-bottom: 10px;
.openassessment_criterion_remove_button{
@extend .openassessment_rubric_remove_button;
}
.openassessment_criterion_header { .openassessment_criterion_header {
margin: 10px; margin: 10px;
padding: 5px; padding: 5px;
...@@ -501,6 +505,10 @@ ...@@ -501,6 +505,10 @@
.openassessment_criterion_option{ .openassessment_criterion_option{
padding: 5px; padding: 5px;
.openassessment_criterion_option_remove_button{
@extend .openassessment_rubric_remove_button;
}
.openassessment_option_header{ .openassessment_option_header{
background-color: $edx-gray-l2; background-color: $edx-gray-l2;
padding: 5px 5px 5px 10px; padding: 5px 5px 5px 10px;
......
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