Commit 0b8058d8 by Giulio Gratta

Merge pull request #1377 from edx/giulio/ICE-undo

Tweaking ICE undo feature
parents e53c1f5f db802fb5
class @TrackChanges class @TrackChanges
reset_button_sel: '.reset-changes' reset_button_sel: '.reset-changes'
undo_button_sel: '.undo-change' undo_button_sel: '.undo-change'
tracked_elements_sel: 'span.del, span.ins' tracked_changes_sel: '.track-changes span.del, .track-changes span.ins'
tracked_feedback_sel: '.feedback-area.track-changes' tracked_feedback_sel: '.feedback-area.track-changes'
submit_button_sel: '.submit-button' submit_button_sel: '.submit-button'
tracker: null tracker: null
...@@ -11,7 +11,7 @@ class @TrackChanges ...@@ -11,7 +11,7 @@ class @TrackChanges
@reset_button = @$(@reset_button_sel) @reset_button = @$(@reset_button_sel)
@undo_button = @$(@undo_button_sel) @undo_button = @$(@undo_button_sel)
@submit_button = @$(@submit_button_sel) @submit_button = @$(@submit_button_sel)
@tracked_elements = @$(@tracked_elements_sel) @tracked_changes = @$(@tracked_changes_sel)
@tracked_feedback = @$(@tracked_feedback_sel) @tracked_feedback = @$(@tracked_feedback_sel)
@reset_button.click @reset_changes @reset_button.click @reset_changes
...@@ -52,8 +52,9 @@ class @TrackChanges ...@@ -52,8 +52,9 @@ class @TrackChanges
undo_change: (event) => undo_change: (event) =>
event.preventDefault() event.preventDefault()
keyOfLatestChange = 0 keyOfLatestChange = 0
@tracked_elements.each -> @tracked_changes = @$(@tracked_changes_sel)
key = parseInt(@attr('data-cid')) @tracked_changes.each ->
key = $(@).data('cid')
if key > keyOfLatestChange if key > keyOfLatestChange
keyOfLatestChange = key keyOfLatestChange = key
@tracker.rejectChange('[data-cid="'+ keyOfLatestChange + '"]') @tracker.rejectChange('[data-cid="'+ keyOfLatestChange + '"]')
......
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