##// END OF EJS Templates
Fix logic, use box where applicable
Jonathan Frederic -
Show More
@@ -11,7 +11,6 b' define(['
11 initialize: function(){
11 initialize: function(){
12 // Public constructor
12 // Public constructor
13 BoxView.__super__.initialize.apply(this, arguments);
13 BoxView.__super__.initialize.apply(this, arguments);
14 this.update_children([], this.model.get('children'));
15 this.model.on('change:children', function(model, value) {
14 this.model.on('change:children', function(model, value) {
16 this.update_children(model.previous('children'), value);
15 this.update_children(model.previous('children'), value);
17 }, this);
16 }, this);
@@ -19,8 +18,9 b' define(['
19
18
20 render: function(){
19 render: function(){
21 // Called when view is rendered.
20 // Called when view is rendered.
22 this.$box = this.$el;
21 this.$box = $el;
23 this.$el.addClass('widget-box');
22 this.$box.addClass('widget-box');
23 this.update_children([], this.model.get('children'));
24 },
24 },
25
25
26 update_children: function(old_list, new_list) {
26 update_children: function(old_list, new_list) {
@@ -64,35 +64,36 b' define(['
64 update_orientation: function(){
64 update_orientation: function(){
65 var orientation = this.model.get("orientation");
65 var orientation = this.model.get("orientation");
66 if (orientation == "vertical") {
66 if (orientation == "vertical") {
67 this.$el.removeClass("hbox").addClass("vbox");
67 this.$box.removeClass("hbox").addClass("vbox");
68 } else {
68 } else {
69 this.$el.removeClass("vbox").addClass("hbox");
69 this.$box.removeClass("vbox").addClass("hbox");
70 }
70 }
71 },
71 },
72
72
73 _flex_changed: function(){
73 _flex_changed: function(){
74 if (this.model.previous('flex')) {
74 if (this.model.previous('flex')) {
75 this.$el.removeClass('box-flex' + this.model.previous('flex'));
75 this.$box.removeClass('box-flex' + this.model.previous('flex'));
76 }
76 }
77 this.$el.addClass('box-flex' + this.model.get('flex'));
77 this.$box.addClass('box-flex' + this.model.get('flex'));
78 },
78 },
79
79
80 _pack_changed: function(){
80 _pack_changed: function(){
81 if (this.model.previous('pack')) {
81 if (this.model.previous('pack')) {
82 this.$el.removeClass(this.model.previous('pack'));
82 this.$box.removeClass(this.model.previous('pack'));
83 }
83 }
84 this.$el.addClass(this.model.get('pack'));
84 this.$box.addClass(this.model.get('pack'));
85 },
85 },
86
86
87 _align_changed: function(){
87 _align_changed: function(){
88 if (this.model.previous('align')) {
88 if (this.model.previous('align')) {
89 this.$el.removeClass('align-' + this.model.previous('align'));
89 this.$box.removeClass('align-' + this.model.previous('align'));
90 }
90 }
91 this.$el.addClass('align-' + this.model.get('align'));
91 this.$box.addClass('align-' + this.model.get('align'));
92 },
92 },
93 });
93 });
94
94
95 var PopupView = BoxView.extend({
95 var PopupView = BoxView.extend({
96
96 render: function(){
97 render: function(){
97 // Called when view is rendered.
98 // Called when view is rendered.
98 var that = this;
99 var that = this;
@@ -175,14 +176,13 b' define(['
175 this.$title = $('<div />')
176 this.$title = $('<div />')
176 .addClass('widget-modal-title')
177 .addClass('widget-modal-title')
177 .html("&nbsp;")
178 .html("&nbsp;")
178 .appendTo(this.$title_bar);
179 .appendTo(this.$title_bar);
179 this.$body = $('<div />')
180 this.$box = $('<div />')
180 .addClass('modal-body')
181 .addClass('modal-body')
181 .addClass('widget-modal-body')
182 .addClass('widget-modal-body')
182 .addClass('widget-box')
183 .addClass('widget-box')
183 .addClass('vbox')
184 .addClass('vbox')
184 .appendTo(this.$window);
185 .appendTo(this.$window);
185 this.$box = this.$body;
186
186
187 this.$show_button = $('<button />')
187 this.$show_button = $('<button />')
188 .html("&nbsp;")
188 .html("&nbsp;")
@@ -195,7 +195,7 b' define(['
195 this.$window.draggable({handle: '.popover-title', snap: '#notebook, .modal', snapMode: 'both'});
195 this.$window.draggable({handle: '.popover-title', snap: '#notebook, .modal', snapMode: 'both'});
196 this.$window.resizable();
196 this.$window.resizable();
197 this.$window.on('resize', function(){
197 this.$window.on('resize', function(){
198 that.$body.outerHeight(that.$window.innerHeight() - that.$title_bar.outerHeight());
198 that.$box.outerHeight(that.$window.innerHeight() - that.$title_bar.outerHeight());
199 });
199 });
200
200
201 this._shown_once = false;
201 this._shown_once = false;
General Comments 0
You need to be logged in to leave comments. Login now