##// END OF EJS Templates
Kill the layout manager
Jonathan Frederic -
Show More
@@ -4,14 +4,17 b''
4 4 define([
5 5 'base/js/namespace',
6 6 'jquery',
7 ], function(IPython, $){
7 'base/js/events',
8 ], function(IPython, $, events){
8 9 "use strict";
9 10
10 11 var Page = function () {
11 12 this.bind_events();
13 this._resize_header();
12 14 };
13 15
14 16 Page.prototype.bind_events = function () {
17 events.on('resize-header.Page', $.proxy(this._resize_header, this));
15 18 };
16 19
17 20 Page.prototype.show = function () {
@@ -41,6 +44,11 b' define(['
41 44 $('div#site').css('display','block');
42 45 };
43 46
47 Page.prototype._resize_header = function() {
48 // Update the header's size.
49 $('#header-spacer').height($('#header').height());
50 };
51
44 52 // Register self in the global namespace for convenience.
45 53 IPython.Page = Page;
46 54 return {'Page': Page};
@@ -20,11 +20,33 b' body {'
20 20 div#header {
21 21 /* Initially hidden to prevent FLOUC */
22 22 display: none;
23 margin-bottom: 0px;
24 padding-left: 30px;
25 padding-bottom: 5px;
26 border-bottom: 1px solid @navbar-default-border;
27 .border-box-sizing();
23 margin-bottom: -6px;
24 position: fixed;
25 top: 0;
26 width: 100%;
27 background-color: @body-bg;
28 min-height: 31px;
29
30 /* Display over codemirror */
31 z-index: 100;
32
33 #header-container {
34 margin-bottom: 0px;
35 padding-left: 30px;
36 padding-bottom: 5px;
37 .border-box-sizing();
38 }
39
40 .header-bar {
41 width: 100%;
42 height: 0px;
43 border-bottom: 1px solid @navbar-default-border;
44 }
45 }
46
47 #header-spacer {
48 width: 100%;
49 visibility: hidden;
28 50 }
29 51
30 52 #ipython_notebook {
@@ -9,7 +9,6 b' require(['
9 9 'services/config',
10 10 'base/js/utils',
11 11 'base/js/page',
12 'notebook/js/layoutmanager',
13 12 'base/js/events',
14 13 'auth/js/loginwidget',
15 14 'notebook/js/maintoolbar',
@@ -34,7 +33,6 b' require(['
34 33 configmod,
35 34 utils,
36 35 page,
37 layoutmanager,
38 36 events,
39 37 loginwidget,
40 38 maintoolbar,
@@ -66,9 +64,7 b' require(['
66 64
67 65 var user_config = $.extend({}, config.default_config);
68 66 var page = new page.Page();
69 var layout_manager = new layoutmanager.LayoutManager();
70 var pager = new pager.Pager('div#pager', 'div#pager_splitter', {
71 layout_manager: layout_manager,
67 var pager = new pager.Pager('div#pager', {
72 68 events: events});
73 69 var acts = new actions.init();
74 70 var keyboard_manager = new keyboardmanager.KeyboardManager({
@@ -104,7 +100,6 b' require(['
104 100 var menubar = new menubar.MenuBar('#menubar', $.extend({
105 101 notebook: notebook,
106 102 contents: contents,
107 layout_manager: layout_manager,
108 103 events: events,
109 104 save_widget: save_widget,
110 105 quick_help: quick_help},
@@ -132,9 +127,7 b' require(['
132 127
133 128 page.show();
134 129
135 layout_manager.do_resize();
136 130 var first_load = function () {
137 layout_manager.do_resize();
138 131 var hash = document.location.hash;
139 132 if (hash) {
140 133 document.location.hash = '';
@@ -147,7 +140,6 b' require(['
147 140 events.on('notebook_loaded.Notebook', first_load);
148 141
149 142 IPython.page = page;
150 IPython.layout_manager = layout_manager;
151 143 IPython.notebook = notebook;
152 144 IPython.contents = contents;
153 145 IPython.pager = pager;
@@ -24,7 +24,6 b' define(['
24 24 * Dictionary of keyword arguments.
25 25 * notebook: Notebook instance
26 26 * contents: ContentManager instance
27 * layout_manager: LayoutManager instance
28 27 * events: $(Events) instance
29 28 * save_widget: SaveWidget instance
30 29 * quick_help: QuickHelp instance
@@ -37,7 +36,6 b' define(['
37 36 this.selector = selector;
38 37 this.notebook = options.notebook;
39 38 this.contents = options.contents;
40 this.layout_manager = options.layout_manager;
41 39 this.events = options.events;
42 40 this.save_widget = options.save_widget;
43 41 this.quick_help = options.quick_help;
@@ -88,6 +86,13 b' define(['
88 86 }
89 87 };
90 88
89 MenuBar.prototype._size_header = function() {
90 /**
91 * Update header spacer size.
92 */
93 this.events.trigger('resize-header.Page');
94 };
95
91 96 MenuBar.prototype.bind_events = function () {
92 97 /**
93 98 * File
@@ -218,12 +223,12 b' define(['
218 223
219 224 // View
220 225 this.element.find('#toggle_header').click(function () {
221 $('div#header').toggle();
222 that.layout_manager.do_resize();
226 $('div#header-container').toggle();
227 that._size_header();
223 228 });
224 229 this.element.find('#toggle_toolbar').click(function () {
225 230 $('div#maintoolbar').toggle();
226 that.layout_manager.do_resize();
231 that._size_header();
227 232 });
228 233 // Insert
229 234 this.element.find('#insert_cell_above').click(function () {
@@ -8,48 +8,21 b' define(['
8 8 ], function(IPython, $, utils) {
9 9 "use strict";
10 10
11 var Pager = function (pager_selector, pager_splitter_selector, options) {
11 var Pager = function (pager_selector, options) {
12 12 /**
13 13 * Constructor
14 14 *
15 15 * Parameters:
16 16 * pager_selector: string
17 * pager_splitter_selector: string
18 17 * options: dictionary
19 18 * Dictionary of keyword arguments.
20 19 * events: $(Events) instance
21 * layout_manager: LayoutManager instance
22 20 */
23 21 this.events = options.events;
24 22 this.pager_element = $(pager_selector);
25 23 this.pager_button_area = $('#pager_button_area');
26 var that = this;
27 this.percentage_height = 0.40;
28 options.layout_manager.pager = this;
29 this.pager_splitter_element = $(pager_splitter_selector)
30 .draggable({
31 containment: 'window',
32 axis:'y',
33 helper: null ,
34 drag: function(event, ui) {
35 /**
36 * recalculate the amount of space the pager should take
37 */
38 var pheight = ($(document.body).height()-event.clientY-4);
39 var downprct = pheight/options.layout_manager.app_height();
40 downprct = Math.min(0.9, downprct);
41 if (downprct < 0.1) {
42 that.percentage_height = 0.1;
43 that.collapse({'duration':0});
44 } else if (downprct > 0.2) {
45 that.percentage_height = downprct;
46 that.expand({'duration':0});
47 }
48 options.layout_manager.do_resize();
49 }
50 });
24 this.pager_element.resizable({handles: 'n'});
51 25 this.expanded = false;
52 this.style();
53 26 this.create_button_area();
54 27 this.bind_events();
55 28 };
@@ -78,11 +51,6 b' define(['
78 51 );
79 52 };
80 53
81 Pager.prototype.style = function () {
82 this.pager_splitter_element.addClass('ui-widget ui-state-default');
83 this.pager_splitter_element.attr('title', 'Click to Show/Hide pager area, drag to Resize');
84 };
85
86 54
87 55 Pager.prototype.bind_events = function () {
88 56 var that = this;
@@ -103,19 +71,6 b' define(['
103 71 that.pager_element.show(time);
104 72 });
105 73
106 this.pager_splitter_element.hover(
107 function () {
108 that.pager_splitter_element.addClass('ui-state-hover');
109 },
110 function () {
111 that.pager_splitter_element.removeClass('ui-state-hover');
112 }
113 );
114
115 this.pager_splitter_element.click(function () {
116 that.toggle();
117 });
118
119 74 this.events.on('open_with_text.Pager', function (event, payload) {
120 75 // FIXME: support other mime types
121 76 if (payload.data['text/plain'] && payload.data['text/plain'] !== "") {
@@ -1,12 +1,13 b''
1 1 #menubar {
2 2 margin-top: 0px;
3 margin-bottom: -19px;
3 margin-bottom: -24px;
4 4 position: relative;
5 5 .border-box-sizing();
6 6
7 7 .navbar {
8 8 border-top: 1px;
9 9 border-radius: 0px 0px @border-radius-base @border-radius-base;
10 margin-bottom: 23px;
10 11 }
11 12
12 13 .navbar-toggle {
@@ -3,10 +3,6 b' body {'
3 3 background-color: @body-bg;
4 4 }
5 5
6 body.notebook_app {
7 overflow: hidden;
8 }
9
10 6 @media (max-width: 767px) {
11 7 // remove bootstrap-responsive's body padding on small screens
12 8 body.notebook_app {
@@ -36,19 +32,17 b' span#notebook_name {'
36 32 div#notebook_panel {
37 33 margin: 0px 0px 0px 0px;
38 34 padding: 0px;
39 .box-shadow(@notebook-shadow);
40 35 .border-box-sizing();
41 36 }
42 37 div#notebook {
43 38 font-size: @notebook_font_size;
44 39 line-height: @notebook_line_height;
45 overflow-y: scroll;
40 overflow-y: hidden;
46 41 overflow-x: auto;
47 42 width: 100%;
48 43 /* This spaces the cell away from the edge of the notebook area */
49 padding: 1em 0 1em 0;
44 padding: 2em 0 2em 0;
50 45 margin: 0px;
51 border-top: 1px solid @navbar-default-border;
52 46 outline: none;
53 47 .border-box-sizing();
54 48 }
@@ -86,3 +80,14 b' p {'
86 80 .end_space {
87 81 height: 200px;
88 82 }
83
84 .lower-header-bar {
85 width: 100%;
86 height: 0px;
87 border-bottom: 1px solid @navbar-default-border;
88 margin-bottom: -1px;
89 }
90
91 .notebook_app #header {
92 .box-shadow(@notebook-shadow);
93 }
@@ -1,25 +1,31 b''
1 div#pager_splitter {
2 height: 8px;
3 .border-box-sizing();
4 }
5
6 #pager-container {
7 position: relative;
8 padding: 15px 0px;
9 .border-box-sizing();
10 }
11
12 1 div#pager {
2 background-color: @body-bg;
13 3 font-size: @notebook_font_size;
14 4 line-height: @notebook_line_height;
15 5 overflow: auto;
16 6 display: none;
7 position: fixed;
8 bottom: 0px;
9 width: 100%;
10 border-top: 1px solid @navbar-default-border;
11
12 /* Display over codemirror */
13 z-index: 100;
14
15 /* Hack which prevents jquery ui resizable from changing top. */
16 top: inherit !important;
17 17
18 18 pre {
19 line-height: @code_line_height;
20 color: @text-color;
21 background-color: @cell_background;
22 padding: @code_padding;
19 line-height: @code_line_height;
20 color: @text-color;
21 background-color: @cell_background;
22 padding: @code_padding;
23 }
24
25 #pager-container {
26 position: relative;
27 padding: 15px 0px;
28 .border-box-sizing();
23 29 }
24 .border-box-sizing();
30
25 31 }
@@ -2,6 +2,7 b''
2 2 padding: 0px;
3 3 margin-left: -5px;
4 4 margin-top: -5px;
5 margin-bottom: 5px;
5 6
6 7 select, label {
7 8 width: auto;
@@ -33,8 +34,8 b''
33 34 border: 0px;
34 35 min-height: 27px;
35 36 margin-left: 32px;
36 padding-top: 6px;
37 padding-bottom: 8px;
37 padding-top: 11px;
38 padding-bottom: 3px;
38 39
39 40 .navbar-text {
40 41 float: none;
@@ -44,10 +45,6 b''
44 45 margin-right: 0px;
45 46 margin-top: 0px;
46 47 }
47
48 .toolbar {
49 margin-top: 0px;
50 }
51 48 }
52 49
53 50 .select-xs {
@@ -10,7 +10,7 b''
10 10 @notebook_line_height: 20px;
11 11 @code_line_height: 1.21429em; // changed from 1.231 to get 17px even
12 12 @code_padding: 0.4em; // 5.6 px
13 @notebook-shadow: inset 1px 4px 9px -6px rgba(0,0,0,.25);
13 @notebook-shadow: 1px 4px 9px -6px rgba(0,0,0,.25);
14 14 @rendered_html_border_color: black;
15 15 @input_prompt_color: navy;
16 16 @output_prompt_color: darkred;
@@ -7751,14 +7751,32 b' body {'
7751 7751 div#header {
7752 7752 /* Initially hidden to prevent FLOUC */
7753 7753 display: none;
7754 margin-bottom: -6px;
7755 position: fixed;
7756 top: 0;
7757 width: 100%;
7758 background-color: #ffffff;
7759 min-height: 31px;
7760 /* Display over codemirror */
7761 z-index: 100;
7762 }
7763 div#header #header-container {
7754 7764 margin-bottom: 0px;
7755 7765 padding-left: 30px;
7756 7766 padding-bottom: 5px;
7757 border-bottom: 1px solid #e7e7e7;
7758 7767 box-sizing: border-box;
7759 7768 -moz-box-sizing: border-box;
7760 7769 -webkit-box-sizing: border-box;
7761 7770 }
7771 div#header .header-bar {
7772 width: 100%;
7773 height: 0px;
7774 border-bottom: 1px solid #e7e7e7;
7775 }
7776 #header-spacer {
7777 width: 100%;
7778 visibility: hidden;
7779 }
7762 7780 #ipython_notebook {
7763 7781 padding-left: 0px;
7764 7782 }
@@ -9461,9 +9479,6 b' h6:hover .anchor-link {'
9461 9479 body {
9462 9480 background-color: #ffffff;
9463 9481 }
9464 body.notebook_app {
9465 overflow: hidden;
9466 }
9467 9482 @media (max-width: 767px) {
9468 9483 body.notebook_app {
9469 9484 padding-left: 0px;
@@ -9489,8 +9504,6 b' span#notebook_name:hover {'
9489 9504 div#notebook_panel {
9490 9505 margin: 0px 0px 0px 0px;
9491 9506 padding: 0px;
9492 -webkit-box-shadow: inset 1px 4px 9px -6px rgba(0, 0, 0, 0.25);
9493 box-shadow: inset 1px 4px 9px -6px rgba(0, 0, 0, 0.25);
9494 9507 box-sizing: border-box;
9495 9508 -moz-box-sizing: border-box;
9496 9509 -webkit-box-sizing: border-box;
@@ -9498,13 +9511,12 b' div#notebook_panel {'
9498 9511 div#notebook {
9499 9512 font-size: 14px;
9500 9513 line-height: 20px;
9501 overflow-y: scroll;
9514 overflow-y: hidden;
9502 9515 overflow-x: auto;
9503 9516 width: 100%;
9504 9517 /* This spaces the cell away from the edge of the notebook area */
9505 padding: 1em 0 1em 0;
9518 padding: 2em 0 2em 0;
9506 9519 margin: 0px;
9507 border-top: 1px solid #e7e7e7;
9508 9520 outline: none;
9509 9521 box-sizing: border-box;
9510 9522 -moz-box-sizing: border-box;
@@ -9542,6 +9554,16 b' p {'
9542 9554 .end_space {
9543 9555 height: 200px;
9544 9556 }
9557 .lower-header-bar {
9558 width: 100%;
9559 height: 0px;
9560 border-bottom: 1px solid #e7e7e7;
9561 margin-bottom: -1px;
9562 }
9563 .notebook_app #header {
9564 -webkit-box-shadow: 1px 4px 9px -6px rgba(0, 0, 0, 0.25);
9565 box-shadow: 1px 4px 9px -6px rgba(0, 0, 0, 0.25);
9566 }
9545 9567 /* CSS for the cell toolbar */
9546 9568 .celltoolbar {
9547 9569 border: thin solid #CFCFCF;
@@ -9779,7 +9801,7 b' fieldset[disabled] #kernel_selector_widget > button.active {'
9779 9801 }
9780 9802 #menubar {
9781 9803 margin-top: 0px;
9782 margin-bottom: -19px;
9804 margin-bottom: -24px;
9783 9805 position: relative;
9784 9806 box-sizing: border-box;
9785 9807 -moz-box-sizing: border-box;
@@ -9788,6 +9810,7 b' fieldset[disabled] #kernel_selector_widget > button.active {'
9788 9810 #menubar .navbar {
9789 9811 border-top: 1px;
9790 9812 border-radius: 0px 0px 4px 4px;
9813 margin-bottom: 23px;
9791 9814 }
9792 9815 #menubar .navbar-toggle {
9793 9816 float: left;
@@ -10256,27 +10279,20 b' fieldset[disabled] .notification_widget.danger.active {'
10256 10279 color: #d9534f;
10257 10280 background-color: #ffffff;
10258 10281 }
10259 div#pager_splitter {
10260 height: 8px;
10261 box-sizing: border-box;
10262 -moz-box-sizing: border-box;
10263 -webkit-box-sizing: border-box;
10264 }
10265 #pager-container {
10266 position: relative;
10267 padding: 15px 0px;
10268 box-sizing: border-box;
10269 -moz-box-sizing: border-box;
10270 -webkit-box-sizing: border-box;
10271 }
10272 10282 div#pager {
10283 background-color: #ffffff;
10273 10284 font-size: 14px;
10274 10285 line-height: 20px;
10275 10286 overflow: auto;
10276 10287 display: none;
10277 box-sizing: border-box;
10278 -moz-box-sizing: border-box;
10279 -webkit-box-sizing: border-box;
10288 position: fixed;
10289 bottom: 0px;
10290 width: 100%;
10291 border-top: 1px solid #e7e7e7;
10292 /* Display over codemirror */
10293 z-index: 100;
10294 /* Hack which prevents jquery ui resizable from changing top. */
10295 top: inherit !important;
10280 10296 }
10281 10297 div#pager pre {
10282 10298 line-height: 1.21429em;
@@ -10284,6 +10300,13 b' div#pager pre {'
10284 10300 background-color: #f7f7f7;
10285 10301 padding: 0.4em;
10286 10302 }
10303 div#pager #pager-container {
10304 position: relative;
10305 padding: 15px 0px;
10306 box-sizing: border-box;
10307 -moz-box-sizing: border-box;
10308 -webkit-box-sizing: border-box;
10309 }
10287 10310 .quickhelp {
10288 10311 /* Old browsers */
10289 10312 display: -webkit-box;
@@ -10350,6 +10373,7 b' span#autosave_status {'
10350 10373 padding: 0px;
10351 10374 margin-left: -5px;
10352 10375 margin-top: -5px;
10376 margin-bottom: 5px;
10353 10377 box-sizing: border-box;
10354 10378 -moz-box-sizing: border-box;
10355 10379 -webkit-box-sizing: border-box;
@@ -10380,8 +10404,8 b' span#autosave_status {'
10380 10404 border: 0px;
10381 10405 min-height: 27px;
10382 10406 margin-left: 32px;
10383 padding-top: 6px;
10384 padding-bottom: 8px;
10407 padding-top: 11px;
10408 padding-bottom: 3px;
10385 10409 }
10386 10410 #maintoolbar .navbar-text {
10387 10411 float: none;
@@ -10391,9 +10415,6 b' span#autosave_status {'
10391 10415 margin-right: 0px;
10392 10416 margin-top: 0px;
10393 10417 }
10394 #maintoolbar .toolbar {
10395 margin-top: 0px;
10396 }
10397 10418 .select-xs {
10398 10419 height: 24px;
10399 10420 }
@@ -32,7 +32,7 b' class="notebook_app"'
32 32 {% endblock %}
33 33
34 34
35 {% block header %}
35 {% block headercontainer %}
36 36
37 37
38 38 <span id="save_widget" class="nav pull-left">
@@ -50,11 +50,9 b' class="notebook_app"'
50 50 </ul>
51 51 </span>
52 52
53 {% endblock %}
54
55
56 {% block site %}
53 {% endblock headercontainer %}
57 54
55 {% block header %}
58 56 <div id="menubar-container" class="container">
59 57 <div id="menubar">
60 58 <div id="menus" class="navbar navbar-default" role="navigation">
@@ -289,6 +287,7 b' class="notebook_app"'
289 287 </div>
290 288 </div>
291 289 </div>
290
292 291 <div id="maintoolbar" class="navbar">
293 292 <div class="toolbar-inner navbar-inner navbar-nobg">
294 293 <div id="maintoolbar-container" class="container"></div>
@@ -296,19 +295,24 b' class="notebook_app"'
296 295 </div>
297 296 </div>
298 297
299 <div id="ipython-main-app">
298 <div class="lower-header-bar"></div>
299 {% endblock header %}
300 300
301 {% block site %}
302
303
304 <div id="ipython-main-app">
301 305 <div id="notebook_panel">
302 306 <div id="notebook"></div>
303 <div id="pager_splitter"></div>
304 <div id="pager">
305 <div id='pager_button_area'>
306 </div>
307 <div id="pager-container" class="container"></div>
308 </div>
309 307 </div>
308 </div>
310 309
310 <div id="pager">
311 <div id='pager_button_area'>
312 </div>
313 <div id="pager-container" class="container"></div>
311 314 </div>
315
312 316 <div id='tooltip' class='ipython_tooltip' style='display:none'></div>
313 317
314 318
@@ -81,7 +81,7 b''
81 81 </noscript>
82 82
83 83 <div id="header" class="navbar navbar-static-top">
84 <div class="container">
84 <div id="header-container" class="container">
85 85 <div id="ipython_notebook" class="nav navbar-brand pull-left"><a href="{{base_url}}tree" alt='dashboard'>{% block logo %}<img src='{{static_url("base/images/logo.png") }}' alt='Jupyter Notebook'/>{% endblock %}</a></div>
86 86
87 87 {% block login_widget %}
@@ -96,10 +96,15 b''
96 96
97 97 {% endblock %}
98 98
99 {% block header %}
99 {% block headercontainer %}
100 100 {% endblock %}
101 101 </div>
102 <div class="header-bar"></div>
103
104 {% block header %}
105 {% endblock %}
102 106 </div>
107 <div id="header-spacer"></div>
103 108
104 109 <div id="site">
105 110 {% block site %}
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now