Commit 38007354 by Calen Pennington

Merge pull request #478 from MITx/kimth/fix-sequence-modx

Sequential modx/goto_position hits correct multicourse URL
parents bfeadfd6 990857ca
...@@ -3,6 +3,7 @@ class @Sequence ...@@ -3,6 +3,7 @@ class @Sequence
@el = $(element).find('.sequence') @el = $(element).find('.sequence')
@contents = @$('.seq_contents') @contents = @$('.seq_contents')
@id = @el.data('id') @id = @el.data('id')
@modx_url = @el.data('course_modx_root')
@initProgress() @initProgress()
@bind() @bind()
@render parseInt(@el.data('position')) @render parseInt(@el.data('position'))
...@@ -76,13 +77,14 @@ class @Sequence ...@@ -76,13 +77,14 @@ class @Sequence
if @position != new_position if @position != new_position
if @position != undefined if @position != undefined
@mark_visited @position @mark_visited @position
$.postWithPrefix "/modx/#{@id}/goto_position", position: new_position modx_full_url = @modx_url + '/' + @id + '/goto_position'
$.postWithPrefix modx_full_url, position: new_position
@mark_active new_position @mark_active new_position
@$('#seq_content').html @contents.eq(new_position - 1).text() @$('#seq_content').html @contents.eq(new_position - 1).text()
XModule.loadModules('display', @$('#seq_content')) XModule.loadModules('display', @$('#seq_content'))
MathJax.Hub.Queue(["Typeset", MathJax.Hub]) MathJax.Hub.Queue(["Typeset", MathJax.Hub, "seq_content"]) # NOTE: Actually redundant. Some other MathJax call also being performed
@position = new_position @position = new_position
@toggleArrows() @toggleArrows()
@hookUpProgressEvent() @hookUpProgressEvent()
...@@ -91,7 +93,7 @@ class @Sequence ...@@ -91,7 +93,7 @@ class @Sequence
event.preventDefault() event.preventDefault()
new_position = $(event.target).data('element') new_position = $(event.target).data('element')
Logger.log "seq_goto", old: @position, new: new_position, id: @id Logger.log "seq_goto", old: @position, new: new_position, id: @id
# On Sequence chage, destroy any existing polling thread # On Sequence chage, destroy any existing polling thread
# for queued submissions, see ../capa/display.coffee # for queued submissions, see ../capa/display.coffee
if window.queuePollerID if window.queuePollerID
......
<div id="sequence_${element_id}" class="sequence" data-id="${item_id}" data-position="${position}" > <div id="sequence_${element_id}" class="sequence" data-id="${item_id}" data-position="${position}" data-course_modx_root="/course/modx" >
<nav aria-label="Section Navigation" class="sequence-nav"> <nav aria-label="Section Navigation" class="sequence-nav">
<ol id="sequence-list"> <ol id="sequence-list">
% for idx, item in enumerate(items): % for idx, item in enumerate(items):
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
</nav> </nav>
% for item in items: % for item in items:
<div class="seq_contents">${item['content'] | h}</div> <div class="seq_contents tex2jax_ignore">${item['content'] | h}</div>
% endfor % endfor
<div id="seq_content"></div> <div id="seq_content"></div>
......
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