##// END OF EJS Templates
make global css change on command/edit mode
Bussonnier Matthias -
Show More
@@ -126,11 +126,6 b' define(['
126 } else {
126 } else {
127 this.element.addClass('unrendered');
127 this.element.addClass('unrendered');
128 }
128 }
129 if (this.mode === 'edit') {
130 this.element.addClass('edit_mode');
131 } else {
132 this.element.addClass('command_mode');
133 }
134 };
129 };
135
130
136 /**
131 /**
@@ -345,8 +340,6 b' define(['
345 */
340 */
346 Cell.prototype.command_mode = function () {
341 Cell.prototype.command_mode = function () {
347 if (this.mode !== 'command') {
342 if (this.mode !== 'command') {
348 this.element.addClass('command_mode');
349 this.element.removeClass('edit_mode');
350 this.mode = 'command';
343 this.mode = 'command';
351 return true;
344 return true;
352 } else {
345 } else {
@@ -361,8 +354,6 b' define(['
361 */
354 */
362 Cell.prototype.edit_mode = function () {
355 Cell.prototype.edit_mode = function () {
363 if (this.mode !== 'edit') {
356 if (this.mode !== 'edit') {
364 this.element.addClass('edit_mode');
365 this.element.removeClass('command_mode');
366 this.mode = 'edit';
357 this.mode = 'edit';
367 return true;
358 return true;
368 } else {
359 } else {
@@ -37,21 +37,27 b' define(['
37 var that = this;
37 var that = this;
38 var knw = this.new_notification_widget('kernel');
38 var knw = this.new_notification_widget('kernel');
39 var $kernel_ind_icon = $("#kernel_indicator_icon");
39 var $kernel_ind_icon = $("#kernel_indicator_icon");
40 var $modal_ind_icon = $("#modal_indicator_icon");
40 var $modal_ind_icon = $("#modal_indicator");
41 var $body = $('body')
41
42
42 // Command/Edit mode
43 // Command/Edit mode
43 this.events.on('edit_mode.Notebook', function () {
44 this.events.on('edit_mode.Notebook', function () {
44 that.save_widget.update_document_title();
45 that.save_widget.update_document_title();
45 $modal_ind_icon.attr('class','edit_mode_icon').attr('title','Edit Mode');
46 $body.addClass('edit_mode');
47 $body.removeClass('command_mode');
48 $modal_ind_icon.attr('title','Edit Mode');
46 });
49 });
47
50
48 this.events.on('command_mode.Notebook', function () {
51 this.events.on('command_mode.Notebook', function () {
49 that.save_widget.update_document_title();
52 that.save_widget.update_document_title();
50 $modal_ind_icon.attr('class','command_mode_icon').attr('title','Command Mode');
53 $body.removeClass('edit_mode');
54 $body.addClass('command_mode');
55 $modal_ind_icon.attr('title','Command Mode');
51 });
56 });
52
57
53 // Implicitly start off in Command mode, switching to Edit mode will trigger event
58 // Implicitly start off in Command mode, switching to Edit mode will trigger event
54 $modal_ind_icon.attr('class','command_mode_icon').attr('title','Command Mode');
59 $modal_ind_icon.addClass('modal_indicator').attr('title','Command Mode');
60 $body.addClass('command_mode')
55
61
56 // Kernel events
62 // Kernel events
57
63
@@ -14,7 +14,7 b' div.cell {'
14 }
14 }
15 }
15 }
16
16
17 &.edit_mode {
17 .edit_mode &.selected {
18 border-color: green;
18 border-color: green;
19 /* Don't border the cells when printing */
19 /* Don't border the cells when printing */
20 @media print {
20 @media print {
@@ -29,11 +29,11 b''
29 .indicator_area();
29 .indicator_area();
30 }
30 }
31
31
32 .edit_mode_icon:before {
32 .edit_mode .modal_indicator:before {
33 .icon(@fa-var-pencil)
33 .icon(@fa-var-pencil)
34 }
34 }
35
35
36 .command_mode_icon:before {
36 .command_mode .modal_indicator:before {
37 .icon(' ');
37 .icon(' ');
38 }
38 }
39
39
@@ -370,12 +370,12 b' div.cell.selected {'
370 border-color: transparent;
370 border-color: transparent;
371 }
371 }
372 }
372 }
373 div.cell.edit_mode {
373 .edit_mode div.cell.selected {
374 border-color: green;
374 border-color: green;
375 /* Don't border the cells when printing */
375 /* Don't border the cells when printing */
376 }
376 }
377 @media print {
377 @media print {
378 div.cell.edit_mode {
378 .edit_mode div.cell.selected {
379 border-color: transparent;
379 border-color: transparent;
380 }
380 }
381 }
381 }
@@ -8240,12 +8240,12 b' div.cell.selected {'
8240 border-color: transparent;
8240 border-color: transparent;
8241 }
8241 }
8242 }
8242 }
8243 div.cell.edit_mode {
8243 .edit_mode div.cell.selected {
8244 border-color: green;
8244 border-color: green;
8245 /* Don't border the cells when printing */
8245 /* Don't border the cells when printing */
8246 }
8246 }
8247 @media print {
8247 @media print {
8248 div.cell.edit_mode {
8248 .edit_mode div.cell.selected {
8249 border-color: transparent;
8249 border-color: transparent;
8250 }
8250 }
8251 }
8251 }
@@ -9793,7 +9793,7 b' ul#help_menu li a i {'
9793 z-index: 10;
9793 z-index: 10;
9794 text-align: center;
9794 text-align: center;
9795 }
9795 }
9796 .edit_mode_icon:before {
9796 .edit_mode .modal_indicator:before {
9797 display: inline-block;
9797 display: inline-block;
9798 font: normal normal normal 14px/1 FontAwesome;
9798 font: normal normal normal 14px/1 FontAwesome;
9799 font-size: inherit;
9799 font-size: inherit;
@@ -9802,13 +9802,13 b' ul#help_menu li a i {'
9802 -moz-osx-font-smoothing: grayscale;
9802 -moz-osx-font-smoothing: grayscale;
9803 content: "\f040";
9803 content: "\f040";
9804 }
9804 }
9805 .edit_mode_icon:before.pull-left {
9805 .edit_mode .modal_indicator:before.pull-left {
9806 margin-right: .3em;
9806 margin-right: .3em;
9807 }
9807 }
9808 .edit_mode_icon:before.pull-right {
9808 .edit_mode .modal_indicator:before.pull-right {
9809 margin-left: .3em;
9809 margin-left: .3em;
9810 }
9810 }
9811 .command_mode_icon:before {
9811 .command_mode .modal_indicator:before {
9812 display: inline-block;
9812 display: inline-block;
9813 font: normal normal normal 14px/1 FontAwesome;
9813 font: normal normal normal 14px/1 FontAwesome;
9814 font-size: inherit;
9814 font-size: inherit;
@@ -9817,10 +9817,10 b' ul#help_menu li a i {'
9817 -moz-osx-font-smoothing: grayscale;
9817 -moz-osx-font-smoothing: grayscale;
9818 content: ' ';
9818 content: ' ';
9819 }
9819 }
9820 .command_mode_icon:before.pull-left {
9820 .command_mode .modal_indicator:before.pull-left {
9821 margin-right: .3em;
9821 margin-right: .3em;
9822 }
9822 }
9823 .command_mode_icon:before.pull-right {
9823 .command_mode .modal_indicator:before.pull-right {
9824 margin-left: .3em;
9824 margin-left: .3em;
9825 }
9825 }
9826 .kernel_idle_icon:before {
9826 .kernel_idle_icon:before {
@@ -61,9 +61,7 b' class="notebook_app"'
61 <span class="kernel_indicator_name">Kernel</span>
61 <span class="kernel_indicator_name">Kernel</span>
62 <i id="kernel_indicator_icon"></i>
62 <i id="kernel_indicator_icon"></i>
63 </p>
63 </p>
64 <p id="modal_indicator" class="navbar-text">
64 <i id="modal_indicator" class="navbar-text"></i>
65 <i id="modal_indicator_icon"></i>
66 </p>
67 <span id="notification_area"></span>
65 <span id="notification_area"></span>
68 <div class="navbar-collapse collapse">
66 <div class="navbar-collapse collapse">
69 <ul class="nav navbar-nav">
67 <ul class="nav navbar-nav">
@@ -505,7 +505,19 b' casper.is_only_cell_selected = function(index) {'
505 casper.is_only_cell_edit = function(index) {
505 casper.is_only_cell_edit = function(index) {
506 // Check if a cell is the only cell in edit mode.
506 // Check if a cell is the only cell in edit mode.
507 // Pass null as the index to check if all of the cells are in command mode.
507 // Pass null as the index to check if all of the cells are in command mode.
508 return this.is_only_cell_on(index, 'edit_mode', 'command_mode');
508 var cells_length = this.get_cells_length();
509 for (var j = 0; j < cells_length; j++) {
510 if (j === i) {
511 if (!this.cell_mode_is('edit')) {
512 return false;
513 }
514 } else {
515 if (this.cell_mode_is('edit')) {
516 return false;
517 }
518 }
519 }
520 return true;
509 };
521 };
510
522
511 casper.is_only_cell_on = function(i, on_class, off_class) {
523 casper.is_only_cell_on = function(i, on_class, off_class) {
@@ -527,6 +539,19 b' casper.is_only_cell_on = function(i, on_class, off_class) {'
527 return true;
539 return true;
528 };
540 };
529
541
542
543 casper.cell_mode_is = function(index, mode) {
544 // Check if a cell is in a specific mode
545 return this.evaluate(function(i, c) {
546 var cell = IPython.notebook.get_cell(i);
547 if (cell) {
548 return cell.mode === mode;
549 }
550 return false;
551 }, {i : index, m: mode});
552 };
553
554
530 casper.cell_has_class = function(index, classes) {
555 casper.cell_has_class = function(index, classes) {
531 // Check if a cell has a class.
556 // Check if a cell has a class.
532 return this.evaluate(function(i, c) {
557 return this.evaluate(function(i, c) {
General Comments 0
You need to be logged in to leave comments. Login now