Commit 9280f89f by Giulio Gratta

Merge pull request #2157 from edx/giulio/remove-ice

Removed ice.min.js completely as ORA is changing anyway
parents 9dbd4c5b 31caba3a
......@@ -251,14 +251,6 @@ class CombinedOpenEndedFields(object):
default=False,
scope=Scope.settings
)
track_changes = Boolean(
display_name="Peer Track Changes",
help=("EXPERIMENTAL FEATURE FOR PEER GRADING ONLY: "
"If set to 'True', peer graders will be able to make changes to the student "
"submission and those changes will be tracked and shown along with the graded feedback."),
default=False,
scope=Scope.settings
)
due = Date(
help="Date that this problem is due by",
scope=Scope.settings
......@@ -517,7 +509,7 @@ class CombinedOpenEndedDescriptor(CombinedOpenEndedFields, RawDescriptor):
def non_editable_metadata_fields(self):
non_editable_fields = super(CombinedOpenEndedDescriptor, self).non_editable_metadata_fields
non_editable_fields.extend([CombinedOpenEndedDescriptor.due, CombinedOpenEndedDescriptor.graceperiod,
CombinedOpenEndedDescriptor.markdown, CombinedOpenEndedDescriptor.version, CombinedOpenEndedDescriptor.track_changes])
CombinedOpenEndedDescriptor.markdown, CombinedOpenEndedDescriptor.version])
return non_editable_fields
# Proxy to CombinedOpenEndedModule so that external callers don't have to know if they're working
......
class @TrackChanges
reset_button_sel: '.reset-changes'
undo_button_sel: '.undo-change'
tracked_changes_sel: '.track-changes span.del, .track-changes span.ins'
tracked_feedback_sel: '.feedback-area.track-changes'
submit_button_sel: '.submit-button'
tracker: null
constructor: (element) ->
@el = element
@reset_button = @$(@reset_button_sel)
@undo_button = @$(@undo_button_sel)
@submit_button = @$(@submit_button_sel)
@tracked_changes = @$(@tracked_changes_sel)
@tracked_feedback = @$(@tracked_feedback_sel)
@reset_button.click @reset_changes
@undo_button.click @undo_change
@submit_button.click @stop_tracking_on_submit
rebindTracker: () =>
if @tracker?
@tracker.stopTracking()
delete @tracker
@tracker = new ice.InlineChangeEditor({
element: @tracked_feedback[0], #return DOM element from selector
handleEvents: true,
currentUser: { id: 1, name: 'Peer Feedback' }, #hardcoded current user
# optional plugins
plugins: [
# Track content that is cut and pasted
{
name: 'IceCopyPastePlugin',
settings: {
# List of tags and attributes to preserve when cleaning a paste
preserve: 'p,a[href],span[id,class],em,strong'
}
}
]
})
@tracker.startTracking()
# locally scoped jquery. (scoped to the element)
$: (selector) ->
$(selector, @el)
reset_changes: (event) =>
event.preventDefault()
if confirm "Are you sure you want to reset your changes?"
@tracker.rejectAll()
undo_change: (event) =>
event.preventDefault()
keyOfLatestChange = 0
@tracked_changes = @$(@tracked_changes_sel)
@tracked_changes.each ->
key = $(@).data('cid')
if key > keyOfLatestChange
keyOfLatestChange = key
@tracker.rejectChange('[data-cid="'+ keyOfLatestChange + '"]')
stop_tracking_on_submit: () =>
@tracker.stopTracking()
\ No newline at end of file
......@@ -96,13 +96,9 @@ class PeerGradingModule(PeerGradingFields, XModule):
_VERSION = 1
js = {
'js': [
resource_string(__name__, 'js/src/peergrading/ice.min.js'),
],
'coffee': [
resource_string(__name__, 'js/src/peergrading/peer_grading.coffee'),
resource_string(__name__, 'js/src/peergrading/peer_grading_problem.coffee'),
resource_string(__name__, 'js/src/peergrading/track_changes.coffee'),
resource_string(__name__, 'js/src/collapsible.coffee'),
resource_string(__name__, 'js/src/javascript_loader.coffee'),
]
......@@ -624,7 +620,6 @@ class PeerGradingModule(PeerGradingFields, XModule):
'ajax_url': ajax_url,
# Checked above
'staff_access': False,
'track_changes': getattr(module, 'track_changes', False),
'use_single_location': self.use_for_single_location_local,
})
......
......@@ -382,38 +382,3 @@ class PeerGradingModuleLinkedTest(unittest.TestCase, DummyModulestore):
data = peer_grading.handle_ajax('get_next_submission', {'location': self.coe_location})
self.assertEqual(json.loads(data)['submission_id'], 1)
class PeerGradingModuleTrackChangesTest(unittest.TestCase, DummyModulestore):
"""
Test peer grading with the track changes modification
"""
class MockedTrackChangesProblem(object):
track_changes = True
mock_track_changes_problem = Mock(side_effect=[MockedTrackChangesProblem()])
pgm_location = Location(["i4x", "edX", "open_ended", "peergrading", "PeerGradingSample"])
def get_module_system(self, descriptor):
test_system = get_test_system()
test_system.open_ended_grading_interface = None
return test_system
def setUp(self):
"""
Create a peer grading module from a test system
@return:
"""
self.setup_modulestore(COURSE)
self.peer_grading = self.get_module_from_location(self.pgm_location, COURSE)
def test_tracking_peer_eval_problem(self):
"""
Tests rendering of peer eval problem with track changes set. With the test_system render_template
this test becomes a bit tautological, but oh well.
@return:
"""
self.peer_grading._find_corresponding_module_for_location = self.mock_track_changes_problem
response = self.peer_grading.peer_grading_problem({'location': 'i4x://mock_org/mock_course/mock_cat/mock_name'})
self.assertTrue(response['success'])
self.assertIn("'track_changes': True", response['html'])
......@@ -26,7 +26,7 @@
</section>
</div>
</div>
<section class="grading-wrapper" data-track-changes="${'true' if track_changes else 'false'}">
<section class="grading-wrapper">
<div class="grading-message">
</div>
<h2>${_("Student Response")}</h2>
......@@ -48,22 +48,8 @@
</div>
<br />
<h3>${_("Written Feedback")}</h3>
% if track_changes:
<p class="peer-grading-instructions">${_("Please edit your peer's submission and give them written comments below.")}</p>
<p class="ice-legend">
<span class="ins">${_("This is an insertion.")}</span>&nbsp;
<span class="del">${_("This is a deletion.")}</span>&nbsp;
<span class="ins">${_("[This is a comment.]")}</span>&nbsp;
<span class="ice-controls">
<a href="#" class="undo-change"><i class="icon-undo"></i> Undo Change</a>&nbsp;&nbsp;
<a href="#" class="reset-changes"><i class="icon-refresh"></i> Reset Changes</a>
</span>
</p>
<div name="feedback" class="feedback-area track-changes" contenteditable="true"></div>
% else:
<p class="ora-instructions">${_("Please include some written feedback as well.")}</p>
<textarea name="feedback" placeholder="Feedback for student" class="feedback-area" cols="70" ></textarea>
% endif
<p class="ora-instructions">${_("Please include some written feedback as well.")}</p>
<textarea name="feedback" placeholder="Feedback for student" class="feedback-area" cols="70" ></textarea>
<div class="flag-student-container">
<br />
<input type="checkbox" class="flag-checkbox" value="student_is_flagged">
......
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