sproutcore 1.10.1 → 1.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/CHANGELOG +13 -0
- data/VERSION.yml +1 -1
- data/lib/frameworks/sproutcore/CHANGELOG.md +69 -31
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +14 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/object.js +14 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +7 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/platform.js +13 -9
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +57 -23
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/enabled_states_test.js +24 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/enabled.js +63 -13
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/datastore/models/single_attribute.js +7 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/system/many_array.js +28 -5
- data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +15 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +30 -3
- data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +23 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/many_attribute.js +135 -89
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/single_attribute.js +12 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +18 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/picker/ui.js +58 -20
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/date_field/methods.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select/methods.js +15 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +10 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select.js +24 -23
- data/lib/frameworks/sproutcore/frameworks/desktop/views/split.js +4 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/views/popup_button.js +10 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/delegates/inline_text_field.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_mixin.js +33 -16
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_value_support.js +14 -6
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/control.js +23 -18
- data/lib/frameworks/sproutcore/frameworks/foundation/system/user_defaults.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/delegates/inline_text_field/inline_text_field.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/auto_mixin_tests.js +78 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/auto_resize_test.js +45 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/content_value_support/content.js +112 -58
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/image_queue.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/transition_test.js +141 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/methods.js +27 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +631 -593
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/swap_fade_color_transition.js +5 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/swap_move_in_transition.js +5 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/swap_reveal_transition.js +68 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/views/container.js +128 -49
- data/lib/frameworks/sproutcore/frameworks/foundation/views/field.js +33 -8
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +209 -187
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +7 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +34 -4
- data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +0 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +68 -9
- data/lib/frameworks/sproutcore/frameworks/testing/system/runner.js +2 -1
- data/lib/sproutcore/rack/builder.rb +45 -25
- data/sproutcore.gemspec +1 -0
- metadata +17 -2
@@ -5,7 +5,7 @@
|
|
5
5
|
// License: Licensed under MIT license (see license.js)
|
6
6
|
// ==========================================================================
|
7
7
|
|
8
|
-
/*global module test htmlbody ok equals same stop start */
|
8
|
+
/*global module, test, clearHtmlbody, htmlbody, ok, equals, same, stop, start */
|
9
9
|
|
10
10
|
|
11
11
|
function evaluatePicker(pane) {
|
@@ -24,74 +24,112 @@ function evaluatePicker(pane) {
|
|
24
24
|
|
25
25
|
var anchor = SC.ControlTestPane.design()
|
26
26
|
.add("anchor", SC.ButtonView, {
|
27
|
-
|
27
|
+
title: "Anchor Button"
|
28
28
|
});
|
29
29
|
|
30
30
|
module("SC.PickerPane UI", {
|
31
|
-
setup: function(){
|
31
|
+
setup: function () {
|
32
32
|
htmlbody('<style> .sc-static-layout { border: 1px red dotted; } </style>');
|
33
33
|
anchor.standardSetup().setup();
|
34
34
|
},
|
35
|
-
teardown: function(){
|
35
|
+
teardown: function () {
|
36
36
|
anchor.standardSetup().teardown();
|
37
37
|
clearHtmlbody();
|
38
38
|
}
|
39
39
|
});
|
40
40
|
|
41
41
|
|
42
|
-
var paneDefault
|
43
|
-
var paneMenu
|
44
|
-
var paneFixed
|
45
|
-
var panePointer
|
42
|
+
var paneDefault;
|
43
|
+
var paneMenu;
|
44
|
+
var paneFixed;
|
45
|
+
var panePointer;
|
46
46
|
|
47
|
-
test("verify default picker pane content container is visible at correct location with right size", function() {
|
47
|
+
test("verify default picker pane content container is visible at correct location with right size", function () {
|
48
48
|
paneDefault = SC.PickerPane.create({
|
49
49
|
layout: { width: 300, height: 200 },
|
50
50
|
contentView: SC.View.extend({
|
51
51
|
layout: { top: 0, left: 0, bottom: 0, right: 0 }
|
52
52
|
})
|
53
53
|
});
|
54
|
-
|
54
|
+
SC.run(function () {
|
55
|
+
paneDefault.popup(anchor.view('anchor'), SC.PICKER);
|
56
|
+
});
|
57
|
+
evaluatePicker(paneDefault);
|
58
|
+
paneDefault.remove();
|
59
|
+
paneDefault.destroy();
|
60
|
+
});
|
61
|
+
|
62
|
+
test("verify default picker pane content container is visible at correct location with right size (live resize)", function () {
|
63
|
+
var lowAnchor = SC.Pane.create({
|
64
|
+
layout: { bottom: 0, height: 10, centerX: 0, width: 10 }
|
65
|
+
});
|
66
|
+
|
67
|
+
paneDefault = SC.PickerPane.create({
|
68
|
+
layout: { width: 300, height: 200 },
|
69
|
+
contentView: SC.View.extend({
|
70
|
+
layout: { top: 0, left: 0, bottom: 0, right: 0 }
|
71
|
+
})
|
72
|
+
});
|
73
|
+
SC.run(function () {
|
74
|
+
lowAnchor.append();
|
75
|
+
paneDefault.popup(lowAnchor.get('layer'), SC.PICKER);
|
76
|
+
});
|
55
77
|
evaluatePicker(paneDefault);
|
78
|
+
|
79
|
+
var firstLayout = paneDefault.get('layout');
|
80
|
+
SC.run(function () {
|
81
|
+
paneDefault.adjust('height', 300);
|
82
|
+
});
|
83
|
+
var newLayout = paneDefault.get('layout');
|
84
|
+
equals(newLayout.height, 300, "The new height should be");
|
85
|
+
equals(newLayout.top, firstLayout.top - 100, "The new top should be");
|
86
|
+
|
56
87
|
paneDefault.remove();
|
57
88
|
paneDefault.destroy();
|
58
|
-
})
|
89
|
+
});
|
59
90
|
|
60
|
-
test("verify menu picker pane content container is visible at correct location with right size", function() {
|
91
|
+
test("verify menu picker pane content container is visible at correct location with right size", function () {
|
61
92
|
paneMenu = SC.PickerPane.create({
|
62
93
|
layout: { width: 300, height: 200 },
|
63
94
|
contentView: SC.View.extend({
|
64
95
|
layout: { top: 0, left: 0, bottom: 0, right: 0 }
|
65
96
|
})
|
66
97
|
});
|
67
|
-
|
98
|
+
SC.run(function () {
|
99
|
+
paneMenu.popup(anchor.view('anchor'), SC.PICKER_MENU);
|
100
|
+
});
|
68
101
|
evaluatePicker(paneMenu);
|
69
102
|
paneMenu.remove();
|
70
103
|
paneMenu.destroy();
|
71
|
-
})
|
104
|
+
});
|
72
105
|
|
73
|
-
test("verify fixed picker pane content container is visible at correct location with right size", function() {
|
106
|
+
test("verify fixed picker pane content container is visible at correct location with right size", function () {
|
74
107
|
paneFixed = SC.PickerPane.create({
|
75
108
|
layout: { width: 300, height: 200 },
|
76
109
|
contentView: SC.View.extend({
|
77
110
|
layout: { top: 0, left: 0, bottom: 0, right: 0 }
|
78
111
|
})
|
79
112
|
});
|
80
|
-
|
113
|
+
|
114
|
+
SC.run(function () {
|
115
|
+
paneFixed.popup(anchor.view('anchor'), SC.PICKER_FIXED);
|
116
|
+
});
|
81
117
|
evaluatePicker(paneFixed);
|
82
118
|
paneFixed.remove();
|
83
119
|
paneFixed.destroy();
|
84
|
-
})
|
120
|
+
});
|
85
121
|
|
86
|
-
test("verify pointer picker pane content container is visible at correct location with right size", function() {
|
122
|
+
test("verify pointer picker pane content container is visible at correct location with right size", function () {
|
87
123
|
panePointer = SC.PickerPane.create({
|
88
124
|
layout: { width: 300, height: 200 },
|
89
125
|
contentView: SC.View.extend({
|
90
126
|
layout: { top: 0, left: 0, bottom: 0, right: 0 }
|
91
127
|
})
|
92
128
|
});
|
93
|
-
|
129
|
+
SC.run(function () {
|
130
|
+
panePointer.popup(anchor.view('anchor'), SC.PICKER_POINTER, [3, 0, 1, 2, 2]);
|
131
|
+
});
|
94
132
|
evaluatePicker(panePointer);
|
95
133
|
panePointer.remove();
|
96
134
|
panePointer.destroy();
|
97
|
-
})
|
135
|
+
});
|
@@ -73,7 +73,7 @@ test("isEnabled=NO isEditable=NO should add disabled attribute", function() {
|
|
73
73
|
view0.set('isEditable', NO);
|
74
74
|
SC.RunLoop.end();
|
75
75
|
ok(view0.$input().attr('disabled'), 'should have disabled attribute');
|
76
|
-
ok(
|
76
|
+
ok(view0.$input().attr('readOnly'), 'should have readOnly attribute');
|
77
77
|
});
|
78
78
|
|
79
79
|
test("isEnabled=NO isEditable=YES should add disabled attribute", function() {
|
@@ -121,7 +121,11 @@ test("Check if setting a value actually changes the selection value", function()
|
|
121
121
|
|
122
122
|
//test10
|
123
123
|
test('Setting the view\'s items should not result in an error.', function() {
|
124
|
-
try {
|
124
|
+
try {
|
125
|
+
SC.RunLoop.begin() ;
|
126
|
+
view1.set('items', null);
|
127
|
+
SC.RunLoop.end() ;
|
128
|
+
}
|
125
129
|
catch (e) {
|
126
130
|
ok(false, 'Nulling out items should not throw an error.');
|
127
131
|
}
|
@@ -142,3 +146,13 @@ test("The properties for select button should take the specified values", functi
|
|
142
146
|
equals(prop1,'custom-menu-item','Custom view class name should be custom-menu-item');
|
143
147
|
equals(prop2,46,'Custom view menu off set width should be 46');
|
144
148
|
});
|
149
|
+
|
150
|
+
test("The content of the popup should be recalculated correctly when the list of items changes", function() {
|
151
|
+
equals(view3.get("_itemList")[2].title, "World", "The list should have on the 3rd position the title World");
|
152
|
+
SC.RunLoop.begin() ;
|
153
|
+
view4.get('items').insertAt( 0, { title: "Moving", pos: 0 } ) ;
|
154
|
+
view3.set('items', ["It", "Works", "Again"] );
|
155
|
+
SC.RunLoop.end() ;
|
156
|
+
equals(view4.get("_itemList")[0].title, "Moving", "The list should start with new item Moving");
|
157
|
+
equals(view3.get("_itemList")[2].title, "Again", "The list should have on the 3rd position the title Again");
|
158
|
+
});
|
@@ -854,7 +854,7 @@ SC.ButtonView = SC.View.extend(SC.Control,
|
|
854
854
|
/** @private */
|
855
855
|
didAppendToDocument: function() {
|
856
856
|
if(SC.browser.isIE &&
|
857
|
-
SC.browser.compare(SC.browser.
|
857
|
+
SC.browser.compare(SC.browser.version, '7') === 0 &&
|
858
858
|
this.get('useStaticLayout')){
|
859
859
|
var layout = this.get('layout'),
|
860
860
|
elem = this.$(), w=0;
|
@@ -294,6 +294,16 @@ SC.PopupButtonView = SC.ButtonView.extend(
|
|
294
294
|
var menu = this.get('instantiatedMenu') ;
|
295
295
|
|
296
296
|
return (!!menu && menu.performKeyEquivalent(charCode, evt, YES)) ;
|
297
|
+
},
|
298
|
+
|
299
|
+
/** @private */
|
300
|
+
touchStart: function(evt) {
|
301
|
+
return this.mouseDown(evt);
|
302
|
+
},
|
303
|
+
|
304
|
+
/** @private */
|
305
|
+
touchEnd: function(evt) {
|
306
|
+
return this.mouseUp(evt);
|
297
307
|
}
|
298
308
|
|
299
309
|
});
|
@@ -2007,7 +2007,7 @@ SC.ScrollView = SC.View.extend({
|
|
2007
2007
|
}
|
2008
2008
|
|
2009
2009
|
// Notify the child that its frame is changing.
|
2010
|
-
content.
|
2010
|
+
if (content._viewFrameDidChange) { content._viewFrameDidChange(); }
|
2011
2011
|
}
|
2012
2012
|
|
2013
2013
|
if (container && !SC.platform.touch) {
|
@@ -226,10 +226,10 @@ SC.SelectView = SC.ButtonView.extend(
|
|
226
226
|
|
227
227
|
/**
|
228
228
|
@type SC.Array
|
229
|
-
@default ['icon', 'value','controlSize'
|
229
|
+
@default ['icon', 'value','controlSize']
|
230
230
|
@see SC.View#displayProperties
|
231
231
|
*/
|
232
|
-
displayProperties: ['icon', 'value','controlSize',
|
232
|
+
displayProperties: ['icon', 'value','controlSize', 'escapeHTML', 'emptyName'],
|
233
233
|
|
234
234
|
/**
|
235
235
|
Prefer matrix to position the select button menu such that the
|
@@ -333,6 +333,16 @@ SC.SelectView = SC.ButtonView.extend(
|
|
333
333
|
*/
|
334
334
|
supportFocusRing: YES,
|
335
335
|
|
336
|
+
/**
|
337
|
+
* @private
|
338
|
+
* Overwritten to calculate the content corresponding to items configured at creation
|
339
|
+
*/
|
340
|
+
init: function() {
|
341
|
+
sc_super();
|
342
|
+
|
343
|
+
this.itemsDidChange();
|
344
|
+
},
|
345
|
+
|
336
346
|
/**
|
337
347
|
Left Alignment based on the size of the button
|
338
348
|
|
@@ -376,12 +386,11 @@ SC.SelectView = SC.ButtonView.extend(
|
|
376
386
|
},
|
377
387
|
|
378
388
|
/**
|
379
|
-
|
389
|
+
Observer called whenever the items collection or an element of this collection changes
|
380
390
|
|
381
391
|
@private
|
382
392
|
*/
|
383
|
-
|
384
|
-
|
393
|
+
itemsDidChange: function() {
|
385
394
|
var escapeHTML, items, len, nameKey, iconKey, valueKey, separatorKey, showCheckbox,
|
386
395
|
currentSelectedVal, shouldLocalize, isSeparator, itemList, isChecked,
|
387
396
|
idx, name, icon, value, item, itemEnabled, isEnabledKey, emptyName, isSameRecord;
|
@@ -544,27 +553,19 @@ SC.SelectView = SC.ButtonView.extend(
|
|
544
553
|
this.set('_itemList', itemList);
|
545
554
|
}, this );
|
546
555
|
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
}
|
556
|
-
else this.set('title', emptyName);
|
557
|
-
}
|
558
|
-
});
|
556
|
+
var value = this.get('value');
|
557
|
+
if (SC.none(value)) {
|
558
|
+
if (SC.none(emptyName)) {
|
559
|
+
this.set('value', this._defaultVal);
|
560
|
+
this.set('title', this._defaultTitle);
|
561
|
+
this.set('icon', this._defaultIcon);
|
562
|
+
}
|
563
|
+
else this.set('title', emptyName);
|
559
564
|
}
|
560
565
|
|
561
566
|
//Set the preference matrix for the menu pane
|
562
|
-
this.changeSelectPreferMatrix(
|
563
|
-
|
564
|
-
// If we're going to do such a stupid render function where we set properties
|
565
|
-
// on ourself, then we should use those properties in this pass.
|
566
|
-
sc_super();
|
567
|
-
},
|
567
|
+
this.changeSelectPreferMatrix();
|
568
|
+
}.observes( '*items.[]' ),
|
568
569
|
|
569
570
|
/**
|
570
571
|
@private
|
@@ -33,6 +33,10 @@ SC.RESIZE_AUTOMATIC = 'sc-automatic-resize';
|
|
33
33
|
SC.SplitView arranges multiple views side-by-side or on top of each
|
34
34
|
other.
|
35
35
|
|
36
|
+
By default, SC.SplitView sets `size` and `position` properties on the
|
37
|
+
child views, leaving it up to the child view to adjust itself. For good
|
38
|
+
default behavior, mix SC.SplitChild into your child views.
|
39
|
+
|
36
40
|
SplitView can resize its children to fit (the default behavior),
|
37
41
|
or resize itself to fit its children--allowing you to build column-
|
38
42
|
based file browsers and the like. As one child (a divider, most likely)
|
data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/views/popup_button.js
CHANGED
@@ -259,6 +259,16 @@ SC.PopupButtonView = SC.ButtonView.extend({
|
|
259
259
|
}
|
260
260
|
|
261
261
|
return sc_super();
|
262
|
+
},
|
263
|
+
|
264
|
+
/** @private */
|
265
|
+
touchStart: function(evt) {
|
266
|
+
return this.mouseDown(evt);
|
267
|
+
},
|
268
|
+
|
269
|
+
/** @private */
|
270
|
+
touchEnd: function(evt) {
|
271
|
+
return this.mouseUp(evt);
|
262
272
|
}
|
263
273
|
});
|
264
274
|
|
@@ -72,15 +72,15 @@ SC.InlineTextFieldDelegate = /** @scope SC.InlineTextFieldDelegate */{
|
|
72
72
|
},
|
73
73
|
|
74
74
|
/**
|
75
|
-
Cleans up the given editor by simply
|
76
|
-
client view should null any references to the editor
|
77
|
-
collected.
|
75
|
+
Cleans up the given editor by simply destroying it, which removes it from
|
76
|
+
the view hierarchy. The client view should null any references to the editor
|
77
|
+
so it may be garbage collected.
|
78
78
|
|
79
79
|
@params {SC.InlineEditor} editor the editor that should be cleaned up
|
80
80
|
@returns {Boolean} whether the cleanup succeeded
|
81
81
|
*/
|
82
82
|
releaseEditor: function (editor) {
|
83
|
-
editor.
|
83
|
+
editor.destroy();
|
84
84
|
|
85
85
|
this.editor = null;
|
86
86
|
|
@@ -6,36 +6,53 @@
|
|
6
6
|
// ==========================================================================
|
7
7
|
|
8
8
|
/**
|
9
|
-
@namespace
|
9
|
+
@namespace
|
10
10
|
|
11
|
-
Use this mixin to automatically mix in a
|
11
|
+
Use this mixin to automatically mix in a list of mixins into all
|
12
12
|
child views created _by the view_ (that are created at view initialization).
|
13
|
-
|
13
|
+
|
14
14
|
@since SproutCore 1.0
|
15
15
|
*/
|
16
16
|
SC.AutoMixin = {
|
17
17
|
|
18
18
|
/**
|
19
|
-
|
20
|
-
|
19
|
+
An array of mixins to automatically mix in to each child view of this
|
20
|
+
view when the child view is created.
|
21
|
+
|
22
|
+
@type Array
|
23
|
+
@default []
|
21
24
|
*/
|
22
25
|
autoMixins: [],
|
23
|
-
|
26
|
+
|
24
27
|
/**
|
25
28
|
@private
|
26
29
|
Override createChildViews to mix in the mixins defined in autoMixins.
|
27
30
|
*/
|
28
|
-
createChildView: function(
|
29
|
-
if (!
|
31
|
+
createChildView: function (view, attrs) {
|
32
|
+
if (!view.isClass) {
|
33
|
+
attrs = view;
|
34
|
+
} else {
|
35
|
+
// attrs should always exist...
|
36
|
+
if (!attrs) { attrs = {}; }
|
37
|
+
// clone the hash that was given so we do not pollute it if it's being reused
|
38
|
+
else { attrs = SC.clone(attrs); }
|
39
|
+
}
|
40
|
+
|
30
41
|
attrs.owner = attrs.parentView = this;
|
31
|
-
attrs.isVisibleInWindow = this.get('isVisibleInWindow');
|
32
42
|
if (!attrs.page) attrs.page = this.page;
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
43
|
+
|
44
|
+
if (view.isClass) {
|
45
|
+
// Track that we created this view.
|
46
|
+
attrs.createdByParent = true;
|
47
|
+
|
48
|
+
// Add the mixins to the child's attributes.
|
49
|
+
var applyMixins = SC.clone(this.get("autoMixins"));
|
50
|
+
applyMixins.push(attrs);
|
51
|
+
|
52
|
+
view = view.create.apply(view, applyMixins);
|
53
|
+
}
|
54
|
+
|
55
|
+
return view;
|
39
56
|
}
|
40
57
|
|
41
|
-
};
|
58
|
+
};
|
@@ -136,7 +136,15 @@ SC.ContentValueSupport = {
|
|
136
136
|
var contentKey;
|
137
137
|
|
138
138
|
for (contentKey in contentKeys) {
|
139
|
-
if
|
139
|
+
// if we found the specific contentKey, then just update that and we're done
|
140
|
+
if (key === this.getDelegateProperty(contentKey, this, this.get('displayDelegate'), contentKeys)) {
|
141
|
+
return this.updatePropertyFromContent(contentKeys[contentKey], key, contentKey, target);
|
142
|
+
}
|
143
|
+
|
144
|
+
// else if '*' is changed, then update for every contentKey
|
145
|
+
else if (key === '*') {
|
146
|
+
this.updatePropertyFromContent(contentKeys[contentKey], key, contentKey, target);
|
147
|
+
}
|
140
148
|
}
|
141
149
|
}
|
142
150
|
|
@@ -289,13 +297,13 @@ SC.ContentValueSupport = {
|
|
289
297
|
}
|
290
298
|
}
|
291
299
|
|
292
|
-
//
|
293
|
-
this._control_content = content;
|
294
|
-
this._old_contentValueKeys = oldKeys;
|
295
|
-
|
296
|
-
// notify that value did change.
|
300
|
+
// notify that values did change.
|
297
301
|
key = (!key || key === 'content') ? '*' : this.get(key);
|
298
302
|
if (key) this.contentPropertyDidChange(content, key);
|
303
|
+
|
304
|
+
// Cache values for clean up.
|
305
|
+
this._control_content = content;
|
306
|
+
this._old_contentValueKeys = oldKeys;
|
299
307
|
}.observes('content'),
|
300
308
|
|
301
309
|
/** @private
|
@@ -23,7 +23,7 @@ SC.AUTO_CONTROL_SIZE = '__AUTO__';
|
|
23
23
|
@type String
|
24
24
|
@constant
|
25
25
|
*/
|
26
|
-
SC.JUMBO_CONTROL_SIZE = 'sc-jumbo-size'
|
26
|
+
SC.JUMBO_CONTROL_SIZE = 'sc-jumbo-size';
|
27
27
|
|
28
28
|
/**
|
29
29
|
Option for HUGE control size.
|
@@ -31,7 +31,7 @@ SC.JUMBO_CONTROL_SIZE = 'sc-jumbo-size' ;
|
|
31
31
|
@type String
|
32
32
|
@constant
|
33
33
|
*/
|
34
|
-
SC.HUGE_CONTROL_SIZE = 'sc-huge-size'
|
34
|
+
SC.HUGE_CONTROL_SIZE = 'sc-huge-size';
|
35
35
|
|
36
36
|
/**
|
37
37
|
Option for large control size.
|
@@ -39,7 +39,7 @@ SC.HUGE_CONTROL_SIZE = 'sc-huge-size' ;
|
|
39
39
|
@type String
|
40
40
|
@constant
|
41
41
|
*/
|
42
|
-
SC.LARGE_CONTROL_SIZE = 'sc-large-size'
|
42
|
+
SC.LARGE_CONTROL_SIZE = 'sc-large-size';
|
43
43
|
|
44
44
|
/**
|
45
45
|
Option for standard control size.
|
@@ -47,7 +47,7 @@ SC.LARGE_CONTROL_SIZE = 'sc-large-size' ;
|
|
47
47
|
@type String
|
48
48
|
@constant
|
49
49
|
*/
|
50
|
-
SC.REGULAR_CONTROL_SIZE = 'sc-regular-size'
|
50
|
+
SC.REGULAR_CONTROL_SIZE = 'sc-regular-size';
|
51
51
|
|
52
52
|
/**
|
53
53
|
Option for small control size.
|
@@ -55,7 +55,7 @@ SC.REGULAR_CONTROL_SIZE = 'sc-regular-size' ;
|
|
55
55
|
@type String
|
56
56
|
@constant
|
57
57
|
*/
|
58
|
-
SC.SMALL_CONTROL_SIZE = 'sc-small-size'
|
58
|
+
SC.SMALL_CONTROL_SIZE = 'sc-small-size';
|
59
59
|
|
60
60
|
/**
|
61
61
|
Option for tiny control size
|
@@ -63,7 +63,7 @@ SC.SMALL_CONTROL_SIZE = 'sc-small-size' ;
|
|
63
63
|
@type String
|
64
64
|
@constant
|
65
65
|
*/
|
66
|
-
SC.TINY_CONTROL_SIZE = 'sc-tiny-size'
|
66
|
+
SC.TINY_CONTROL_SIZE = 'sc-tiny-size';
|
67
67
|
|
68
68
|
/**
|
69
69
|
@namespace
|
@@ -203,16 +203,18 @@ SC.Control = SC.mixin(SC.clone(SC.ContentValueSupport),
|
|
203
203
|
@observes 'fieldLabel'
|
204
204
|
@observes 'fieldKey'
|
205
205
|
*/
|
206
|
-
errorLabel: function() {
|
207
|
-
var ret, fk, def, locFK;
|
208
|
-
|
206
|
+
errorLabel: function () {
|
207
|
+
var ret = this.get('fieldLabel'), fk, def, locFK;
|
208
|
+
|
209
|
+
// Fast path!
|
210
|
+
if (ret) return ret;
|
209
211
|
|
210
212
|
// if field label is not provided, compute something...
|
211
213
|
fk = this.get('fieldKey') || this.constructor.toString();
|
212
214
|
def = fk ? SC.String.capitalize(SC.String.humanize(fk)) : '';
|
213
215
|
locFK = SC.String.locWithDefault("FieldKey." + fk, def);
|
214
216
|
return SC.String.locWithDefault("ErrorLabel." + fk, locFK);
|
215
|
-
}.property('fieldLabel','fieldKey').cacheable(),
|
217
|
+
}.property('fieldLabel', 'fieldKey').cacheable(),
|
216
218
|
|
217
219
|
/**
|
218
220
|
The control size. This will set a CSS style on the element that can be
|
@@ -239,14 +241,16 @@ SC.Control = SC.mixin(SC.clone(SC.ContentValueSupport),
|
|
239
241
|
Invoke this method in your updateDisplay() method to update any basic
|
240
242
|
control CSS classes.
|
241
243
|
*/
|
242
|
-
renderMixin: function(context, firstTime) {
|
243
|
-
var sel = this.get('isSelected'),
|
244
|
-
|
245
|
-
|
246
|
-
|
244
|
+
renderMixin: function (context, firstTime) {
|
245
|
+
var sel = this.get('isSelected'),
|
246
|
+
disabled = !this.get('isEnabledInPane'),
|
247
|
+
// update the CSS classes for the control. note we reuse the same hash
|
248
|
+
// to avoid consuming more memory
|
249
|
+
names = this._CONTROL_TMP_CLASSNAMES; // temporary object
|
250
|
+
|
247
251
|
names.mixed = sel === SC.MIXED_STATE;
|
248
|
-
names.sel = sel && (sel !== SC.MIXED_STATE)
|
249
|
-
names.active = this.get('isActive')
|
252
|
+
names.sel = sel && (sel !== SC.MIXED_STATE);
|
253
|
+
names.active = this.get('isActive');
|
250
254
|
|
251
255
|
var controlSize = this.get("controlSize");
|
252
256
|
if (!controlSize) {
|
@@ -272,7 +276,8 @@ SC.Control = SC.mixin(SC.clone(SC.ContentValueSupport),
|
|
272
276
|
// tags
|
273
277
|
if (!firstTime && this.$input) {
|
274
278
|
var inps = this.$input();
|
275
|
-
|
279
|
+
|
280
|
+
if (inps.attr('type') !== "radio") {
|
276
281
|
this.$input().attr('disabled', disabled);
|
277
282
|
}
|
278
283
|
}
|
@@ -82,7 +82,7 @@ SC.UserDefaults = SC.Object.extend(/** @scope SC.UserDefaults.prototype */ {
|
|
82
82
|
|
83
83
|
// attempt to read from localStorage
|
84
84
|
isIE7 = SC.browser.isIE &&
|
85
|
-
SC.browser.compare(SC.browser.
|
85
|
+
SC.browser.compare(SC.browser.version, '7') === 0;
|
86
86
|
|
87
87
|
if(isIE7) {
|
88
88
|
localStorage=document.body;
|
@@ -149,7 +149,7 @@ SC.UserDefaults = SC.Object.extend(/** @scope SC.UserDefaults.prototype */ {
|
|
149
149
|
|
150
150
|
// save to local storage
|
151
151
|
isIE7 = SC.browser.isIE &&
|
152
|
-
SC.browser.compare(SC.browser.
|
152
|
+
SC.browser.compare(SC.browser.version, '7') === 0;
|
153
153
|
|
154
154
|
if(isIE7){
|
155
155
|
localStorage=document.body;
|
@@ -218,7 +218,7 @@ SC.UserDefaults = SC.Object.extend(/** @scope SC.UserDefaults.prototype */ {
|
|
218
218
|
if (written) delete written[userKeyName];
|
219
219
|
|
220
220
|
isIE7 = SC.browser.isIE &&
|
221
|
-
SC.browser.compare(SC.browser.
|
221
|
+
SC.browser.compare(SC.browser.version, '7') === 0;
|
222
222
|
|
223
223
|
if(isIE7){
|
224
224
|
localStorage=document.body;
|
@@ -329,7 +329,7 @@ SC.UserDefaults = SC.Object.extend(/** @scope SC.UserDefaults.prototype */ {
|
|
329
329
|
this._scud_appDomain = this.get('appDomain');
|
330
330
|
|
331
331
|
isIE7 = SC.browser.isIE &&
|
332
|
-
SC.browser.compare(SC.browser.
|
332
|
+
SC.browser.compare(SC.browser.version, '7') === 0;
|
333
333
|
|
334
334
|
if(isIE7){
|
335
335
|
//Add user behavior userData. This works in all versions of IE.
|
@@ -68,6 +68,7 @@ test("basic acquire and release", function() {
|
|
68
68
|
|
69
69
|
SC.InlineTextFieldDelegate.releaseEditor(editor);
|
70
70
|
|
71
|
+
ok(editor.isDestroyed, "editor should be destroyed");
|
71
72
|
same(editor.get('pane'), null, "editor removed from pane after release");
|
72
73
|
same(editor.get('parentView'), null, "editor removed from parent view after release");
|
73
74
|
});
|