##// END OF EJS Templates
make baseProjectUrl a method in Menubar
Bussonnier Matthias -
Show More
@@ -20,6 +20,10 b' var IPython = (function (IPython) {'
20 }
20 }
21 };
21 };
22
22
23 MenuBar.prototype.baseProjectUrl = function(){
24 return $('body').data('baseProjectUrl');
25 }
26
23
27
24 MenuBar.prototype.style = function () {
28 MenuBar.prototype.style = function () {
25 this.element.addClass('border-box-sizing');
29 this.element.addClass('border-box-sizing');
@@ -37,17 +41,17 b' var IPython = (function (IPython) {'
37 MenuBar.prototype.bind_events = function () {
41 MenuBar.prototype.bind_events = function () {
38 // File
42 // File
39 this.element.find('#new_notebook').click(function () {
43 this.element.find('#new_notebook').click(function () {
40 window.open($('body').data('baseProjectUrl')+'new');
44 window.open(this.baseProjectUrl()+'new');
41 });
45 });
42 this.element.find('#open_notebook').click(function () {
46 this.element.find('#open_notebook').click(function () {
43 window.open($('body').data('baseProjectUrl'));
47 window.open(this.baseProjectUrl());
44 });
48 });
45 this.element.find('#rename_notebook').click(function () {
49 this.element.find('#rename_notebook').click(function () {
46 IPython.save_widget.rename_notebook();
50 IPython.save_widget.rename_notebook();
47 });
51 });
48 this.element.find('#copy_notebook').click(function () {
52 this.element.find('#copy_notebook').click(function () {
49 var notebook_id = IPython.notebook.get_notebook_id();
53 var notebook_id = IPython.notebook.get_notebook_id();
50 var url = $('body').data('baseProjectUrl') + notebook_id + '/copy';
54 var url = this.baseProjectUrl() + notebook_id + '/copy';
51 window.open(url,'_blank');
55 window.open(url,'_blank');
52 return false;
56 return false;
53 });
57 });
@@ -56,13 +60,13 b' var IPython = (function (IPython) {'
56 });
60 });
57 this.element.find('#download_ipynb').click(function () {
61 this.element.find('#download_ipynb').click(function () {
58 var notebook_id = IPython.notebook.get_notebook_id();
62 var notebook_id = IPython.notebook.get_notebook_id();
59 var url = $('body').data('baseProjectUrl') + 'notebooks/' +
63 var url = this.baseProjectUrl() + 'notebooks/' +
60 notebook_id + '?format=json';
64 notebook_id + '?format=json';
61 window.location.assign(url);
65 window.location.assign(url);
62 });
66 });
63 this.element.find('#download_py').click(function () {
67 this.element.find('#download_py').click(function () {
64 var notebook_id = IPython.notebook.get_notebook_id();
68 var notebook_id = IPython.notebook.get_notebook_id();
65 var url = $('body').data('baseProjectUrl') + 'notebooks/' +
69 var url = this.baseProjectUrl() + 'notebooks/' +
66 notebook_id + '?format=py';
70 notebook_id + '?format=py';
67 window.location.assign(url);
71 window.location.assign(url);
68 });
72 });
General Comments 0
You need to be logged in to leave comments. Login now