sproutcore 1.0.1009 → 1.0.1024

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/DISTRIBUTION.yml +14 -0
  2. data/Rakefile +150 -23
  3. data/VERSION.yml +4 -2
  4. data/frameworks/sproutcore/Buildfile +1 -1
  5. data/frameworks/sproutcore/frameworks/bootstrap/system/loader.js +1 -0
  6. data/frameworks/sproutcore/frameworks/datastore/models/record.js +66 -5
  7. data/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +14 -0
  8. data/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +28 -3
  9. data/frameworks/sproutcore/frameworks/desktop/english.lproj/alert.css +1 -1
  10. data/frameworks/sproutcore/frameworks/desktop/english.lproj/menu_item_view.css +22 -2
  11. data/frameworks/sproutcore/frameworks/desktop/english.lproj/panel.css +5 -1
  12. data/frameworks/sproutcore/frameworks/desktop/english.lproj/well.css +72 -0
  13. data/frameworks/sproutcore/frameworks/desktop/panes/alert.js +1 -1
  14. data/frameworks/sproutcore/frameworks/desktop/panes/picker.js +1 -1
  15. data/frameworks/sproutcore/frameworks/desktop/panes/select_button.js +33 -7
  16. data/frameworks/sproutcore/frameworks/desktop/system/root_responder.js +24 -23
  17. data/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_alternatingrows.js +130 -0
  18. data/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_row_heights.js +9 -10
  19. data/frameworks/sproutcore/frameworks/desktop/tests/views/list_item.js +4 -0
  20. data/frameworks/sproutcore/frameworks/desktop/tests/views/progress/ui.js +18 -9
  21. data/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/methods.js +7 -6
  22. data/frameworks/sproutcore/frameworks/desktop/tests/views/well/ui.js +54 -0
  23. data/frameworks/sproutcore/frameworks/desktop/views/button.js +21 -9
  24. data/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +4 -3
  25. data/frameworks/sproutcore/frameworks/desktop/views/collection.js +1 -1
  26. data/frameworks/sproutcore/frameworks/desktop/views/grid.js +23 -14
  27. data/frameworks/sproutcore/frameworks/desktop/views/list_item.js +2 -2
  28. data/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +3 -3
  29. data/frameworks/sproutcore/frameworks/desktop/views/radio.js +1 -2
  30. data/frameworks/sproutcore/frameworks/desktop/views/scroll.js +1 -1
  31. data/frameworks/sproutcore/frameworks/desktop/views/segmented.js +1 -1
  32. data/frameworks/sproutcore/frameworks/desktop/views/slider.js +1 -1
  33. data/frameworks/sproutcore/frameworks/desktop/views/source_list_group.js +1 -1
  34. data/frameworks/sproutcore/frameworks/desktop/views/well.js +80 -0
  35. data/frameworks/sproutcore/frameworks/foundation/fixtures/malformed.json +11 -0
  36. data/frameworks/sproutcore/frameworks/foundation/mixins/button.js +1 -1
  37. data/frameworks/sproutcore/frameworks/foundation/mixins/inline_text_field.js +5 -1
  38. data/frameworks/sproutcore/frameworks/foundation/panes/pane.js +1 -1
  39. data/frameworks/sproutcore/frameworks/foundation/system/cursor.js +11 -10
  40. data/frameworks/sproutcore/frameworks/foundation/system/event.js +16 -15
  41. data/frameworks/sproutcore/frameworks/foundation/system/render_context.js +3 -3
  42. data/frameworks/sproutcore/frameworks/foundation/system/request.js +6 -5
  43. data/frameworks/sproutcore/frameworks/foundation/system/response.js +26 -8
  44. data/frameworks/sproutcore/frameworks/foundation/system/root_responder.js +2 -2
  45. data/frameworks/sproutcore/frameworks/foundation/system/timer.js +2 -2
  46. data/frameworks/sproutcore/frameworks/foundation/system/utils.js +122 -13
  47. data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/jquery_core.js +2 -3
  48. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/tag.js +9 -9
  49. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/update.js +3 -3
  50. data/frameworks/sproutcore/frameworks/foundation/tests/system/request.js +27 -0
  51. data/frameworks/sproutcore/frameworks/foundation/tests/system/utils/rect.js +99 -0
  52. data/frameworks/sproutcore/frameworks/foundation/tests/views/image/ui.js +1 -1
  53. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/updateLayer.js +1 -1
  54. data/frameworks/sproutcore/frameworks/foundation/views/image.js +3 -1
  55. data/frameworks/sproutcore/frameworks/foundation/views/label.js +1 -1
  56. data/frameworks/sproutcore/frameworks/runtime/system/cookie.js +160 -0
  57. data/frameworks/sproutcore/frameworks/runtime/system/object.js +1 -1
  58. data/frameworks/sproutcore/frameworks/runtime/tests/system/cookie.js +163 -0
  59. data/frameworks/sproutcore/themes/standard_theme/english.lproj/pane.css +12 -2
  60. data/lib/sproutcore/rack/proxy.rb +4 -2
  61. data/sproutcore-abbot.gemspec +23 -9
  62. metadata +32 -5
  63. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/standard_fade/000000.png +0 -0
  64. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/standard_fade/ffffff.png +0 -0
@@ -37,7 +37,7 @@ var ContentArray = SC.Object.extend(SC.Array, {
37
37
 
38
38
  var pane = SC.ControlTestPane.design()
39
39
  .add("Custom Row Heights", SC.ScrollView.design({
40
- layout: { left: 0, right: 0, top: 0, height: 500 },
40
+ layout: { left: 0, right: 0, top: 0, height: 200 },
41
41
  hasHorizontalScroller: NO,
42
42
  contentView: SC.ListView.design({
43
43
  content: ContentArray.create({ length: 100001 }),
@@ -45,7 +45,7 @@ var pane = SC.ControlTestPane.design()
45
45
 
46
46
  // used for testing
47
47
  adjustableRows: SC.IndexSet.create(0,5),
48
- altRowHeight: 40,
48
+ altRowHeight: 10,
49
49
 
50
50
  contentIndexRowHeight: function(view, content, index) {
51
51
  var ret =this.get('rowHeight');
@@ -91,8 +91,7 @@ module("SC.ListView - ui_row_heights", pane.standardSetup());
91
91
 
92
92
  test("rendering only incremental portion", function() {
93
93
  var listView = pane.view("Custom Row Heights").contentView;
94
-
95
- same(listView.get("nowShowing"), SC.IndexSet.create(0, 21), 'nowShowing should be smaller IndexSet');
94
+ same(listView.get("nowShowing"), SC.IndexSet.create(0, 10), 'nowShowing should be smaller IndexSet');
96
95
  equals(listView.get('childViews').length, listView.get('nowShowing').get('length'), 'should have same number of childViews as nowShowing length');
97
96
  });
98
97
 
@@ -101,7 +100,7 @@ test("scrolling by small amount should update incremental rendering", function()
101
100
  listView = scrollView.contentView,
102
101
  exp;
103
102
 
104
- same(listView.get('nowShowing'), SC.IndexSet.create(0,21), 'precond - nowShowing has incremental range');
103
+ same(listView.get('nowShowing'), SC.IndexSet.create(0,10), 'precond - nowShowing has incremental range');
105
104
 
106
105
  // SCROLL DOWN ONE LINE
107
106
  SC.run(function() {
@@ -109,7 +108,7 @@ test("scrolling by small amount should update incremental rendering", function()
109
108
  });
110
109
 
111
110
  // top line should have scrolled out of view
112
- exp = SC.IndexSet.create(2,22);
111
+ exp = SC.IndexSet.create(4,9);
113
112
  same(listView.get('nowShowing'), exp, 'nowShowing should change to reflect new clippingFrame');
114
113
 
115
114
  verifyChildViewsMatch(listView.childViews, exp);
@@ -120,7 +119,7 @@ test("scrolling by small amount should update incremental rendering", function()
120
119
  });
121
120
 
122
121
  // top line should have scrolled out of view
123
- exp = SC.IndexSet.create(3,22);
122
+ exp = SC.IndexSet.create(6,8);
124
123
  same(listView.get('nowShowing'), exp, 'nowShowing should change to reflect new clippingFrame');
125
124
 
126
125
  verifyChildViewsMatch(listView.childViews, exp);
@@ -132,7 +131,7 @@ test("scrolling by small amount should update incremental rendering", function()
132
131
  });
133
132
 
134
133
  // top line should have scrolled out of view
135
- exp = SC.IndexSet.create(2,22);
134
+ exp = SC.IndexSet.create(4,9);
136
135
  same(listView.get('nowShowing'), exp, 'nowShowing should change to reflect new clippingFrame');
137
136
 
138
137
  verifyChildViewsMatch(listView.childViews, exp);
@@ -148,7 +147,7 @@ test("manually calling rowHeightDidChangeForIndexes()", function() {
148
147
  listView = scrollView.contentView,
149
148
  exp;
150
149
 
151
- same(listView.get('nowShowing'), SC.IndexSet.create(0,21), 'precond - nowShowing has incremental range');
150
+ same(listView.get('nowShowing'), SC.IndexSet.create(0,10), 'precond - nowShowing has incremental range');
152
151
 
153
152
  // adjust row height and then invalidate a portion range
154
153
  SC.run(function() {
@@ -157,7 +156,7 @@ test("manually calling rowHeightDidChangeForIndexes()", function() {
157
156
  });
158
157
 
159
158
  // nowShowing should adjust
160
- same(listView.get('nowShowing'), SC.IndexSet.create(0,15), 'visible range should decrease since row heights for some rows doubled');
159
+ same(listView.get('nowShowing'), SC.IndexSet.create(0,5), 'visible range should decrease since row heights for some rows doubled');
161
160
 
162
161
  // as well as offset and heights for rows - spot check
163
162
  var view = listView.itemViewForContentIndex(3);
@@ -127,6 +127,10 @@ function basic(view, sel, disabled) {
127
127
 
128
128
  equals(cq.hasClass('sel'), !!sel, 'expect sel class');
129
129
  equals(cq.hasClass('disabled'), !!disabled, 'expect disabled class');
130
+
131
+ var idx = view.get('contentIndex');
132
+ var evenOrOdd = (idx % 2 == 0) ? 'even' : 'odd';
133
+ ok(cq.hasClass(evenOrOdd), 'should have an %@ class'.fmt(evenOrOdd));
130
134
  }
131
135
 
132
136
  function label(view, labelText) {
@@ -12,27 +12,32 @@ htmlbody('<style> .sc-static-layout { border: 1px red dotted; } </style>');
12
12
  var pane = SC.ControlTestPane.design()
13
13
 
14
14
  .add("progress basic", SC.ProgressView, {
15
+ layout: {top:0, bottom:0, left:0, width: 250},
15
16
  value: 25,
16
17
  minimum: 0,
17
18
  maximum: 100
18
19
  })
19
20
  .add("progress disabled", SC.ProgressView, {
21
+ layout: {top:0, bottom:0, left:0, width: 250},
20
22
  value: 25,
21
23
  minimum: 0,
22
24
  maximum: 100,
23
25
  isEnabled: NO
24
26
  })
25
27
  .add("progress basic value 0", SC.ProgressView, {
28
+ layout: {top:0, bottom:0, left:0, width: 250},
26
29
  value: 0,
27
30
  minimum: 0,
28
31
  maximum: 100
29
32
  })
30
33
  .add("progress basic value 100", SC.ProgressView, {
34
+ layout: {top:0, bottom:0, left:0, width: 250},
31
35
  value: 100,
32
36
  minimum: 0,
33
37
  maximum: 100
34
38
  })
35
39
  .add("progress basic max 50", SC.ProgressView, {
40
+ layout: {top:0, bottom:0, left:0, width: 250},
36
41
  value: 25,
37
42
  minimum: 0,
38
43
  maximum: 50
@@ -40,22 +45,26 @@ var pane = SC.ControlTestPane.design()
40
45
 
41
46
  // Slider View UI
42
47
  .add("slider basic", SC.SliderView, {
48
+ layout: {top:0, bottom:0, left:0, width: 250},
43
49
  value: 50,
44
50
  minimum: 0,
45
51
  maximum: 100
46
52
  })
47
53
  .add("slider disabled", SC.SliderView, {
54
+ layout: {top:0, bottom:0, left:0, width: 250},
48
55
  value: 50,
49
56
  minimum: 0,
50
57
  maximum: 100,
51
58
  isEnabled: NO
52
59
  })
53
60
  .add("slider value 100", SC.SliderView, {
61
+ layout: {top:0, bottom:0, left:0, width: 250},
54
62
  value: 100,
55
63
  minimum: 0,
56
64
  maximum: 100
57
65
  })
58
66
  .add("slider basic step 20", SC.SliderView, {
67
+ layout: {top:0, bottom:0, left:0, width: 250},
59
68
  value: 50,
60
69
  minimum: 0,
61
70
  maximum: 100,
@@ -82,7 +91,7 @@ test("basic", function() {
82
91
  equals(view.$('.sc-inner').css("width"), "25%", 'width should be 25%');
83
92
 
84
93
  // browsers compute the width after % adjustment differently. just be close
85
- var v = (SC.browser.msie || SC.browser.mozilla) ? 85 : 84;
94
+ var v = (SC.browser.msie || SC.browser.mozilla) ? 63 : 62;
86
95
  equals(view.$('.sc-inner').width(), v, 'pixel width ');
87
96
 
88
97
  });
@@ -116,7 +125,7 @@ test("basic value 100", function() {
116
125
  ok(!view.$().hasClass('disabled'), 'should NOT have disabled class');
117
126
  ok(view.$('.sc-inner'), 'should have sc-inner class');
118
127
  equals(view.$('.sc-inner').css("width"), "100%", 'width should be 100%');
119
- equals(view.$('.sc-inner').width(), 338, 'pixel width ');
128
+ equals(view.$('.sc-inner').width(), 250, 'pixel width ');
120
129
 
121
130
  });
122
131
 
@@ -127,7 +136,7 @@ test("basic max 50", function() {
127
136
  ok(!view.$().hasClass('disabled'), 'should NOT have disabled class');
128
137
  ok(view.$('.sc-inner'), 'should have sc-inner class');
129
138
  equals(view.$('.sc-inner').css("width"), "50%", 'width should be 50%');
130
- equals(view.$('.sc-inner').width(), 169, 'pixel width ');
139
+ equals(view.$('.sc-inner').width(), 125, 'pixel width ');
131
140
 
132
141
  });
133
142
 
@@ -143,13 +152,13 @@ test("changing value from empty -> value", function() {
143
152
  view.set('value', 50);
144
153
  SC.RunLoop.end();
145
154
  equals(view.$('.sc-inner').css("width"), "50%", 'width should be 50%');
146
- equals(view.$('.sc-inner').width(), 169, 'pixel width ');
155
+ equals(view.$('.sc-inner').width(), 125, 'pixel width ');
147
156
  });
148
157
 
149
158
  test("changing value from full -> empty", function() {
150
159
  var view = pane.view('progress basic value 100');
151
160
 
152
- equals(view.$('.sc-inner').width(), 338, 'precon - pixel width should be 316');
161
+ equals(view.$('.sc-inner').width(), 250, 'precon - pixel width should be 316');
153
162
  SC.RunLoop.begin();
154
163
  view.set('value', 0);
155
164
  SC.RunLoop.end();
@@ -165,7 +174,7 @@ test("changing value from full -> negative number", function() {
165
174
  view.set('value', 100);
166
175
  SC.RunLoop.end();
167
176
 
168
- equals(view.$('.sc-inner').width(), 338, 'precon - pixel width should be 338');
177
+ equals(view.$('.sc-inner').width(), 250, 'precon - pixel width should be 338');
169
178
  SC.RunLoop.begin();
170
179
  view.set('value', -10);
171
180
  SC.RunLoop.end();
@@ -177,13 +186,13 @@ test("changing value to over maximum", function() {
177
186
  var view = pane.view('progress basic');
178
187
 
179
188
  // browsers compute the width after % adjustment differently. just be close
180
- var v = (SC.browser.msie || SC.browser.mozilla) ? 85 : 84;
189
+ var v = (SC.browser.msie || SC.browser.mozilla) ? 63 : 62;
181
190
  equals(view.$('.sc-inner').width(), v, 'precon - pixel width should be fixed');
182
191
  SC.RunLoop.begin();
183
192
  view.set('value', 110);
184
193
  SC.RunLoop.end();
185
194
  equals(view.$('.sc-inner').css("width"), "100%", 'width should be 100%');
186
- equals(view.$('.sc-inner').width(), 338, 'pixel width ');
195
+ equals(view.$('.sc-inner').width(), 250, 'pixel width ');
187
196
  });
188
197
 
189
198
  test("changing value to a string", function() {
@@ -193,7 +202,7 @@ test("changing value to a string", function() {
193
202
  view.set('value', 25);
194
203
  SC.RunLoop.end();
195
204
 
196
- var v = (SC.browser.msie || SC.browser.mozilla) ? 85 : 84;
205
+ var v = (SC.browser.msie || SC.browser.mozilla) ? 63 : 62;
197
206
  equals(view.$('.sc-inner').width(), v, 'precon - pixel width should be fixed');
198
207
  SC.RunLoop.begin();
199
208
  view.set('value', 'aString');
@@ -114,29 +114,30 @@ test("maximumHorizontalScrollOffset() returns the maximum horizontal scroll dime
114
114
 
115
115
  view2.set('horizontalScrollOffset',old_horizontalScrollOffset);
116
116
  view2.set('verticalScrollOffset',old_verticalScrollOffset);
117
- view2.scrollRightPage(3);
117
+ view2.scrollBy(5000, 0);
118
+ view2.get('horizontalScrollOffset');
119
+
118
120
  equals(view2.get('horizontalScrollOffset'),1900, 'maximum y coordinate should be 1900');
119
121
 
120
122
  view2.set('horizontalScrollOffset',old_horizontalScrollOffset);
121
123
  view2.set('verticalScrollOffset',old_verticalScrollOffset);
122
- view2.scrollLeftPage(3);
124
+ view2.scrollBy(-5000,0);
123
125
  equals(view2.get('horizontalScrollOffset'),0, 'minimum y coordinate should be 0');
124
126
 
125
127
  });
126
128
 
127
-
128
129
  test("maximumVerticalScrollOffset() returns the maximum vertical scroll dimention", function() {
129
130
  var old_horizontalScrollOffset=2;
130
131
  var old_verticalScrollOffset=2;
131
132
 
132
133
  view2.set('horizontalScrollOffset',old_horizontalScrollOffset);
133
134
  view2.set('verticalScrollOffset',old_verticalScrollOffset);
134
- view2.scrollDownPage(3);
135
+ view2.scrollBy(0, 5000);
136
+ view2.get('maximumVerticalScrollOffset');
135
137
  equals(view2.get('verticalScrollOffset'),1900, 'maximum coordinate should be 1900');
136
-
137
138
  view2.set('horizontalScrollOffset',old_horizontalScrollOffset);
138
139
  view2.set('verticalScrollOffset',old_verticalScrollOffset);
139
- view2.scrollUpPage(3);
140
+ view2.scrollBy(0,-5000);
140
141
  equals(view2.get('verticalScrollOffset'),0, 'The minimum y coordinate should be 0');
141
142
 
142
143
  });
@@ -0,0 +1,54 @@
1
+ // ==========================================================================
2
+ // Project: SproutCore - JavaScript Application Framework
3
+ // Copyright: ©2006-2009 Sprout Systems, Inc. and contributors.
4
+ // portions copyright @2009 Apple Inc.
5
+ // License: Licened under MIT license (see license.js)
6
+ // ==========================================================================
7
+
8
+ /*global module test htmlbody ok equals same stop start */
9
+
10
+ var iconURL= "http://www.freeiconsweb.com/Icons/16x16_people_icons/People_046.gif";
11
+ var pane, view;
12
+ module("SC.TabView", {
13
+ setup: function() {
14
+ SC.RunLoop.begin();
15
+ pane = SC.MainPane.create({
16
+ childViews: [
17
+ SC.TabView.extend({
18
+ nowShowing: 'tab2',
19
+
20
+ items: [
21
+ { title: "tab1", value: "tab1" , icon: iconURL},
22
+ { title: "tab2", value: "tab2" , icon: iconURL},
23
+ { title: "tab3", value: "tab3" , icon: iconURL}
24
+ ],
25
+
26
+ itemTitleKey: 'title',
27
+ itemValueKey: 'value',
28
+ itemIconKey: 'icon',
29
+ layout: { left:12, height: 200, right:12, top:12 }
30
+
31
+ })]
32
+ });
33
+ pane.append(); // make sure there is a layer...
34
+ SC.RunLoop.end();
35
+
36
+ view = pane.childViews[0];
37
+ },
38
+
39
+ teardown: function() {
40
+ pane.remove();
41
+ pane = view = null ;
42
+ }
43
+ });
44
+
45
+ test("Check that all segmentedViews are visible", function() {
46
+ ok(true, 'hello');
47
+ });
48
+
49
+
50
+ //_tab_nowShowingDidChange: function() {
51
+
52
+ //_tab_saveUserDefault: function() {
53
+
54
+ //_tab_itemsDidChange: function() {
@@ -165,14 +165,15 @@ SC.ButtonView = SC.View.extend(SC.Control, SC.Button, SC.StaticLayout,
165
165
 
166
166
  render: function(context, firstTime) {
167
167
  // add href attr if tagName is anchor...
168
+ var href, toolTip, classes;
168
169
  if (this.get('tagName') === 'a') {
169
- var href = this.get('href');
170
+ href = this.get('href');
170
171
  if (!href || (href.length === 0)) href = "javascript"+":;";
171
172
  context.attr('href', href);
172
173
  }
173
174
 
174
175
  // If there is a toolTip set, grab it and localize if necessary.
175
- var toolTip = this.get('toolTip') ;
176
+ toolTip = this.get('toolTip') ;
176
177
  if (SC.typeOf(toolTip) === SC.T_STRING) {
177
178
  if (this.get('localize')) toolTip = toolTip.loc() ;
178
179
  context.attr('title', toolTip) ;
@@ -180,7 +181,7 @@ SC.ButtonView = SC.View.extend(SC.Control, SC.Button, SC.StaticLayout,
180
181
  }
181
182
 
182
183
  // add some standard attributes & classes.
183
- var classes = this._TEMPORARY_CLASS_HASH;
184
+ classes = this._TEMPORARY_CLASS_HASH;
184
185
  classes.def = this.get('isDefault');
185
186
  classes.cancel = this.get('isCancel');
186
187
  classes.icon = !!this.get('icon');
@@ -188,8 +189,8 @@ SC.ButtonView = SC.View.extend(SC.Control, SC.Button, SC.StaticLayout,
188
189
  .setClass(classes).addClass(this.get('theme'));
189
190
  // render inner html
190
191
  if(firstTime){
191
- context = context.push("<span class='sc-button-inner' style = 'min-width:%@px'>"
192
- .fmt(this.get('titleMinWidth')));
192
+ context = context.push("<span class='sc-button-inner' style = 'min-width:%@px'>"
193
+ .fmt(this.get('titleMinWidth')));
193
194
  this.renderTitle(context, firstTime) ; // from button mixin
194
195
  context.push("</span>") ;
195
196
  }else{
@@ -204,8 +205,8 @@ SC.ButtonView = SC.View.extend(SC.Control, SC.Button, SC.StaticLayout,
204
205
  Whenever the isDefault or isCancel property changes, update the display and change the keyEquivalent.
205
206
  */
206
207
  _isDefaultOrCancelDidChange: function() {
207
- var isDef = !!this.get('isDefault') ;
208
- var isCancel = !isDef && this.get('isCancel') ;
208
+ var isDef = !!this.get('isDefault'),
209
+ isCancel = !isDef && this.get('isCancel') ;
209
210
 
210
211
  if(this.didChangeFor('defaultCancelChanged','isDefault','isCancel')) {
211
212
  this.displayDidChange() ; // make sure to update the UI
@@ -317,8 +318,8 @@ SC.ButtonView = SC.View.extend(SC.Control, SC.Button, SC.StaticLayout,
317
318
  // otherwise, just trigger an action if there is one.
318
319
  default:
319
320
  //if (this.action) this.action(evt);
320
- var action = this.get('action');
321
- var target = this.get('target') || null;
321
+ var action = this.get('action'),
322
+ target = this.get('target') || null;
322
323
  if (action) {
323
324
  if (this._hasLegacyActionHandler()) {
324
325
  // old school...
@@ -371,6 +372,17 @@ SC.ButtonView = SC.View.extend(SC.Control, SC.Button, SC.StaticLayout,
371
372
 
372
373
  willLoseKeyResponderTo: function(responder) {
373
374
  if (this._isFocused) this._isFocused = NO ;
375
+ },
376
+
377
+ didCreateLayer: function() {
378
+ //Fix for IE7 min-with bug
379
+ if(SC.browser.msie<8) {
380
+ var buttonInner = this.$('.sc-button-inner')[0];
381
+ if (buttonInner){
382
+ var mL = buttonInner.style.marginLeft;
383
+ this.$('.sc-button-label')[0].style.minWidth=this.get('titleMinWidth')-mL;
384
+ }
385
+ }
374
386
  }
375
387
 
376
388
  }) ;
@@ -34,10 +34,11 @@ SC.CheckboxView = SC.FieldView.extend(SC.StaticLayout, SC.Button,
34
34
  if (firstTime) {
35
35
  dt = this._field_currentDisplayTitle = this.get('displayTitle');
36
36
 
37
- var blank = sc_static('blank');
37
+ var blank = SC.BLANK_IMAGE_URL;
38
38
  var disabled = this.get('isEnabled') ? '' : 'disabled="disabled"';
39
+ if(SC.browser.msie) context.attr('for', SC.guidFor(this));
39
40
  context.push('<span class="button" ></span>');
40
- context.push('<input type="checkbox" name="%@" %@ />'.fmt(SC.guidFor(this),disabled));
41
+ context.push('<input type="checkbox" id="%@" name="%@" %@ />'.fmt(SC.guidFor(this),SC.guidFor(this),disabled));
41
42
  if(this.get('needsEllipsis')){
42
43
  context.push('<span class="label ellipsis">', dt, '</span>');
43
44
  }else{
@@ -118,7 +119,7 @@ SC.CheckboxView = SC.FieldView.extend(SC.StaticLayout, SC.Button,
118
119
  SC.Event.remove(this.$input()[0], 'click', this, this._field_fieldValueDidChange);
119
120
  },
120
121
 
121
- mouseDown: function(evt) {
122
+ mouseDown: function(evt) {
122
123
  this.set('isActive', YES);
123
124
  this._field_isMouseDown = YES;
124
125
  return YES;
@@ -1093,7 +1093,7 @@ SC.CollectionView = SC.View.extend(
1093
1093
  // walk up the element hierarchy until we find this or an element with an
1094
1094
  // id matching the base guid (i.e. a collection item)
1095
1095
  while (element && element !== document && element !== layer) {
1096
- id = element ? element.getAttribute('id') : null ;
1096
+ id = element ? SC.$(element).attr('id') : null ;
1097
1097
  if (id && (contentIndex = this.contentIndexForLayerId(id)) !== null) {
1098
1098
  break;
1099
1099
  }
@@ -31,7 +31,7 @@ SC.GridView = SC.ListView.extend(
31
31
  width of each item will be this value.
32
32
  */
33
33
  columnWidth: 64,
34
-
34
+
35
35
  /**
36
36
  The default example item view will render text-based items.
37
37
 
@@ -41,19 +41,13 @@ SC.GridView = SC.ListView.extend(
41
41
 
42
42
  insertionOrientation: SC.HORIZONTAL_ORIENTATION,
43
43
 
44
- displayProperties: 'itemsPerRow'.w(),
45
-
46
44
  /** @private */
47
45
  itemsPerRow: function() {
48
46
  var f = this.get('frame') ;
49
47
  var columnWidth = this.get('columnWidth') || 0 ;
48
+
50
49
  return (columnWidth <= 0) ? 1 : Math.floor(f.width / columnWidth) ;
51
- }.property('frame', 'columnWidth').cacheable(),
52
-
53
- /** @private */
54
- itemsPerRowDidChange: function() {
55
- this.set('isDirty', YES) ;
56
- }.observes('itemsPerRow'),
50
+ }.property('clippingFrame', 'columnWidth').cacheable(),
57
51
 
58
52
  /** @private
59
53
  Find the contentIndexes to display in the passed rect. Note that we
@@ -66,14 +60,13 @@ SC.GridView = SC.ListView.extend(
66
60
 
67
61
  var min = Math.floor(SC.minY(rect) / rowHeight) * itemsPerRow ;
68
62
  var max = Math.ceil(SC.maxY(rect) / rowHeight) * itemsPerRow ;
69
-
70
63
  return SC.IndexSet.create(min, max-min);
71
64
  },
72
65
 
73
66
  /** @private */
74
- layoutForContentIndex: function(contentIndex) {
67
+ layoutForContentIndex: function(contentIndex) {
75
68
  var rowHeight = this.get('rowHeight') || 48 ;
76
- var frameWidth = this.get('frame').width ;
69
+ var frameWidth = this.get('clippingFrame').width ;
77
70
  var itemsPerRow = this.get('itemsPerRow') ;
78
71
  var columnWidth = Math.floor(frameWidth/itemsPerRow);
79
72
 
@@ -197,6 +190,22 @@ SC.GridView = SC.ListView.extend(
197
190
  // convert to index
198
191
  var ret= (row*itemsPerRow) + col ;
199
192
  return [ret, retOp] ;
200
- }
201
-
193
+ },
194
+
195
+ /** @private
196
+ If the size of the clipping frame changes, all of the item views
197
+ on screen are potentially in the wrong position. Update all of their
198
+ layouts if different.
199
+ */
200
+ _gv_clippingFrameDidChange: function() {
201
+ var nowShowing = this.get('nowShowing'), itemView, idx, len;
202
+ this.notifyPropertyChange('itemsPerRow');
203
+
204
+ len = nowShowing.get('length');
205
+
206
+ for (idx=0; idx < len; idx++) {
207
+ itemView = this.itemViewForContentIndex(idx);
208
+ itemView.adjust(this.layoutForContentIndex(idx));
209
+ }
210
+ }.observes('clippingFrame')
202
211
  }) ;