##// END OF EJS Templates
Port to fontawesome4
Thomas Spura -
Show More
@@ -1,230 +1,230 b''
1 // Copyright (c) IPython Development Team.
1 // Copyright (c) IPython Development Team.
2 // Distributed under the terms of the Modified BSD License.
2 // Distributed under the terms of the Modified BSD License.
3
3
4 define([
4 define([
5 'base/js/namespace',
5 'base/js/namespace',
6 'jquery',
6 'jquery',
7 'notebook/js/toolbar',
7 'notebook/js/toolbar',
8 'notebook/js/celltoolbar',
8 'notebook/js/celltoolbar',
9 ], function(IPython, $, toolbar, celltoolbar) {
9 ], function(IPython, $, toolbar, celltoolbar) {
10 "use strict";
10 "use strict";
11
11
12 var MainToolBar = function (selector, options) {
12 var MainToolBar = function (selector, options) {
13 // Constructor
13 // Constructor
14 //
14 //
15 // Parameters:
15 // Parameters:
16 // selector: string
16 // selector: string
17 // options: dictionary
17 // options: dictionary
18 // Dictionary of keyword arguments.
18 // Dictionary of keyword arguments.
19 // events: $(Events) instance
19 // events: $(Events) instance
20 // notebook: Notebook instance
20 // notebook: Notebook instance
21 toolbar.ToolBar.apply(this, arguments);
21 toolbar.ToolBar.apply(this, arguments);
22 this.events = options.events;
22 this.events = options.events;
23 this.notebook = options.notebook;
23 this.notebook = options.notebook;
24 this.construct();
24 this.construct();
25 this.add_celltype_list();
25 this.add_celltype_list();
26 this.add_celltoolbar_list();
26 this.add_celltoolbar_list();
27 this.bind_events();
27 this.bind_events();
28 };
28 };
29
29
30 MainToolBar.prototype = new toolbar.ToolBar();
30 MainToolBar.prototype = new toolbar.ToolBar();
31
31
32 MainToolBar.prototype.construct = function () {
32 MainToolBar.prototype.construct = function () {
33 var that = this;
33 var that = this;
34 this.add_buttons_group([
34 this.add_buttons_group([
35 {
35 {
36 id : 'save_b',
36 id : 'save_b',
37 label : 'Save and Checkpoint',
37 label : 'Save and Checkpoint',
38 icon : 'icon-save',
38 icon : 'fa fa-save',
39 callback : function () {
39 callback : function () {
40 that.notebook.save_checkpoint();
40 that.notebook.save_checkpoint();
41 }
41 }
42 }
42 }
43 ]);
43 ]);
44
44
45 this.add_buttons_group([
45 this.add_buttons_group([
46 {
46 {
47 id : 'insert_below_b',
47 id : 'insert_below_b',
48 label : 'Insert Cell Below',
48 label : 'Insert Cell Below',
49 icon : 'icon-plus-sign',
49 icon : 'fa fa-plus',
50 callback : function () {
50 callback : function () {
51 that.notebook.insert_cell_below('code');
51 that.notebook.insert_cell_below('code');
52 that.notebook.select_next();
52 that.notebook.select_next();
53 that.notebook.focus_cell();
53 that.notebook.focus_cell();
54 }
54 }
55 }
55 }
56 ],'insert_above_below');
56 ],'insert_above_below');
57
57
58 this.add_buttons_group([
58 this.add_buttons_group([
59 {
59 {
60 id : 'cut_b',
60 id : 'cut_b',
61 label : 'Cut Cell',
61 label : 'Cut Cell',
62 icon : 'icon-cut',
62 icon : 'fa fa-cut',
63 callback : function () {
63 callback : function () {
64 that.notebook.cut_cell();
64 that.notebook.cut_cell();
65 }
65 }
66 },
66 },
67 {
67 {
68 id : 'copy_b',
68 id : 'copy_b',
69 label : 'Copy Cell',
69 label : 'Copy Cell',
70 icon : 'icon-copy',
70 icon : 'fa fa-copy',
71 callback : function () {
71 callback : function () {
72 that.notebook.copy_cell();
72 that.notebook.copy_cell();
73 }
73 }
74 },
74 },
75 {
75 {
76 id : 'paste_b',
76 id : 'paste_b',
77 label : 'Paste Cell Below',
77 label : 'Paste Cell Below',
78 icon : 'icon-paste',
78 icon : 'fa fa-paste',
79 callback : function () {
79 callback : function () {
80 that.notebook.paste_cell_below();
80 that.notebook.paste_cell_below();
81 }
81 }
82 }
82 }
83 ],'cut_copy_paste');
83 ],'cut_copy_paste');
84
84
85 this.add_buttons_group([
85 this.add_buttons_group([
86 {
86 {
87 id : 'move_up_b',
87 id : 'move_up_b',
88 label : 'Move Cell Up',
88 label : 'Move Cell Up',
89 icon : 'icon-arrow-up',
89 icon : 'fa fa-arrow-up',
90 callback : function () {
90 callback : function () {
91 that.notebook.move_cell_up();
91 that.notebook.move_cell_up();
92 }
92 }
93 },
93 },
94 {
94 {
95 id : 'move_down_b',
95 id : 'move_down_b',
96 label : 'Move Cell Down',
96 label : 'Move Cell Down',
97 icon : 'icon-arrow-down',
97 icon : 'fa fa-arrow-down',
98 callback : function () {
98 callback : function () {
99 that.notebook.move_cell_down();
99 that.notebook.move_cell_down();
100 }
100 }
101 }
101 }
102 ],'move_up_down');
102 ],'move_up_down');
103
103
104
104
105 this.add_buttons_group([
105 this.add_buttons_group([
106 {
106 {
107 id : 'run_b',
107 id : 'run_b',
108 label : 'Run Cell',
108 label : 'Run Cell',
109 icon : 'icon-play',
109 icon : 'fa fa-play',
110 callback : function () {
110 callback : function () {
111 // emulate default shift-enter behavior
111 // emulate default shift-enter behavior
112 that.notebook.execute_cell_and_select_below();
112 that.notebook.execute_cell_and_select_below();
113 }
113 }
114 },
114 },
115 {
115 {
116 id : 'interrupt_b',
116 id : 'interrupt_b',
117 label : 'Interrupt',
117 label : 'Interrupt',
118 icon : 'icon-stop',
118 icon : 'fa fa-stop',
119 callback : function () {
119 callback : function () {
120 that.notebook.session.interrupt_kernel();
120 that.notebook.session.interrupt_kernel();
121 }
121 }
122 },
122 },
123 {
123 {
124 id : 'repeat_b',
124 id : 'repeat_b',
125 label : 'Restart Kernel',
125 label : 'Restart Kernel',
126 icon : 'icon-repeat',
126 icon : 'fa fa-repeat',
127 callback : function () {
127 callback : function () {
128 that.notebook.restart_kernel();
128 that.notebook.restart_kernel();
129 }
129 }
130 }
130 }
131 ],'run_int');
131 ],'run_int');
132 };
132 };
133
133
134 MainToolBar.prototype.add_celltype_list = function () {
134 MainToolBar.prototype.add_celltype_list = function () {
135 this.element
135 this.element
136 .append($('<select/>')
136 .append($('<select/>')
137 .attr('id','cell_type')
137 .attr('id','cell_type')
138 .addClass('form-control select-xs')
138 .addClass('form-control select-xs')
139 // .addClass('ui-widget-content')
139 // .addClass('ui-widget-content')
140 .append($('<option/>').attr('value','code').text('Code'))
140 .append($('<option/>').attr('value','code').text('Code'))
141 .append($('<option/>').attr('value','markdown').text('Markdown'))
141 .append($('<option/>').attr('value','markdown').text('Markdown'))
142 .append($('<option/>').attr('value','raw').text('Raw NBConvert'))
142 .append($('<option/>').attr('value','raw').text('Raw NBConvert'))
143 .append($('<option/>').attr('value','heading1').text('Heading 1'))
143 .append($('<option/>').attr('value','heading1').text('Heading 1'))
144 .append($('<option/>').attr('value','heading2').text('Heading 2'))
144 .append($('<option/>').attr('value','heading2').text('Heading 2'))
145 .append($('<option/>').attr('value','heading3').text('Heading 3'))
145 .append($('<option/>').attr('value','heading3').text('Heading 3'))
146 .append($('<option/>').attr('value','heading4').text('Heading 4'))
146 .append($('<option/>').attr('value','heading4').text('Heading 4'))
147 .append($('<option/>').attr('value','heading5').text('Heading 5'))
147 .append($('<option/>').attr('value','heading5').text('Heading 5'))
148 .append($('<option/>').attr('value','heading6').text('Heading 6'))
148 .append($('<option/>').attr('value','heading6').text('Heading 6'))
149 );
149 );
150 };
150 };
151
151
152
152
153 MainToolBar.prototype.add_celltoolbar_list = function () {
153 MainToolBar.prototype.add_celltoolbar_list = function () {
154 var label = $('<span/>').addClass("navbar-text").text('Cell Toolbar:');
154 var label = $('<span/>').addClass("navbar-text").text('Cell Toolbar:');
155 var select = $('<select/>')
155 var select = $('<select/>')
156 // .addClass('ui-widget-content')
156 // .addClass('ui-widget-content')
157 .attr('id', 'ctb_select')
157 .attr('id', 'ctb_select')
158 .addClass('form-control select-xs')
158 .addClass('form-control select-xs')
159 .append($('<option/>').attr('value', '').text('None'));
159 .append($('<option/>').attr('value', '').text('None'));
160 this.element.append(label).append(select);
160 this.element.append(label).append(select);
161 var that = this;
161 var that = this;
162 select.change(function() {
162 select.change(function() {
163 var val = $(this).val();
163 var val = $(this).val();
164 if (val ==='') {
164 if (val ==='') {
165 celltoolbar.CellToolbar.global_hide();
165 celltoolbar.CellToolbar.global_hide();
166 delete that.notebook.metadata.celltoolbar;
166 delete that.notebook.metadata.celltoolbar;
167 } else {
167 } else {
168 celltoolbar.CellToolbar.global_show();
168 celltoolbar.CellToolbar.global_show();
169 celltoolbar.CellToolbar.activate_preset(val, that.events);
169 celltoolbar.CellToolbar.activate_preset(val, that.events);
170 that.notebook.metadata.celltoolbar = val;
170 that.notebook.metadata.celltoolbar = val;
171 }
171 }
172 });
172 });
173 // Setup the currently registered presets.
173 // Setup the currently registered presets.
174 var presets = celltoolbar.CellToolbar.list_presets();
174 var presets = celltoolbar.CellToolbar.list_presets();
175 for (var i=0; i<presets.length; i++) {
175 for (var i=0; i<presets.length; i++) {
176 var name = presets[i];
176 var name = presets[i];
177 select.append($('<option/>').attr('value', name).text(name));
177 select.append($('<option/>').attr('value', name).text(name));
178 }
178 }
179 // Setup future preset registrations.
179 // Setup future preset registrations.
180 this.events.on('preset_added.CellToolbar', function (event, data) {
180 this.events.on('preset_added.CellToolbar', function (event, data) {
181 var name = data.name;
181 var name = data.name;
182 select.append($('<option/>').attr('value', name).text(name));
182 select.append($('<option/>').attr('value', name).text(name));
183 });
183 });
184 // Update select value when a preset is activated.
184 // Update select value when a preset is activated.
185 this.events.on('preset_activated.CellToolbar', function (event, data) {
185 this.events.on('preset_activated.CellToolbar', function (event, data) {
186 if (select.val() !== data.name)
186 if (select.val() !== data.name)
187 select.val(data.name);
187 select.val(data.name);
188 });
188 });
189 };
189 };
190
190
191
191
192 MainToolBar.prototype.bind_events = function () {
192 MainToolBar.prototype.bind_events = function () {
193 var that = this;
193 var that = this;
194
194
195 this.element.find('#cell_type').change(function () {
195 this.element.find('#cell_type').change(function () {
196 var cell_type = $(this).val();
196 var cell_type = $(this).val();
197 if (cell_type === 'code') {
197 if (cell_type === 'code') {
198 that.notebook.to_code();
198 that.notebook.to_code();
199 } else if (cell_type === 'markdown') {
199 } else if (cell_type === 'markdown') {
200 that.notebook.to_markdown();
200 that.notebook.to_markdown();
201 } else if (cell_type === 'raw') {
201 } else if (cell_type === 'raw') {
202 that.notebook.to_raw();
202 that.notebook.to_raw();
203 } else if (cell_type === 'heading1') {
203 } else if (cell_type === 'heading1') {
204 that.notebook.to_heading(undefined, 1);
204 that.notebook.to_heading(undefined, 1);
205 } else if (cell_type === 'heading2') {
205 } else if (cell_type === 'heading2') {
206 that.notebook.to_heading(undefined, 2);
206 that.notebook.to_heading(undefined, 2);
207 } else if (cell_type === 'heading3') {
207 } else if (cell_type === 'heading3') {
208 that.notebook.to_heading(undefined, 3);
208 that.notebook.to_heading(undefined, 3);
209 } else if (cell_type === 'heading4') {
209 } else if (cell_type === 'heading4') {
210 that.notebook.to_heading(undefined, 4);
210 that.notebook.to_heading(undefined, 4);
211 } else if (cell_type === 'heading5') {
211 } else if (cell_type === 'heading5') {
212 that.notebook.to_heading(undefined, 5);
212 that.notebook.to_heading(undefined, 5);
213 } else if (cell_type === 'heading6') {
213 } else if (cell_type === 'heading6') {
214 that.notebook.to_heading(undefined, 6);
214 that.notebook.to_heading(undefined, 6);
215 }
215 }
216 });
216 });
217 this.events.on('selected_cell_type_changed.Notebook', function (event, data) {
217 this.events.on('selected_cell_type_changed.Notebook', function (event, data) {
218 if (data.cell_type === 'heading') {
218 if (data.cell_type === 'heading') {
219 that.element.find('#cell_type').val(data.cell_type+data.level);
219 that.element.find('#cell_type').val(data.cell_type+data.level);
220 } else {
220 } else {
221 that.element.find('#cell_type').val(data.cell_type);
221 that.element.find('#cell_type').val(data.cell_type);
222 }
222 }
223 });
223 });
224 };
224 };
225
225
226 // Backwards compatability.
226 // Backwards compatability.
227 IPython.MainToolBar = MainToolBar;
227 IPython.MainToolBar = MainToolBar;
228
228
229 return {'MainToolBar': MainToolBar};
229 return {'MainToolBar': MainToolBar};
230 });
230 });
@@ -1,46 +1,46 b''
1 #notification_area {
1 #notification_area {
2 .pull-right();
2 .pull-right();
3
3
4 z-index: 10;
4 z-index: 10;
5 }
5 }
6
6
7 .indicator_area {
7 .indicator_area {
8 color: @navbar-default-link-color;
8 color: @navbar-default-link-color;
9 padding: 4px 3px;
9 padding: 4px 3px;
10 margin: 0px;
10 margin: 0px;
11 width: 11px;
11 width: 11px;
12 z-index: 10;
12 z-index: 10;
13 text-align: center;
13 text-align: center;
14 }
14 }
15
15
16 #kernel_indicator {
16 #kernel_indicator {
17 .pull-right();
17 .pull-right();
18 .indicator_area();
18 .indicator_area();
19
19
20 margin-right: 12px;
20 margin-right: 12px;
21 }
21 }
22
22
23 #modal_indicator {
23 #modal_indicator {
24 .pull-right();
24 .pull-right();
25 .indicator_area();
25 .indicator_area();
26
26
27 margin-right: 5px;
27 margin-right: 5px;
28 }
28 }
29
29
30 .edit_mode_icon:before {
30 .edit_mode_icon:before {
31 .icon(@pencil);
31 content: @fa-var-pencil;
32 }
32 }
33
33
34 .command_mode_icon:before {
34 .command_mode_icon:before {
35 .icon(' ');
35 content: ' ';
36 }
36 }
37
37
38 .kernel_idle_icon:before {
38 .kernel_idle_icon:before {
39 .icon(@circle-blank);
39 content: @fa-var-circle-o;
40 }
40 }
41
41
42 .kernel_busy_icon:before {
42 .kernel_busy_icon:before {
43 .icon(@circle);
43 content: @fa-var-circle;
44 }
44 }
45
45
46
46
@@ -1,149 +1,149 b''
1
1
2 /**
2 /**
3 * Primary styles
3 * Primary styles
4 *
4 *
5 * Author: IPython Development Team
5 * Author: IPython Development Team
6 */
6 */
7
7
8 @dashboard_tb_pad: 4px;
8 @dashboard_tb_pad: 4px;
9 @dashboard_lr_pad: 7px;
9 @dashboard_lr_pad: 7px;
10 // These are the total heights of the Bootstrap small and mini buttons. These values
10 // These are the total heights of the Bootstrap small and mini buttons. These values
11 // are not less variables so we have to track them statically.
11 // are not less variables so we have to track them statically.
12 @btn_small_height: 24px;
12 @btn_small_height: 24px;
13 @btn_mini_height: 22px;
13 @btn_mini_height: 22px;
14 @dark_dashboard_color: @breadcrumb-color;
14 @dark_dashboard_color: @breadcrumb-color;
15
15
16 ul#tabs {
16 ul#tabs {
17 margin-bottom: @dashboard_tb_pad;
17 margin-bottom: @dashboard_tb_pad;
18 }
18 }
19
19
20 ul#tabs a {
20 ul#tabs a {
21 padding-top: @dashboard_tb_pad + 2px;
21 padding-top: @dashboard_tb_pad + 2px;
22 padding-bottom: @dashboard_tb_pad;
22 padding-bottom: @dashboard_tb_pad;
23 }
23 }
24
24
25 ul.breadcrumb {
25 ul.breadcrumb {
26 a:focus, a:hover {
26 a:focus, a:hover {
27 text-decoration: none;
27 text-decoration: none;
28 }
28 }
29 i.icon-home {
29 i.icon-home {
30 font-size: 16px;
30 font-size: 16px;
31 margin-right: 4px;
31 margin-right: 4px;
32 }
32 }
33
33
34 span {
34 span {
35 color: @dark_dashboard_color;
35 color: @dark_dashboard_color;
36 }
36 }
37 }
37 }
38
38
39 .list_toolbar {
39 .list_toolbar {
40 padding: @dashboard_tb_pad 0 @dashboard_tb_pad 0;
40 padding: @dashboard_tb_pad 0 @dashboard_tb_pad 0;
41 vertical-align: middle;
41 vertical-align: middle;
42
42
43 .tree-buttons {
43 .tree-buttons {
44 padding-top: 2px;
44 padding-top: 2px;
45 }
45 }
46 }
46 }
47
47
48 .list_toolbar [class*="span"] {
48 .list_toolbar [class*="span"] {
49 min-height: @btn_small_height;
49 min-height: @btn_small_height;
50 }
50 }
51
51
52 .list_header {
52 .list_header {
53 font-weight: bold;
53 font-weight: bold;
54 }
54 }
55
55
56 .list_container {
56 .list_container {
57 margin-top: @dashboard_tb_pad;
57 margin-top: @dashboard_tb_pad;
58 margin-bottom: 5*@dashboard_tb_pad;
58 margin-bottom: 5*@dashboard_tb_pad;
59 border: 1px solid @border_color;
59 border: 1px solid @border_color;
60 border-radius: 4px;
60 border-radius: 4px;
61 }
61 }
62
62
63 .list_container > div {
63 .list_container > div {
64 border-bottom: 1px solid @border_color;
64 border-bottom: 1px solid @border_color;
65 &:hover .list-item{
65 &:hover .list-item{
66 background-color: red;
66 background-color: red;
67 };
67 };
68 }
68 }
69
69
70 .list_container > div:last-child {
70 .list_container > div:last-child {
71 border: none;
71 border: none;
72 }
72 }
73
73
74 .list_item {
74 .list_item {
75 &:hover .list_item {
75 &:hover .list_item {
76 background-color: #ddd;
76 background-color: #ddd;
77 };
77 };
78 a {text-decoration: none;}
78 a {text-decoration: none;}
79 }
79 }
80
80
81 .action_col {
81 .action_col {
82 text-align: right;
82 text-align: right;
83 }
83 }
84
84
85 .list_header>div, .list_item>div {
85 .list_header>div, .list_item>div {
86 padding-top: @dashboard_tb_pad;
86 padding-top: @dashboard_tb_pad;
87 padding-bottom: @dashboard_tb_pad;
87 padding-bottom: @dashboard_tb_pad;
88 padding-left: @dashboard_lr_pad;
88 padding-left: @dashboard_lr_pad;
89 padding-right: @dashboard_lr_pad;
89 padding-right: @dashboard_lr_pad;
90 line-height: @btn_mini_height;
90 line-height: @btn_mini_height;
91 }
91 }
92
92
93 .item_name {
93 .item_name {
94 line-height: @btn_mini_height;
94 line-height: @btn_mini_height;
95 height: @btn_small_height;
95 height: @btn_small_height;
96 }
96 }
97
97
98 .item_icon {
98 .item_icon {
99 font-size: 14px;
99 font-size: 14px;
100 color: @dark_dashboard_color;
100 color: @dark_dashboard_color;
101 margin-right: @dashboard_lr_pad;
101 margin-right: @dashboard_lr_pad;
102 }
102 }
103
103
104 .item_buttons {
104 .item_buttons {
105 line-height: 1em;
105 line-height: 1em;
106 }
106 }
107
107
108 .toolbar_info {
108 .toolbar_info {
109 height: @btn_small_height;
109 height: @btn_small_height;
110 line-height: @btn_small_height;
110 line-height: @btn_small_height;
111 }
111 }
112
112
113 input.nbname_input, input.engine_num_input {
113 input.nbname_input, input.engine_num_input {
114 // These settings give these inputs a height that matches @btn_mini_height = 22
114 // These settings give these inputs a height that matches @btn_mini_height = 22
115 padding-top: 3px;
115 padding-top: 3px;
116 padding-bottom: 3px;
116 padding-bottom: 3px;
117 height: @btn_mini_height;
117 height: @btn_mini_height;
118 line-height: 14px;
118 line-height: 14px;
119 margin: 0px;
119 margin: 0px;
120 }
120 }
121
121
122 input.engine_num_input {
122 input.engine_num_input {
123 width: 60px;
123 width: 60px;
124 }
124 }
125
125
126 .highlight_text {
126 .highlight_text {
127 color: blue;
127 color: blue;
128 }
128 }
129
129
130 #project_name > .breadcrumb {
130 #project_name > .breadcrumb {
131 padding: 0px;
131 padding: 0px;
132 margin-bottom: 0px;
132 margin-bottom: 0px;
133 background-color: transparent;
133 background-color: transparent;
134 font-weight: bold;
134 font-weight: bold;
135
135
136 }
136 }
137
137
138 .tab-content .row {
138 .tab-content .row {
139 margin-left: 0px;
139 margin-left: 0px;
140 margin-right: 0px;
140 margin-right: 0px;
141 }
141 }
142
142
143 .folder_icon:before {
143 .folder_icon:before {
144 .icon(@folder-close-alt)
144 content: @fa-var-folder-o
145 }
145 }
146
146
147 .notebook_icon:before {
147 .notebook_icon:before {
148 .icon(@book)
148 content: @fa-var-book
149 }
149 }
General Comments 0
You need to be logged in to leave comments. Login now