Permalink
Browse files

Updating JS URL scheme to use embedded data.

All ajax requests from JS now use the data-base-project-url
and data-base-kernel-url data attributes set on the body.
  • Loading branch information...
1 parent a676e3d commit e45f7061a508daebcd63695b538ee72b0f4215a5 @ellisonbg ellisonbg committed with Sep 7, 2011
@@ -15,12 +15,10 @@ var IPython = (function (IPython) {
var Kernel = function () {
this.kernel_id = null;
- this.base_url = "/kernels";
- this.kernel_url = null;
this.shell_channel = null;
this.iopub_channel = null;
+ this.base_url = $('body').data('baseKernelUrl') + "kernels";
this.running = false;
-
this.username = "username";
this.session_id = utils.uuid();
@@ -52,7 +50,8 @@ var IPython = (function (IPython) {
var that = this;
if (!this.running) {
var qs = $.param({notebook:notebook_id});
- $.post(this.base_url + '?' + qs,
+ var url = this.base_url + '?' + qs
+ $.post(url,
function (kernel_id) {
that._handle_start_kernel(kernel_id, callback);
},
@@ -929,7 +929,8 @@ var IPython = (function (IPython) {
error : $.proxy(this.notebook_save_failed,this)
};
IPython.save_widget.status_saving();
- $.ajax("/notebooks/" + notebook_id, settings);
+ var url = $('body').data('baseProjectUrl') + 'notebooks/' + notebook_id
+ $.ajax(url, settings);
};
};
@@ -966,7 +967,8 @@ var IPython = (function (IPython) {
}
};
IPython.save_widget.status_loading();
- $.ajax("/notebooks/" + notebook_id, settings);
+ var url = $('body').data('baseProjectUrl') + 'notebooks/' + notebook_id
+ $.ajax(url, settings);
}
@@ -67,7 +67,8 @@ var IPython = (function (IPython) {
dataType : "json",
success : $.proxy(this.list_loaded, this)
};
- $.ajax("/notebooks", settings);
+ var url = $('body').data('baseProjectUrl') + 'notebooks'
+ $.ajax(url, settings);
};
@@ -170,7 +171,8 @@ var IPython = (function (IPython) {
parent_item.remove();
}
};
- $.ajax("/notebooks/" + notebook_id, settings);
+ var url = $('body').data('baseProjectUrl') + 'notebooks/' + notebook_id
+ $.ajax(url, settings);
$(this).dialog('close');
},
"Cancel": function () {
@@ -217,7 +219,8 @@ var IPython = (function (IPython) {
};
var qs = $.param({name:nbname, format:nbformat});
- $.ajax('/notebooks?' + qs, settings);
+ var url = $('body').data('baseProjectUrl') + 'notebooks?' + qs
+ $.ajax(url, settings);
});
var cancel_button = $('<button>Cancel</button>').button().
click(function (e) {

0 comments on commit e45f706

Please sign in to comment.