Show More
@@ -466,19 +466,11 b' define(["widgets/js/manager",' | |||||
466 |
|
466 | |||
467 | _get_selector_element: function (selector) { |
|
467 | _get_selector_element: function (selector) { | |
468 | // Get the elements via the css selector. |
|
468 | // Get the elements via the css selector. | |
469 |
|
||||
470 | // If the selector is blank, apply the style to the $el_to_style |
|
|||
471 | // element. If the $el_to_style element is not defined, use apply |
|
|||
472 | // the style to the view's element. |
|
|||
473 | var elements; |
|
469 | var elements; | |
474 | if (!selector) { |
|
470 | if (!selector) { | |
475 | if (this.$el_to_style === undefined) { |
|
471 | elements = this.$el; | |
476 | elements = this.$el; |
|
|||
477 | } else { |
|
|||
478 | elements = this.$el_to_style; |
|
|||
479 | } |
|
|||
480 | } else { |
|
472 | } else { | |
481 | elements = this.$el.find(selector); |
|
473 | elements = this.$el.find(selector).addBack(selector); | |
482 | } |
|
474 | } | |
483 | return elements; |
|
475 | return elements; | |
484 | }, |
|
476 | }, |
@@ -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 |
@@ -158,7 +158,6 b' define([' | |||||
158 | that.$body.outerHeight(that.$window.innerHeight() - that.$title_bar.outerHeight()); |
|
158 | that.$body.outerHeight(that.$window.innerHeight() - that.$title_bar.outerHeight()); | |
159 | }); |
|
159 | }); | |
160 |
|
160 | |||
161 | this.$el_to_style = this.$body; |
|
|||
162 | this._shown_once = false; |
|
161 | this._shown_once = false; | |
163 | this.popped_out = true; |
|
162 | this.popped_out = true; | |
164 |
|
163 | |||
@@ -272,7 +271,7 b' define([' | |||||
272 | // "modal" - select the modal div |
|
271 | // "modal" - select the modal div | |
273 | // "modal [selector]" - select element(s) within the modal div. |
|
272 | // "modal [selector]" - select element(s) within the modal div. | |
274 | // "[selector]" - select elements within $el |
|
273 | // "[selector]" - select elements within $el | |
275 |
// "" - select the $el |
|
274 | // "" - select the $el | |
276 | if (selector.substring(0, 5) == 'modal') { |
|
275 | if (selector.substring(0, 5) == 'modal') { | |
277 | if (selector == 'modal') { |
|
276 | if (selector == 'modal') { | |
278 | return this.$window; |
|
277 | 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); |
@@ -392,10 +392,7 b' class DOMWidget(Widget):' | |||||
392 | selector: unicode (optional, kwarg only) |
|
392 | selector: unicode (optional, kwarg only) | |
393 | JQuery selector to use to apply the CSS key/value. If no selector |
|
393 | JQuery selector to use to apply the CSS key/value. If no selector | |
394 | is provided, an empty selector is used. An empty selector makes the |
|
394 | is provided, an empty selector is used. An empty selector makes the | |
395 |
front-end try to apply the css to |
|
395 | front-end try to apply the css to the top-level element. | |
396 | element is an attribute unique to each view, which is a DOM element |
|
|||
397 | of the view that should be styled with common CSS (see |
|
|||
398 | `$el_to_style` in the Javascript code). |
|
|||
399 | """ |
|
396 | """ | |
400 | if value is None: |
|
397 | if value is None: | |
401 | css_dict = dict_or_key |
|
398 | css_dict = dict_or_key |
General Comments 0
You need to be logged in to leave comments.
Login now