diff --git a/IPython/frontend/html/notebook/static/css/celltoolbar.css b/IPython/frontend/html/notebook/static/css/celltoolbar.css new file mode 100644 index 0000000..d9650ae --- /dev/null +++ b/IPython/frontend/html/notebook/static/css/celltoolbar.css @@ -0,0 +1,53 @@ +/*Css for the metadata edit area*/ + +.celltoolbar{ + border:thin solid #DDD; + margin-left:81px; + border-bottom:none; + background : #EEE; + border-top-right-radius: 3px; + border-top-left-radius: 3px; + display:none; +} + +.code_cell .celltoolbar{ + margin-left:81px; +} + +.text_cell .celltoolbar{ + margin-left:0px; +} + +.celltoolbar-on div.input_area , .celltoolbar-on div.text_cell_input{ + border-top-right-radius: 0px; + border-top-left-radius: 0px; +} + +.celltoolbar-on .celltoolbar { + display:block; +} + +.celltoolbar ui-button { + border :none; +} + +.button_container { + float:right; +} + +.button_container .ui-state-default, .button_container .ui-state-hover, .button_container .ui-state-hover span{ + border-radius : 0 0 0 0; + border : none; +} + +.celltoolbar select { + margin:10px; + margin-top:0px; + margin-bottom:0px; +} + +.celltoolbar input[type=checkbox] { + margin-bottom:1px; + +} + diff --git a/IPython/frontend/html/notebook/static/css/notebook.css b/IPython/frontend/html/notebook/static/css/notebook.css index 83f5577..4c5b6f8 100644 --- a/IPython/frontend/html/notebook/static/css/notebook.css +++ b/IPython/frontend/html/notebook/static/css/notebook.css @@ -29,6 +29,7 @@ span#notebook_name { font-size: 146.5%; } + .ui-menubar-item .ui-button .ui-button-text { padding: 0.4em 1.0em; font-size: 100%; @@ -80,8 +81,11 @@ span#notebook_name { padding: 3px 15px; } -#cell_type { +#maintoolbar > select, #maintoolbar label { font-size: 85%; + margin-left:0.3em; + margin-right:0.3em; + } diff --git a/IPython/frontend/html/notebook/static/js/cell.js b/IPython/frontend/html/notebook/static/js/cell.js index e33f221..f1ea132 100644 --- a/IPython/frontend/html/notebook/static/js/cell.js +++ b/IPython/frontend/html/notebook/static/js/cell.js @@ -50,7 +50,9 @@ var IPython = (function (IPython) { * and will be called by Base Class constructor. * @method create_element */ - Cell.prototype.create_element = function () {}; + Cell.prototype.create_element = function () { + this.celltoolbar = new IPython.CellToolbar(this); + }; /** @@ -163,6 +165,7 @@ var IPython = (function (IPython) { if (data.metadata !== undefined) { this.metadata = data.metadata; } + this.celltoolbar.rebuild(); }; diff --git a/IPython/frontend/html/notebook/static/js/celltoolbar.js b/IPython/frontend/html/notebook/static/js/celltoolbar.js new file mode 100644 index 0000000..3e74131 --- /dev/null +++ b/IPython/frontend/html/notebook/static/js/celltoolbar.js @@ -0,0 +1,358 @@ +//---------------------------------------------------------------------------- +// Copyright (C) 2012 The IPython Development Team +// +// Distributed under the terms of the BSD License. The full license is in +// the file COPYING, distributed as part of this software. +//---------------------------------------------------------------------------- + +//============================================================================ +// CellToolbar +//============================================================================ + + +/** + * A Module to control the per-cell toolbar. + * @module IPython + * @namespace IPython + * @submodule CellToolbar + */ +var IPython = (function (IPython) { + "use strict"; + + + /** + * @constructor + * @class CellToolbar + * @param {The cell to attach the metadata UI to} cell + */ + var CellToolbar = function (cell) { + CellToolbar._instances.push(this); + this.inner_element = $('
'); + this.cell = cell; + this.element = $('
').addClass('celltoolbar') + .append(this.inner_element) + this.rebuild(); + return this; + }; + + CellToolbar.dropdown_preset_element = $('').attr('type', 'checkbox'); + var lbl = $('