##// END OF EJS Templates
Merge pull request #6226 from jasongrout/css-top-default...
Jonathan Frederic -
r17559:802e00b9 merge
parent child Browse files
Show More
@@ -463,19 +463,11 b' define(["widgets/js/manager",'
463
463
464 _get_selector_element: function (selector) {
464 _get_selector_element: function (selector) {
465 // Get the elements via the css selector.
465 // Get the elements via the css selector.
466
467 // If the selector is blank, apply the style to the $el_to_style
468 // element. If the $el_to_style element is not defined, use apply
469 // the style to the view's element.
470 var elements;
466 var elements;
471 if (!selector) {
467 if (!selector) {
472 if (this.$el_to_style === undefined) {
468 elements = this.$el;
473 elements = this.$el;
474 } else {
475 elements = this.$el_to_style;
476 }
477 } else {
469 } else {
478 elements = this.$el.find(selector);
470 elements = this.$el.find(selector).addBack(selector);
479 }
471 }
480 return elements;
472 return elements;
481 },
473 },
@@ -21,7 +21,6 b' define(['
21 .appendTo(this.$el)
21 .appendTo(this.$el)
22 .click($.proxy(this.handle_click, this));
22 .click($.proxy(this.handle_click, this));
23
23
24 this.$el_to_style = this.$checkbox; // Set default element to style
25 this.update(); // Set defaults.
24 this.update(); // Set defaults.
26 },
25 },
27
26
@@ -152,7 +152,6 b' define(['
152 that.$body.outerHeight(that.$window.innerHeight() - that.$title_bar.outerHeight());
152 that.$body.outerHeight(that.$window.innerHeight() - that.$title_bar.outerHeight());
153 });
153 });
154
154
155 this.$el_to_style = this.$body;
156 this._shown_once = false;
155 this._shown_once = false;
157 this.popped_out = true;
156 this.popped_out = true;
158
157
@@ -264,7 +263,7 b' define(['
264 // "modal" - select the modal div
263 // "modal" - select the modal div
265 // "modal [selector]" - select element(s) within the modal div.
264 // "modal [selector]" - select element(s) within the modal div.
266 // "[selector]" - select elements within $el
265 // "[selector]" - select elements within $el
267 // "" - select the $el_to_style
266 // "" - select the $el
268 if (selector.substring(0, 5) == 'modal') {
267 if (selector.substring(0, 5) == 'modal') {
269 if (selector == 'modal') {
268 if (selector == 'modal') {
270 return this.$window;
269 return this.$window;
@@ -24,7 +24,6 b' define(['
24 this.$slider_container = $('<div />')
24 this.$slider_container = $('<div />')
25 .addClass('widget-hslider')
25 .addClass('widget-hslider')
26 .append(this.$slider);
26 .append(this.$slider);
27 this.$el_to_style = this.$slider_container; // Set default element to style
28 this.$el.append(this.$slider_container);
27 this.$el.append(this.$slider_container);
29
28
30 this.$readout = $('<div/>')
29 this.$readout = $('<div/>')
@@ -158,7 +157,6 b' define(['
158 .addClass('form-control')
157 .addClass('form-control')
159 .addClass('widget-numeric-text')
158 .addClass('widget-numeric-text')
160 .appendTo(this.$el);
159 .appendTo(this.$el);
161 this.$el_to_style = this.$textbox; // Set default element to style
162 this.update(); // Set defaults.
160 this.update(); // Set defaults.
163 },
161 },
164
162
@@ -262,7 +260,6 b' define(['
262 .addClass('progress')
260 .addClass('progress')
263 .addClass('widget-progress')
261 .addClass('widget-progress')
264 .appendTo(this.$el);
262 .appendTo(this.$el);
265 this.$el_to_style = this.$progress; // Set default element to style
266 this.$bar = $('<div />')
263 this.$bar = $('<div />')
267 .addClass('progress-bar')
264 .addClass('progress-bar')
268 .css('width', '50%')
265 .css('width', '50%')
@@ -21,7 +21,6 b' define(['
21 .addClass('widget_item')
21 .addClass('widget_item')
22 .addClass('btn-group')
22 .addClass('btn-group')
23 .appendTo(this.$el);
23 .appendTo(this.$el);
24 this.$el_to_style = this.$buttongroup; // Set default element to style
25 this.$droplabel = $('<button />')
24 this.$droplabel = $('<button />')
26 .addClass('btn btn-default')
25 .addClass('btn btn-default')
27 .addClass('widget-combo-btn')
26 .addClass('widget-combo-btn')
@@ -119,7 +118,6 b' define(['
119 this.$container = $('<div />')
118 this.$container = $('<div />')
120 .appendTo(this.$el)
119 .appendTo(this.$el)
121 .addClass('widget-radio-box');
120 .addClass('widget-radio-box');
122 this.$el_to_style = this.$container; // Set default element to style
123 this.update();
121 this.update();
124 },
122 },
125
123
@@ -210,7 +208,6 b' define(['
210 .addClass('btn-group')
208 .addClass('btn-group')
211 .attr('data-toggle', 'buttons-radio')
209 .attr('data-toggle', 'buttons-radio')
212 .appendTo(this.$el);
210 .appendTo(this.$el);
213 this.$el_to_style = this.$buttongroup; // Set default element to style
214 this.update();
211 this.update();
215 },
212 },
216
213
@@ -302,7 +299,6 b' define(['
302 .addClass('widget-listbox form-control')
299 .addClass('widget-listbox form-control')
303 .attr('size', 6)
300 .attr('size', 6)
304 .appendTo(this.$el);
301 .appendTo(this.$el);
305 this.$el_to_style = this.$listbox; // Set default element to style
306 this.update();
302 this.update();
307 },
303 },
308
304
@@ -56,7 +56,6 b' define(['
56 .attr('rows', 5)
56 .attr('rows', 5)
57 .addClass('widget-text form-control')
57 .addClass('widget-text form-control')
58 .appendTo(this.$el);
58 .appendTo(this.$el);
59 this.$el_to_style = this.$textbox; // Set default element to style
60 this.update(); // Set defaults.
59 this.update(); // Set defaults.
61
60
62 this.model.on('msg:custom', $.proxy(this._handle_textarea_msg, this));
61 this.model.on('msg:custom', $.proxy(this._handle_textarea_msg, this));
@@ -140,7 +139,6 b' define(['
140 .addClass('input')
139 .addClass('input')
141 .addClass('widget-text form-control')
140 .addClass('widget-text form-control')
142 .appendTo(this.$el);
141 .appendTo(this.$el);
143 this.$el_to_style = this.$textbox; // Set default element to style
144 this.update(); // Set defaults.
142 this.update(); // Set defaults.
145 this.model.on('change:placeholder', function(model, value, options) {
143 this.model.on('change:placeholder', function(model, value, options) {
146 this.update_placeholder(value);
144 this.update_placeholder(value);
@@ -149,7 +149,7 b' casper.notebook_test(function () {'
149 'import time\n' +
149 'import time\n' +
150 'textbox = widgets.TextWidget()\n' +
150 'textbox = widgets.TextWidget()\n' +
151 'display(textbox)\n' +
151 'display(textbox)\n' +
152 'textbox.add_class("my-throttle-textbox")\n' +
152 'textbox.add_class("my-throttle-textbox", selector="input")\n' +
153 'def handle_change(name, old, new):\n' +
153 'def handle_change(name, old, new):\n' +
154 ' display(len(new))\n' +
154 ' display(len(new))\n' +
155 ' time.sleep(0.5)\n' +
155 ' time.sleep(0.5)\n' +
@@ -11,7 +11,7 b' casper.notebook_test(function () {'
11 float_text.index = this.append_cell(
11 float_text.index = this.append_cell(
12 'float_widget = widgets.FloatTextWidget()\n' +
12 'float_widget = widgets.FloatTextWidget()\n' +
13 'display(float_widget)\n' +
13 'display(float_widget)\n' +
14 'float_widget.add_class("my-second-float-text")\n' +
14 'float_widget.add_class("my-second-float-text", selector="input")\n' +
15 'print(float_widget.model_id)\n');
15 'print(float_widget.model_id)\n');
16 this.execute_cell_then(float_text.index, function(index){
16 this.execute_cell_then(float_text.index, function(index){
17 float_text.model_id = this.get_output_cell(index).text.trim();
17 float_text.model_id = this.get_output_cell(index).text.trim();
@@ -6,12 +6,12 b' casper.notebook_test(function () {'
6 'print("Success")');
6 'print("Success")');
7 this.execute_cell_then(index);
7 this.execute_cell_then(index);
8
8
9 var int_text = {}
9 var int_text = {};
10 int_text.query = '.widget-area .widget-subarea .widget-hbox-single .my-second-int-text';
10 int_text.query = '.widget-area .widget-subarea .widget-hbox-single .my-second-int-text';
11 int_text.index = this.append_cell(
11 int_text.index = this.append_cell(
12 'int_widget = widgets.IntTextWidget()\n' +
12 'int_widget = widgets.IntTextWidget()\n' +
13 'display(int_widget)\n' +
13 'display(int_widget)\n' +
14 'int_widget.add_class("my-second-int-text")\n' +
14 'int_widget.add_class("my-second-int-text", selector="input")\n' +
15 'print(int_widget.model_id)\n');
15 'print(int_widget.model_id)\n');
16 this.execute_cell_then(int_text.index, function(index){
16 this.execute_cell_then(int_text.index, function(index){
17 int_text.model_id = this.get_output_cell(index).text.trim();
17 int_text.model_id = this.get_output_cell(index).text.trim();
@@ -69,7 +69,7 b' casper.notebook_test(function () {'
69 'intrange = [widgets.BoundedIntTextWidget(),\n' +
69 'intrange = [widgets.BoundedIntTextWidget(),\n' +
70 ' widgets.IntSliderWidget()]\n' +
70 ' widgets.IntSliderWidget()]\n' +
71 '[display(intrange[i]) for i in range(2)]\n' +
71 '[display(intrange[i]) for i in range(2)]\n' +
72 'intrange[0].add_class("my-second-num-test-text")\n' +
72 'intrange[0].add_class("my-second-num-test-text", selector="input")\n' +
73 'print(intrange[0].model_id)\n');
73 'print(intrange[0].model_id)\n');
74 this.execute_cell_then(int_text2.index, function(index){
74 this.execute_cell_then(int_text2.index, function(index){
75 int_text2.model_id = this.get_output_cell(index).text.trim();
75 int_text2.model_id = this.get_output_cell(index).text.trim();
@@ -388,10 +388,7 b' class DOMWidget(Widget):'
388 selector: unicode (optional, kwarg only)
388 selector: unicode (optional, kwarg only)
389 JQuery selector to use to apply the CSS key/value. If no selector
389 JQuery selector to use to apply the CSS key/value. If no selector
390 is provided, an empty selector is used. An empty selector makes the
390 is provided, an empty selector is used. An empty selector makes the
391 front-end try to apply the css to a default element. The default
391 front-end try to apply the css to the top-level element.
392 element is an attribute unique to each view, which is a DOM element
393 of the view that should be styled with common CSS (see
394 `$el_to_style` in the Javascript code).
395 """
392 """
396 if value is None:
393 if value is None:
397 css_dict = dict_or_key
394 css_dict = dict_or_key
General Comments 0
You need to be logged in to leave comments. Login now