##// END OF EJS Templates
Further work on the toolbar UI....
Brian Granger -
Show More
@@ -61,6 +61,10 span#notebook_name {
61 61 padding: 3px 15px;
62 62 }
63 63
64 #cell_type {
65 font-size: 85%;
66 }
67
64 68 span#quick_help_area {
65 69 position: static;
66 70 padding: 5px 0px;
@@ -25,9 +25,19 var IPython = (function (IPython) {
25 25 var win = $(window);
26 26 var w = win.width();
27 27 var h = win.height();
28 var header_height = $('div#header').outerHeight(true);
28 var header_height;
29 if ($('div#header').css('display') === 'none') {
30 header_height = 0;
31 } else {
32 header_height = $('div#header').outerHeight(true);
33 }
29 34 var menubar_height = $('div#menubar').outerHeight(true);
30 var toolbar_height = $('div#toolbar').outerHeight(true);
35 var toolbar_height;
36 if ($('div#toolbar').css('display') === 'none') {
37 toolbar_height = 0;
38 } else {
39 toolbar_height = $('div#toolbar').outerHeight(true);
40 }
31 41 var app_height = h-header_height-menubar_height-toolbar_height-2; // content height
32 42
33 43 $('div#main_app').height(app_height + 2); // content+padding+border height
@@ -98,6 +98,14 var IPython = (function (IPython) {
98 98 this.element.find('#select_next').click(function () {
99 99 IPython.notebook.select_next();
100 100 });
101 // View
102 this.element.find('#toggle_header').click(function () {
103 $('div#header').toggle();
104 IPython.layout_manager.do_resize();
105 });
106 this.element.find('#toggle_toolbar').click(function () {
107 IPython.toolbar.toggle();
108 });
101 109 // Insert
102 110 this.element.find('#insert_cell_above').click(function () {
103 111 IPython.notebook.insert_cell_above('code');
@@ -357,7 +357,9 var IPython = (function (IPython) {
357 357 if (sindex !== null && index !== sindex) {
358 358 this.get_cell(sindex).unselect();
359 359 };
360 this.get_cell(index).select();
360 var cell = this.get_cell(index)
361 cell.select();
362 IPython.toolbar.set_cell_type(cell.cell_type);
361 363 };
362 364 return this;
363 365 };
@@ -23,6 +23,7 var IPython = (function (IPython) {
23 23
24 24 ToolBar.prototype.style = function () {
25 25 this.element.addClass('border-box-sizing');
26 this.element.find('#cell_type').addClass('ui-widget ui-widget-content');
26 27 this.element.find('#save_b').button({
27 28 icons : {primary: 'ui-icon-disk'},
28 29 text : false
@@ -71,7 +72,26 var IPython = (function (IPython) {
71 72
72 73
73 74 ToolBar.prototype.bind_events = function () {
75 this.element.find('#cell_type').change(function () {
76 var cell_type = $(this).val();
77 if (cell_type === 'code') {
78 IPython.notebook.to_code();
79 } else if (cell_type === 'markdown') {
80 IPython.notebook.to_markdown();
81 };
82 });
83
84 };
85
86
87 ToolBar.prototype.set_cell_type = function (cell_type) {
88 this.element.find('#cell_type').val(cell_type);
89 };
90
74 91
92 ToolBar.prototype.toggle = function () {
93 this.element.toggle();
94 IPython.layout_manager.do_resize();
75 95 };
76 96
77 97
@@ -99,6 +99,12
99 99 <li id="select_next"><a href="#">Select Next</a></li>
100 100 </ul>
101 101 </li>
102 <li><a href="#">View</a>
103 <ul>
104 <li id="toggle_header"><a href="#">Toggle Header</a></li>
105 <li id="toggle_toolbar"><a href="#">Toggle Toolbar</a></li>
106 </ul>
107 </li>
102 108 <li><a href="#">Insert</a>
103 109 <ul>
104 110 <li id="insert_cell_above"><a href="#">Insert Cell Above</a></li>
General Comments 0
You need to be logged in to leave comments. Login now