Merge pull request #7586 from Carreau/notif-editor

re-hook notification area for editor.
This commit is contained in:
Thomas Kluyver 2015-01-26 10:03:29 -08:00
commit 708088d74a
9 changed files with 27 additions and 15 deletions

View File

@ -162,6 +162,7 @@ function($,
var that = this; var that = this;
// record change generation for isClean // record change generation for isClean
this.generation = this.codemirror.changeGeneration(); this.generation = this.codemirror.changeGeneration();
that.events.trigger("file_saving.Editor");
return this.contents.save(this.file_path, model).then(function(data) { return this.contents.save(this.file_path, model).then(function(data) {
that.events.trigger("file_saved.Editor", data); that.events.trigger("file_saved.Editor", data);
}); });

View File

@ -64,6 +64,7 @@ require([
'#notification_area', { '#notification_area', {
events: events, events: events,
}); });
editor.notification_area = notification_area;
notification_area.init_notification_widgets(); notification_area.init_notification_widgets();
utils.load_extensions_from_config(config); utils.load_extensions_from_config(config);

View File

@ -17,10 +17,10 @@ define([
*/ */
EditorNotificationArea.prototype.init_notification_widgets = function () { EditorNotificationArea.prototype.init_notification_widgets = function () {
var that = this; var that = this;
var enw = this.new_notification_widget('editor'); var savew = this.new_notification_widget('save');
this.events.on("save_succeeded.TextEditor", function() { this.events.on("file_saved.Editor", function() {
enw.set_message("File saved", 2000); savew.set_message("File saved", 2000);
}); });
}; };

View File

@ -5,6 +5,11 @@
padding: 0px 5px; padding: 0px 5px;
} }
#current-mode{
padding-left: 5px;
padding-right: 5px;
}
#texteditor-backdrop { #texteditor-backdrop {
padding-top: @page-header-padding; padding-top: @page-header-padding;
padding-bottom: @page-header-padding; padding-bottom: @page-header-padding;

View File

@ -13,10 +13,6 @@
max-height: 20em; max-height: 20em;
} }
#current-mode {
margin-right: @padding-large-horizontal;
}
.edit_app { .edit_app {
#header { #header {
.box-shadow(@global-shadow); .box-shadow(@global-shadow);

View File

@ -4,19 +4,19 @@
} }
.indicator_area { .indicator_area {
.pull-right();
color: @navbar-default-link-color; color: @navbar-default-link-color;
margin-left: 5px; margin-left: 5px;
margin-right: 5px; margin-right: 5px;
width: 11px; width: 11px;
z-index: 10; z-index: 10;
text-align: center; text-align: center;
width: auto;
border-left: 1px solid;
} }
#kernel_indicator { #kernel_indicator {
.pull-right();
.indicator_area(); .indicator_area();
width: auto;
border-left: 1px solid;
.kernel_indicator_name { .kernel_indicator_name {
padding-left: 5px; padding-left: 5px;

View File

@ -8855,9 +8855,6 @@ ul#new-menu {
overflow: auto; overflow: auto;
max-height: 20em; max-height: 20em;
} }
#current-mode {
margin-right: 16px;
}
.edit_app #header { .edit_app #header {
-webkit-box-shadow: 0px 0px 12px 1px rgba(87, 87, 87, 0.2); -webkit-box-shadow: 0px 0px 12px 1px rgba(87, 87, 87, 0.2);
box-shadow: 0px 0px 12px 1px rgba(87, 87, 87, 0.2); box-shadow: 0px 0px 12px 1px rgba(87, 87, 87, 0.2);
@ -8872,6 +8869,10 @@ ul#new-menu {
display: table; display: table;
padding: 0px 5px; padding: 0px 5px;
} }
#current-mode {
padding-left: 5px;
padding-right: 5px;
}
#texteditor-backdrop { #texteditor-backdrop {
padding-top: 20px; padding-top: 20px;
padding-bottom: 20px; padding-bottom: 20px;
@ -10519,12 +10520,16 @@ ul#help_menu li a i {
z-index: 10; z-index: 10;
} }
.indicator_area { .indicator_area {
float: right !important;
float: right;
color: #777777; color: #777777;
margin-left: 5px; margin-left: 5px;
margin-right: 5px; margin-right: 5px;
width: 11px; width: 11px;
z-index: 10; z-index: 10;
text-align: center; text-align: center;
width: auto;
border-left: 1px solid;
} }
#kernel_indicator { #kernel_indicator {
float: right !important; float: right !important;
@ -10551,6 +10556,8 @@ ul#help_menu li a i {
width: 11px; width: 11px;
z-index: 10; z-index: 10;
text-align: center; text-align: center;
width: auto;
border-left: 1px solid;
} }
.edit_mode .modal_indicator:before { .edit_mode .modal_indicator:before {
display: inline-block; display: inline-block;

View File

@ -31,6 +31,9 @@ data-file-path="{{file_path}}"
<div id="menubar"> <div id="menubar">
<div id="menus" class="navbar navbar-default" role="navigation"> <div id="menus" class="navbar navbar-default" role="navigation">
<div class="container-fluid"> <div class="container-fluid">
<p class="navbar-text indicator_area">
<span id="current-mode" >current mode</span>
</p>
<button type="button" class="btn btn-default navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <button type="button" class="btn btn-default navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<i class="fa fa-bars"></i> <i class="fa fa-bars"></i>
<span class="navbar-text">Menu</span> <span class="navbar-text">Menu</span>
@ -69,7 +72,6 @@ data-file-path="{{file_path}}"
</ul> </ul>
</li> </li>
</ul> </ul>
<p id="current-mode" class="navbar-text navbar-right">current mode</p>
</div> </div>
</div> </div>
</div> </div>

View File

@ -58,7 +58,7 @@ data-notebook-path="{{notebook_path}}"
<i class="fa fa-bars"></i> <i class="fa fa-bars"></i>
<span class="navbar-text">Menu</span> <span class="navbar-text">Menu</span>
</button> </button>
<p id="kernel_indicator" class="navbar-text"> <p id="kernel_indicator" class="navbar-text indicator_area">
<span class="kernel_indicator_name">Kernel</span> <span class="kernel_indicator_name">Kernel</span>
<i id="kernel_indicator_icon"></i> <i id="kernel_indicator_icon"></i>
</p> </p>