##// END OF EJS Templates
Made registered model name look like other model names
Jonathan Frederic -
Show More
@@ -1,30 +1,30 b''
1 1 require(["notebook/js/widget"], function(){
2 2 var ContainerModel = IPython.WidgetModel.extend({});
3 IPython.notebook.widget_manager.register_widget_model('container_widget', ContainerModel);
3 IPython.notebook.widget_manager.register_widget_model('ContainerWidgetModel', ContainerModel);
4 4
5 5 var ContainerView = IPython.WidgetView.extend({
6 6
7 7 render : function(){
8 8 this.$el = $('<div />')
9 9 .addClass('widget_container')
10 10 .addClass(this.model.comm.comm_id);
11 11 },
12 12
13 13 update : function(){
14 14
15 15 // Apply flexible box model properties by adding and removing
16 16 // corrosponding CSS classes.
17 17 // Defined in IPython/html/static/base/less/flexbox.less
18 18 var flex_properties = ['vbox', 'hbox', 'center', 'end', 'center'];
19 19 for (var index in flex_properties) {
20 20 if (this.model.get('_' + flex_properties[index])) {
21 21 this.$el.addClass(flex_properties[index]);
22 22 } else {
23 23 this.$el.removeClass(flex_properties[index]);
24 24 }
25 25 }
26 26 },
27 27 });
28 28
29 29 IPython.notebook.widget_manager.register_widget_view('ContainerView', ContainerView);
30 30 }); No newline at end of file
@@ -1,42 +1,42 b''
1 1 from widget import Widget
2 2 from IPython.utils.traitlets import Unicode, Bool
3 3
4 4 class ContainerWidget(Widget):
5 target_name = Unicode('container_widget')
5 target_name = Unicode('ContainerWidgetModel')
6 6 default_view_name = Unicode('ContainerView')
7 7 _keys = ['_vbox', '_hbox', '_start', '_end', '_center']
8 8 _trait_changing = False
9 9
10 10 _hbox = Bool(False)
11 11 _vbox = Bool(False)
12 12 _start = Bool(False)
13 13 _end = Bool(False)
14 14 _center = Bool(False)
15 15
16 16 def hbox(self, enabled=True):
17 17 self._hbox = enabled
18 18 if enabled:
19 19 self._vbox = False
20 20
21 21 def vbox(self, enabled=True):
22 22 self._vbox = enabled
23 23 if enabled:
24 24 self._hbox = False
25 25
26 26 def start(self, enabled=True):
27 27 self._start = enabled
28 28 if enabled:
29 29 self._end = False
30 30 self._center = False
31 31
32 32 def end(self, enabled=True):
33 33 self._end = enabled
34 34 if enabled:
35 35 self._start = False
36 36 self._center = False
37 37
38 38 def center(self, enabled=True):
39 39 self._center = enabled
40 40 if enabled:
41 41 self._start = False
42 42 self._end = False
General Comments 0
You need to be logged in to leave comments. Login now