Commit 4df122a9 by Calen Pennington

Update annotations modules to use the course_id from the runtime, rather than…

Update annotations modules to use the course_id from the runtime, rather than extracting it from the page
parent 2ce67191
...@@ -81,6 +81,7 @@ class TextAnnotationModule(AnnotatableFields, XModule): ...@@ -81,6 +81,7 @@ class TextAnnotationModule(AnnotatableFields, XModule):
def get_html(self): def get_html(self):
""" Renders parameters to template. """ """ Renders parameters to template. """
context = { context = {
'course_id': self.runtime.course_id,
'display_name': self.display_name_with_default, 'display_name': self.display_name_with_default,
'tag': self.tags, 'tag': self.tags,
'source': self.source, 'source': self.source,
......
...@@ -149,6 +149,7 @@ class VideoAnnotationModule(AnnotatableFields, XModule): ...@@ -149,6 +149,7 @@ class VideoAnnotationModule(AnnotatableFields, XModule):
extension = self._get_extension(self.sourceurl) extension = self._get_extension(self.sourceurl)
context = { context = {
'course_id': self.runtime.course_id,
'display_name': self.display_name_with_default, 'display_name': self.display_name_with_default,
'instructions_html': self.instructions, 'instructions_html': self.instructions,
'sourceUrl': self.sourceurl, 'sourceUrl': self.sourceurl,
......
...@@ -47,13 +47,10 @@ ...@@ -47,13 +47,10 @@
//Grab uri of the course //Grab uri of the course
var parts = window.location.href.split("/"), var parts = window.location.href.split("/"),
uri = '', uri = '',
courseid;
for (var index = 0; index <= 9; index += 1) uri += parts[index]+"/"; //Get the unit url for (var index = 0; index <= 9; index += 1) uri += parts[index]+"/"; //Get the unit url
courseid = parts[4] + "/" + parts[5] + "/" + parts[6];
//Change uri in cms //Change uri in cms
var lms_location = $('.sidebar .preview-button').attr('href'); var lms_location = $('.sidebar .preview-button').attr('href');
if (typeof lms_location!='undefined'){ if (typeof lms_location!='undefined'){
courseid = parts[4].split(".").join("/");
uri = window.location.protocol; uri = window.location.protocol;
for (var index = 0; index <= 9; index += 1) uri += lms_location.split("/")[index]+"/"; //Get the unit url for (var index = 0; index <= 9; index += 1) uri += lms_location.split("/")[index]+"/"; //Get the unit url
} }
...@@ -115,7 +112,7 @@ ...@@ -115,7 +112,7 @@
}, },
}, },
auth: { auth: {
tokenUrl: location.protocol+'//'+location.host+"/token?course_id="+courseid tokenUrl: location.protocol+'//'+location.host+"/token?course_id=${course_id.to_deprecated_string()}"
}, },
store: { store: {
// The endpoint of the store on your server. // The endpoint of the store on your server.
......
...@@ -50,13 +50,10 @@ ...@@ -50,13 +50,10 @@
//Grab uri of the course //Grab uri of the course
var parts = window.location.href.split("/"), var parts = window.location.href.split("/"),
uri = '', uri = '',
courseid;
for (var index = 0; index <= 9; index += 1) uri += parts[index]+"/"; //Get the unit url for (var index = 0; index <= 9; index += 1) uri += parts[index]+"/"; //Get the unit url
courseid = parts[4] + "/" + parts[5] + "/" + parts[6];
//Change uri in cms //Change uri in cms
var lms_location = $('.sidebar .preview-button').attr('href'); var lms_location = $('.sidebar .preview-button').attr('href');
if (typeof lms_location!='undefined'){ if (typeof lms_location!='undefined'){
courseid = parts[4].split(".").join("/");
uri = window.location.protocol; uri = window.location.protocol;
for (var index = 0; index <= 9; index += 1) uri += lms_location.split("/")[index]+"/"; //Get the unit url for (var index = 0; index <= 9; index += 1) uri += lms_location.split("/")[index]+"/"; //Get the unit url
} }
...@@ -119,7 +116,7 @@ ...@@ -119,7 +116,7 @@
}, },
}, },
auth: { auth: {
tokenUrl: location.protocol+'//'+location.host+"/token?course_id="+courseid tokenUrl: location.protocol+'//'+location.host+"/token?course_id=${course_id.to_deprecated_string()}"
}, },
store: { store: {
// The endpoint of the store on your server. // The endpoint of the store on your server.
......
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