make baseProjectUrl a method in Menubar

pull/37/head
Bussonnier Matthias 13 years ago
parent da5e3f5121
commit 7a300d7ff3

@ -20,6 +20,10 @@ var IPython = (function (IPython) {
}
};
MenuBar.prototype.baseProjectUrl = function(){
return $('body').data('baseProjectUrl');
}
MenuBar.prototype.style = function () {
this.element.addClass('border-box-sizing');
@ -37,17 +41,17 @@ var IPython = (function (IPython) {
MenuBar.prototype.bind_events = function () {
// File
this.element.find('#new_notebook').click(function () {
window.open($('body').data('baseProjectUrl')+'new');
window.open(this.baseProjectUrl()+'new');
});
this.element.find('#open_notebook').click(function () {
window.open($('body').data('baseProjectUrl'));
window.open(this.baseProjectUrl());
});
this.element.find('#rename_notebook').click(function () {
IPython.save_widget.rename_notebook();
});
this.element.find('#copy_notebook').click(function () {
var notebook_id = IPython.notebook.get_notebook_id();
var url = $('body').data('baseProjectUrl') + notebook_id + '/copy';
var url = this.baseProjectUrl() + notebook_id + '/copy';
window.open(url,'_blank');
return false;
});
@ -56,13 +60,13 @@ var IPython = (function (IPython) {
});
this.element.find('#download_ipynb').click(function () {
var notebook_id = IPython.notebook.get_notebook_id();
var url = $('body').data('baseProjectUrl') + 'notebooks/' +
var url = this.baseProjectUrl() + 'notebooks/' +
notebook_id + '?format=json';
window.location.assign(url);
});
this.element.find('#download_py').click(function () {
var notebook_id = IPython.notebook.get_notebook_id();
var url = $('body').data('baseProjectUrl') + 'notebooks/' +
var url = this.baseProjectUrl() + 'notebooks/' +
notebook_id + '?format=py';
window.location.assign(url);
});

Loading…
Cancel
Save