##// END OF EJS Templates
bootstrap toolbar
MinRK -
Show More
@@ -26,7 +26,7 var IPython = (function (IPython) {
26 {
26 {
27 id : 'save_b',
27 id : 'save_b',
28 label : 'Save and Checkpoint',
28 label : 'Save and Checkpoint',
29 icon : 'ui-icon-disk',
29 icon : 'icon-hdd',
30 callback : function () {
30 callback : function () {
31 IPython.notebook.save_checkpoint();
31 IPython.notebook.save_checkpoint();
32 }
32 }
@@ -36,7 +36,7 var IPython = (function (IPython) {
36 {
36 {
37 id : 'cut_b',
37 id : 'cut_b',
38 label : 'Cut Cell',
38 label : 'Cut Cell',
39 icon : 'ui-icon-scissors',
39 icon : 'icon-cut',
40 callback : function () {
40 callback : function () {
41 IPython.notebook.cut_cell();
41 IPython.notebook.cut_cell();
42 }
42 }
@@ -44,7 +44,7 var IPython = (function (IPython) {
44 {
44 {
45 id : 'copy_b',
45 id : 'copy_b',
46 label : 'Copy Cell',
46 label : 'Copy Cell',
47 icon : 'ui-icon-copy',
47 icon : 'icon-copy',
48 callback : function () {
48 callback : function () {
49 IPython.notebook.copy_cell();
49 IPython.notebook.copy_cell();
50 }
50 }
@@ -52,7 +52,7 var IPython = (function (IPython) {
52 {
52 {
53 id : 'paste_b',
53 id : 'paste_b',
54 label : 'Paste Cell Below',
54 label : 'Paste Cell Below',
55 icon : 'ui-icon-clipboard',
55 icon : 'icon-paste',
56 callback : function () {
56 callback : function () {
57 IPython.notebook.paste_cell_below();
57 IPython.notebook.paste_cell_below();
58 }
58 }
@@ -63,7 +63,7 var IPython = (function (IPython) {
63 {
63 {
64 id : 'move_up_b',
64 id : 'move_up_b',
65 label : 'Move Cell Up',
65 label : 'Move Cell Up',
66 icon : 'ui-icon-arrowthick-1-n',
66 icon : 'icon-arrow-up',
67 callback : function () {
67 callback : function () {
68 IPython.notebook.move_cell_up();
68 IPython.notebook.move_cell_up();
69 }
69 }
@@ -71,7 +71,7 var IPython = (function (IPython) {
71 {
71 {
72 id : 'move_down_b',
72 id : 'move_down_b',
73 label : 'Move Cell Down',
73 label : 'Move Cell Down',
74 icon : 'ui-icon-arrowthick-1-s',
74 icon : 'icon-arrow-up',
75 callback : function () {
75 callback : function () {
76 IPython.notebook.move_cell_down();
76 IPython.notebook.move_cell_down();
77 }
77 }
@@ -82,7 +82,7 var IPython = (function (IPython) {
82 {
82 {
83 id : 'insert_above_b',
83 id : 'insert_above_b',
84 label : 'Insert Cell Above',
84 label : 'Insert Cell Above',
85 icon : 'ui-icon-arrowthickstop-1-n',
85 icon : 'icon-circle-arrow-up',
86 callback : function () {
86 callback : function () {
87 IPython.notebook.insert_cell_above('code');
87 IPython.notebook.insert_cell_above('code');
88 }
88 }
@@ -90,7 +90,7 var IPython = (function (IPython) {
90 {
90 {
91 id : 'insert_below_b',
91 id : 'insert_below_b',
92 label : 'Insert Cell Below',
92 label : 'Insert Cell Below',
93 icon : 'ui-icon-arrowthickstop-1-s',
93 icon : 'icon-circle-arrow-down',
94 callback : function () {
94 callback : function () {
95 IPython.notebook.insert_cell_below('code');
95 IPython.notebook.insert_cell_below('code');
96 }
96 }
@@ -101,7 +101,7 var IPython = (function (IPython) {
101 {
101 {
102 id : 'run_b',
102 id : 'run_b',
103 label : 'Run Cell',
103 label : 'Run Cell',
104 icon : 'ui-icon-play',
104 icon : 'icon-play',
105 callback : function () {
105 callback : function () {
106 IPython.notebook.execute_selected_cell();
106 IPython.notebook.execute_selected_cell();
107 }
107 }
@@ -109,7 +109,7 var IPython = (function (IPython) {
109 {
109 {
110 id : 'interrupt_b',
110 id : 'interrupt_b',
111 label : 'Interrupt',
111 label : 'Interrupt',
112 icon : 'ui-icon-stop',
112 icon : 'icon-stop',
113 callback : function () {
113 callback : function () {
114 IPython.notebook.kernel.interrupt();
114 IPython.notebook.kernel.interrupt();
115 }
115 }
@@ -121,7 +121,7 var IPython = (function (IPython) {
121 this.element
121 this.element
122 .append($('<select/>')
122 .append($('<select/>')
123 .attr('id','cell_type')
123 .attr('id','cell_type')
124 .addClass('ui-widget-content')
124 // .addClass('ui-widget-content')
125 .append($('<option/>').attr('value','code').text('Code'))
125 .append($('<option/>').attr('value','code').text('Code'))
126 .append($('<option/>').attr('value','markdown').text('Markdown'))
126 .append($('<option/>').attr('value','markdown').text('Markdown'))
127 .append($('<option/>').attr('value','raw').text('Raw Text'))
127 .append($('<option/>').attr('value','raw').text('Raw Text'))
@@ -136,9 +136,9 var IPython = (function (IPython) {
136
136
137
137
138 MainToolBar.prototype.add_celltoolbar_list = function () {
138 MainToolBar.prototype.add_celltoolbar_list = function () {
139 var label = $('<label/>').text('Cell Toolbar:');
139 var label = $('<span/>').addClass("navbar-text").text('Cell Toolbar:');
140 var select = $('<select/>')
140 var select = $('<select/>')
141 .addClass('ui-widget-content')
141 // .addClass('ui-widget-content')
142 .attr('id', 'ctb_select')
142 .attr('id', 'ctb_select')
143 .append($('<option/>').attr('value', '').text('None'));
143 .append($('<option/>').attr('value', '').text('None'));
144 this.element.append(label).append(select);
144 this.element.append(label).append(select);
@@ -39,13 +39,13 var IPython = (function (IPython) {
39 * IPython.toolbar.add_buttons_group([
39 * IPython.toolbar.add_buttons_group([
40 * {
40 * {
41 * label:'my button',
41 * label:'my button',
42 * icon:'ui-icon-disk',
42 * icon:'icon-hdd',
43 * callback:function(){alert('hoho')},
43 * callback:function(){alert('hoho')},
44 * id : 'my_button_id', // this is optional
44 * id : 'my_button_id', // this is optional
45 * },
45 * },
46 * {
46 * {
47 * label:'my second button',
47 * label:'my second button',
48 * icon:'ui-icon-scissors',
48 * icon:'icon-play',
49 * callback:function(){alert('be carefull I cut')}
49 * callback:function(){alert('be carefull I cut')}
50 * }
50 * }
51 * ],
51 * ],
@@ -56,40 +56,37 var IPython = (function (IPython) {
56 * @param list {List}
56 * @param list {List}
57 * List of button of the group, with the following paramter for each :
57 * List of button of the group, with the following paramter for each :
58 * @param list.label {string} text to show on button hover
58 * @param list.label {string} text to show on button hover
59 * @param list.icon {string} icon to choose from [jQuery ThemeRoller](http://jqueryui.com/themeroller/)
59 * @param list.icon {string} icon to choose from [Font Awesome](http://fortawesome.github.io/Font-Awesome)
60 * @param list.callback {function} function to be called on button click
60 * @param list.callback {function} function to be called on button click
61 * @param [list.id] {String} id to give to the button
61 * @param [list.id] {String} id to give to the button
62 * @param [group_id] {String} optionnal id to give to the group
62 * @param [group_id] {String} optionnal id to give to the group
63 *
63 *
64 */
64 */
65 ToolBar.prototype.add_buttons_group = function (list, group_id) {
65 ToolBar.prototype.add_buttons_group = function (list, group_id) {
66 var span_group = $('<span/>');
66 var btn_group = $('<div/>').addClass("btn-group");
67 if( group_id != undefined ) {
67 if( group_id != undefined ) {
68 span_group.attr('id',group_id);
68 btn_group.attr('id',group_id);
69 }
69 }
70 for(var el in list) {
70 for(var el in list) {
71 var button = $('<button/>').button({
71 var button = $('<button/>')
72 icons : {primary : list[el].icon},
72 .addClass('btn')
73 text : false,
73 .attr("title", list[el].label)
74 label : list[el].label
74 .append(
75 });
75 $("<i/>").addClass(list[el].icon)
76 );
76 var id = list[el].id;
77 var id = list[el].id;
77 if( id != undefined )
78 if( id != undefined )
78 button.attr('id',id);
79 button.attr('id',id);
79 var fun = list[el].callback;
80 var fun = list[el].callback;
80 button.click(fun);
81 button.click(fun);
81 span_group.append(button);
82 btn_group.append(button);
82 }
83 }
83 span_group.buttonset();
84 $(this.selector).append(btn_group);
84 $(this.selector).append(span_group);
85 };
85 };
86
86
87 ToolBar.prototype.style = function () {
87 ToolBar.prototype.style = function () {
88 this.element.addClass('border-box-sizing').
88 this.element.addClass('border-box-sizing')
89 addClass('toolbar').
89 .addClass('toolbar');
90 css('border-top-style','none').
91 css('border-left-style','none').
92 css('border-right-style','none');
93 };
90 };
94
91
95 /**
92 /**
@@ -1,15 +1,10
1 .toolbar {
1 .toolbar {
2 padding: 3px 15px;
2 padding: 0px 15px;
3 border-bottom: @border_width @border_color solid;
3 border-bottom: @border_width @border_color solid;
4
4
5 button {
6 margin-top:2px;
7 margin-bottom:2px;
8 }
9
10
11 select, label {
5 select, label {
12 height : 19px;
6 width: auto;
7 height: @baseLineHeight + 6px;
13 vertical-align:middle;
8 vertical-align:middle;
14 margin-right:2px;
9 margin-right:2px;
15 margin-bottom:0;
10 margin-bottom:0;
@@ -19,8 +14,7
19 margin-right:0.3em;
14 margin-right:0.3em;
20 padding: 0px;
15 padding: 0px;
21 }
16 }
22 }
17 .btn {
23
18 padding: 2px 8px;
24 .toolbar select{
19 }
25 width:auto;
26 }
20 }
General Comments 0
You need to be logged in to leave comments. Login now