From 141231ccf31860e295d12a598feb07905558021c 2015-02-11 01:15:06
From: Min RK
Date: 2015-02-11 01:15:06
Subject: [PATCH] Merge pull request #7720 from jdfreder/readonlyui
Readonly indicator.
---
diff --git a/IPython/html/static/notebook/js/notificationarea.js b/IPython/html/static/notebook/js/notificationarea.js
index 2307d3e..a083bf1 100644
--- a/IPython/html/static/notebook/js/notificationarea.js
+++ b/IPython/html/static/notebook/js/notificationarea.js
@@ -38,8 +38,18 @@ define([
var knw = this.new_notification_widget('kernel');
var $kernel_ind_icon = $("#kernel_indicator_icon");
var $modal_ind_icon = $("#modal_indicator");
+ var $readonly_ind_icon = $('#readonly-indicator');
var $body = $('body');
+ // Listen for the notebook loaded event. Set readonly indicator.
+ this.events.on('notebook_loaded.Notebook', function() {
+ if (that.notebook.writable) {
+ $readonly_ind_icon.hide();
+ } else {
+ $readonly_ind_icon.show();
+ }
+ });
+
// Command/Edit mode
this.events.on('edit_mode.Notebook', function () {
that.save_widget.update_document_title();
diff --git a/IPython/html/static/notebook/less/notificationarea.less b/IPython/html/static/notebook/less/notificationarea.less
index 599817f..bfbf5b7 100644
--- a/IPython/html/static/notebook/less/notificationarea.less
+++ b/IPython/html/static/notebook/less/notificationarea.less
@@ -30,6 +30,19 @@
.indicator_area();
}
+#readonly-indicator {
+ .pull-right();
+ .indicator_area();
+
+ margin-top: 2px;
+ margin-bottom: 0px;
+ margin-left: 0px;
+ margin-right: 0px;
+
+ // Start out hidden.
+ display: none;
+}
+
.modal_indicator:before {
.fa-fw();
}
diff --git a/IPython/html/static/style/style.min.css b/IPython/html/static/style/style.min.css
index 13cda70..6be255d 100644
--- a/IPython/html/static/style/style.min.css
+++ b/IPython/html/static/style/style.min.css
@@ -10711,6 +10711,22 @@ ul#help_menu li a i {
text-align: center;
width: auto;
}
+#readonly-indicator {
+ float: right !important;
+ float: right;
+ color: #777777;
+ margin-left: 5px;
+ margin-right: 5px;
+ width: 11px;
+ z-index: 10;
+ text-align: center;
+ width: auto;
+ margin-top: 2px;
+ margin-bottom: 0px;
+ margin-left: 0px;
+ margin-right: 0px;
+ display: none;
+}
.modal_indicator:before {
width: 1.28571429em;
text-align: center;
diff --git a/IPython/html/templates/notebook.html b/IPython/html/templates/notebook.html
index 856a393..b4a1de7 100644
--- a/IPython/html/templates/notebook.html
+++ b/IPython/html/templates/notebook.html
@@ -62,6 +62,12 @@ data-notebook-path="{{notebook_path}}"
Kernel
+
+
+
+
+
+