Commit ac8eeb68 by Calen Pennington

Make sequence module use ajax_url properly

parent ae32abfd
...@@ -4,7 +4,7 @@ class @Sequence ...@@ -4,7 +4,7 @@ class @Sequence
@contents = @$('.seq_contents') @contents = @$('.seq_contents')
@num_contents = @contents.length @num_contents = @contents.length
@id = @el.data('id') @id = @el.data('id')
@modx_url = @el.data('course_modx_root') @ajaxUrl = @el.data('ajax-url')
@initProgress() @initProgress()
@bind() @bind()
@render parseInt(@el.data('position')) @render parseInt(@el.data('position'))
...@@ -84,7 +84,7 @@ class @Sequence ...@@ -84,7 +84,7 @@ class @Sequence
if @position != new_position if @position != new_position
if @position != undefined if @position != undefined
@mark_visited @position @mark_visited @position
modx_full_url = @modx_url + '/' + @id + '/goto_position' modx_full_url = '#{@ajaxUrl}/goto_position'
$.postWithPrefix modx_full_url, position: new_position $.postWithPrefix modx_full_url, position: new_position
# On Sequence change, fire custom event "sequence:change" on element. # On Sequence change, fire custom event "sequence:change" on element.
......
...@@ -98,6 +98,7 @@ class SequenceModule(SequenceFields, XModule): ...@@ -98,6 +98,7 @@ class SequenceModule(SequenceFields, XModule):
'item_id': self.id, 'item_id': self.id,
'position': self.position, 'position': self.position,
'tag': self.location.category, 'tag': self.location.category,
'ajax_url': self.system.ajax_url,
} }
fragment.add_content(self.system.render_template('seq_module.html', params)) fragment.add_content(self.system.render_template('seq_module.html', params))
......
<%! from django.utils.translation import ugettext as _ %> <%! from django.utils.translation import ugettext as _ %>
<div id="sequence_${element_id}" class="sequence" data-id="${item_id}" data-position="${position}" data-course_modx_root="/course/modx" > <div id="sequence_${element_id}" class="sequence" data-id="${item_id}" data-position="${position}" data-ajax-url="${ajax_url}" >
<nav aria-label="${_('Section Navigation')}" class="sequence-nav"> <nav aria-label="${_('Section Navigation')}" class="sequence-nav">
<ul class="sequence-nav-buttons"> <ul class="sequence-nav-buttons">
<li class="prev"><a href="#">${_('Previous')}</a></li> <li class="prev"><a href="#">${_('Previous')}</a></li>
......
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