From 0118cfbd48378b844899e65a3fe27b666020c7dc Mon Sep 17 00:00:00 2001 From: Bussonnier Matthias Date: Sun, 25 Jan 2015 19:55:34 +0100 Subject: [PATCH 1/2] re-hook notification area for editor. - re-order element to be the same as in notebook, - rename events correctly. - Add event on savign to show that save is in progress, that get dismissed on file save Closes #7569 --- IPython/html/static/edit/js/editor.js | 1 + IPython/html/static/edit/js/main.js | 1 + IPython/html/static/edit/js/notificationarea.js | 9 ++++++--- IPython/html/static/edit/less/edit.less | 5 +++++ IPython/html/static/edit/less/menubar.less | 4 ---- .../html/static/notebook/less/notificationarea.less | 6 +++--- IPython/html/static/style/style.min.css | 13 ++++++++++--- IPython/html/templates/edit.html | 4 +++- IPython/html/templates/notebook.html | 2 +- 9 files changed, 30 insertions(+), 15 deletions(-) diff --git a/IPython/html/static/edit/js/editor.js b/IPython/html/static/edit/js/editor.js index 481507c82..d84fef893 100644 --- a/IPython/html/static/edit/js/editor.js +++ b/IPython/html/static/edit/js/editor.js @@ -162,6 +162,7 @@ function($, var that = this; // record change generation for isClean this.generation = this.codemirror.changeGeneration(); + that.events.trigger("file_saving.Editor"); return this.contents.save(this.file_path, model).then(function(data) { that.events.trigger("file_saved.Editor", data); }); diff --git a/IPython/html/static/edit/js/main.js b/IPython/html/static/edit/js/main.js index 4a2731082..7a1d77924 100644 --- a/IPython/html/static/edit/js/main.js +++ b/IPython/html/static/edit/js/main.js @@ -64,6 +64,7 @@ require([ '#notification_area', { events: events, }); + editor.notification_area = notification_area; notification_area.init_notification_widgets(); utils.load_extensions_from_config(config); diff --git a/IPython/html/static/edit/js/notificationarea.js b/IPython/html/static/edit/js/notificationarea.js index fd98ebfee..2f51d6611 100644 --- a/IPython/html/static/edit/js/notificationarea.js +++ b/IPython/html/static/edit/js/notificationarea.js @@ -17,10 +17,13 @@ define([ */ EditorNotificationArea.prototype.init_notification_widgets = function () { var that = this; - var enw = this.new_notification_widget('editor'); + var savew = this.new_notification_widget('save'); - this.events.on("save_succeeded.TextEditor", function() { - enw.set_message("File saved", 2000); + this.events.on("file_saving.Editor", function() { + savew.set_message("Saving File..."); + }); + this.events.on("file_saved.Editor", function() { + savew.set_message("File saved", 2000); }); }; diff --git a/IPython/html/static/edit/less/edit.less b/IPython/html/static/edit/less/edit.less index 99d07884f..26cb7ce48 100644 --- a/IPython/html/static/edit/less/edit.less +++ b/IPython/html/static/edit/less/edit.less @@ -5,6 +5,11 @@ padding: 0px 5px; } +#current-mode{ + padding-left: 5px; + padding-right: 5px; +} + #texteditor-backdrop { padding-top: @page-header-padding; padding-bottom: @page-header-padding; diff --git a/IPython/html/static/edit/less/menubar.less b/IPython/html/static/edit/less/menubar.less index ae21c34d4..c314f310d 100644 --- a/IPython/html/static/edit/less/menubar.less +++ b/IPython/html/static/edit/less/menubar.less @@ -13,10 +13,6 @@ max-height: 20em; } -#current-mode { - margin-right: @padding-large-horizontal; -} - .edit_app { #header { .box-shadow(@global-shadow); diff --git a/IPython/html/static/notebook/less/notificationarea.less b/IPython/html/static/notebook/less/notificationarea.less index 7bdacaaae..3c3d3ed08 100644 --- a/IPython/html/static/notebook/less/notificationarea.less +++ b/IPython/html/static/notebook/less/notificationarea.less @@ -4,19 +4,19 @@ } .indicator_area { + .pull-right(); color: @navbar-default-link-color; margin-left: 5px; margin-right: 5px; width: 11px; z-index: 10; text-align: center; + width: auto; + border-left: 1px solid; } #kernel_indicator { - .pull-right(); .indicator_area(); - width: auto; - border-left: 1px solid; .kernel_indicator_name { padding-left: 5px; diff --git a/IPython/html/static/style/style.min.css b/IPython/html/static/style/style.min.css index 8d01a7917..3fc9f7bbf 100644 --- a/IPython/html/static/style/style.min.css +++ b/IPython/html/static/style/style.min.css @@ -8723,9 +8723,6 @@ ul#new-menu { overflow: auto; max-height: 20em; } -#current-mode { - margin-right: 16px; -} .edit_app #header { -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); @@ -8740,6 +8737,10 @@ ul#new-menu { display: table; padding: 0px 5px; } +#current-mode { + padding-left: 5px; + padding-right: 5px; +} #texteditor-backdrop { padding-top: 20px; padding-bottom: 20px; @@ -10392,12 +10393,16 @@ ul#help_menu li a i { z-index: 10; } .indicator_area { + float: right !important; + float: right; color: #777777; margin-left: 5px; margin-right: 5px; width: 11px; z-index: 10; text-align: center; + width: auto; + border-left: 1px solid; } #kernel_indicator { float: right !important; @@ -10424,6 +10429,8 @@ ul#help_menu li a i { width: 11px; z-index: 10; text-align: center; + width: auto; + border-left: 1px solid; } .edit_mode .modal_indicator:before { display: inline-block; diff --git a/IPython/html/templates/edit.html b/IPython/html/templates/edit.html index a34e2c49d..24c679ca2 100644 --- a/IPython/html/templates/edit.html +++ b/IPython/html/templates/edit.html @@ -31,6 +31,9 @@ data-file-path="{{file_path}}" diff --git a/IPython/html/templates/notebook.html b/IPython/html/templates/notebook.html index d41065ac7..280a3b047 100644 --- a/IPython/html/templates/notebook.html +++ b/IPython/html/templates/notebook.html @@ -58,7 +58,7 @@ data-notebook-path="{{notebook_path}}" Menu - From 8bc4bbab68b23b2a96c7920562fec96df0a8facc Mon Sep 17 00:00:00 2001 From: Bussonnier Matthias Date: Sun, 25 Jan 2015 20:33:24 +0100 Subject: [PATCH 2/2] remove "Saving..." notification --- IPython/html/static/edit/js/notificationarea.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/IPython/html/static/edit/js/notificationarea.js b/IPython/html/static/edit/js/notificationarea.js index 2f51d6611..73f7077d5 100644 --- a/IPython/html/static/edit/js/notificationarea.js +++ b/IPython/html/static/edit/js/notificationarea.js @@ -19,9 +19,6 @@ define([ var that = this; var savew = this.new_notification_widget('save'); - this.events.on("file_saving.Editor", function() { - savew.set_message("Saving File..."); - }); this.events.on("file_saved.Editor", function() { savew.set_message("File saved", 2000); });