sproutcore 1.6.0.rc.2-x86-mingw32 → 1.6.0.1-x86-mingw32
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.
- data/CHANGELOG +12 -0
- data/VERSION.yml +1 -1
- data/bin/sc-docs +6 -1
- data/lib/buildtasks/target.rake +1 -1
- data/lib/frameworks/sproutcore/Buildfile +5 -1
- data/lib/frameworks/sproutcore/CHANGELOG.md +175 -1
- data/lib/frameworks/sproutcore/apps/test_controls/controllers/select.js +12 -0
- data/lib/frameworks/sproutcore/apps/test_controls/resources/select_page.js +19 -5
- data/lib/frameworks/sproutcore/frameworks/ajax/system/request.js +28 -31
- data/lib/frameworks/sproutcore/frameworks/ajax/system/response.js +9 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/controller.js +21 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/responder_context.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/checkbox_support.js +6 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/text_field_support.js +26 -8
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/keyboard.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +12 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/template.js +25 -9
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/locale.js +157 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/render_context.js +7 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +9 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/sparse_array.js +8 -8
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/string.js +104 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/theme.js +3 -56
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +4 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/object/content_destroyed.js +59 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/string.js +41 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/template_helpers/text_field_support.js +10 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/panes/template.js +16 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/handlebars.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/clippingFrame.js +11 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/didAppendToDocument.js +18 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/insertBefore.js +10 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/keyboard.js +18 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template_collection.js +9 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +9 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/keyboard.js +15 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +14 -8
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/theming.js +8 -18
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/fixtures.js +12 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/mixins/relationship_support.js +296 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/models/child_record.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +330 -326
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +22 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +614 -614
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/data_sources/data_source.js +14 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record.js +3 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array_complex.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_complex.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/core_methods.js +20 -13
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +61 -46
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/commitChangesFromNestedStore.js +30 -30
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitChangesFromNestedStore.js +24 -24
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/connectDataSource.js +31 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/pushRelationships.js +1177 -0
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/system/datetime.js +4 -63
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/border.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +7 -8
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +18 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js +9 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_data_source.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drop_target.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/button.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/checkbox.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/collection.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/disclosure.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/image_button.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/master_detail.js +3 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/menu.js +12 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/panel.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/picker.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/progress.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/radio.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/radio_group.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segment.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segmented.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/slider.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/toolbar.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/well.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/workspace.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/segmented.css +1 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/ui.js +33 -22
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/methods.js +20 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +10 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/date_field/methods.js +34 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +14 -15
- data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +40 -14
- data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +699 -700
- data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/views/master_detail.js +11 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +16 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/views/progress.js +0 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/radio.js +49 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select_button.js +9 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +6 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/views/slider.js +4 -26
- data/lib/frameworks/sproutcore/frameworks/desktop/views/web.js +20 -19
- data/lib/frameworks/sproutcore/frameworks/experimental/Buildfile +2 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/designers/view_designer.js +249 -249
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/edit_mode.js +13 -5
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/emptiness.js +53 -37
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/render_delegates/form.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/render_delegates/form_row.js +3 -11
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/mixins/edit_mode.js +53 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/mixins/emptiness.js +114 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form.js +174 -6
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_row.js +86 -6
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form.js +80 -110
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form_row.js +96 -97
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/README.md +2 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/models/record.js +20 -36
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/ext/menu.js +121 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/ext/menu_item.js +90 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/mixins/select_view_menu.js +139 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/render_delegates/select_button.js +14 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/ext/menu_resizing.js +25 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/mixins/select_view_menu/bindings.js +43 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/mixins/select_view_menu/check_selected.js +32 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/popup_button/menu_setup.js +40 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/popup_button/show_menu.js +45 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/select/menu_width.js +49 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/select/selected_item.js +191 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/views/popup_button.js +264 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/views/select.js +450 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/mixins/split_child.js +14 -6
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/mixins/split_thumb.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/render_delegates/split.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/render_delegates/split_divider.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/views/split.js +9 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/views/thumb.js +3 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +7 -17
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_value_support.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/flowed_layout.js +35 -8
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editable.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editor.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editor_delegate.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inner_frame.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/canvas_image.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/helpers/sizing.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/image.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/label.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/render_delegate.js +6 -6
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/images/favicon.ico +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/text_field.css +0 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/system/exception_handler.js +4 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/system/math.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/system/module.js +13 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/string_measurement.js +6 -9
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/flowed_layout/tests.js +912 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/methods.js +36 -7
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +58 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/validators/validator.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/views/field.js +0 -15
- data/lib/frameworks/sproutcore/frameworks/foundation/views/label.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +25 -14
- data/lib/frameworks/sproutcore/frameworks/handlebars/handlebars.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +15 -9
- data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/flatten.js +24 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/ext/array.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/ext/function.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +19 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/copyable.js +3 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/freezable.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +14 -14
- data/lib/frameworks/sproutcore/frameworks/runtime/system/error.js +3 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/system/logger.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/system/range_observer.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/runtime/system/set.js +15 -16
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/itemType.js +6 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/enhance.js +30 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/range_observer/create.js +17 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/system/state.js +9 -2
- data/lib/frameworks/sproutcore/frameworks/statechart/system/statechart.js +3 -1
- data/lib/frameworks/sproutcore/frameworks/testing/resources/runner.css +0 -1
- data/lib/frameworks/sproutcore/frameworks/yuireset/resources/base.css +80 -0
- data/lib/frameworks/sproutcore/frameworks/yuireset/resources/core.css +0 -4
- data/lib/frameworks/sproutcore/lib/index.rhtml +2 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list.css +3 -3
- data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list_item.css +2 -2
- data/lib/frameworks/sproutcore/themes/ace/resources/form/form.css +9 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/menu/menu.css +3 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/picker/popover/picker.js +1 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/picker/popover/workspace.js +1 -1
- data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/button.js +1 -1
- data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/panel.js +1 -1
- data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/progress.js +2 -0
- data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/slider.js +1 -1
- data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/well.js +1 -1
- data/lib/sproutcore/builders/base.rb +5 -1
- data/lib/sproutcore/builders/handlebars.rb +12 -1
- data/lib/sproutcore/models/target.rb +1 -9
- data/lib/sproutcore/rack/proxy.rb +238 -92
- data/lib/sproutcore/tools/docs.rb +1 -7
- data/spec/fixtures/builder_tests/apps/handlebars_test/Buildfile +1 -0
- data/spec/fixtures/builder_tests/apps/handlebars_test/{template.handlebars → templates/template.handlebars} +2 -0
- data/spec/lib/builders/handlebars_spec.rb +10 -4
- data/sproutcore.gemspec +3 -1
- metadata +73 -44
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/english.lproj/default_styles.css +0 -5
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/english.lproj/strings.js +0 -15
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_checkbox_field.js +0 -17
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_field.js +0 -17
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_label.js +0 -17
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_radio_field.js +0 -17
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_text_field.js +0 -17
@@ -39,6 +39,26 @@ SC.Controller = SC.Object.extend(
|
|
39
39
|
|
40
40
|
@property {Boolean}
|
41
41
|
*/
|
42
|
-
isEditable: YES
|
42
|
+
isEditable: YES,
|
43
|
+
|
44
|
+
/**
|
45
|
+
* Set this to YES if you are setting the controller content to a recordArray
|
46
|
+
* or other content that needs to be cleaned up (with `.destroy()`) when
|
47
|
+
* new content is set.
|
48
|
+
*/
|
49
|
+
destroyContentOnReplace: NO,
|
50
|
+
|
51
|
+
contentObjectDidChanged: function() {
|
52
|
+
var oldContent, newContent;
|
53
|
+
|
54
|
+
if (!this.get('destroyContentOnReplace')) return;
|
55
|
+
|
56
|
+
oldContent = this._oldContent,
|
57
|
+
newContent = this.get('content');
|
58
|
+
if (oldContent && newContent !== oldContent && oldContent.destroy) {
|
59
|
+
oldContent.destroy();
|
60
|
+
}
|
61
|
+
this._oldContent = newContent;
|
62
|
+
}.observes('content')
|
43
63
|
|
44
64
|
});
|
@@ -15,8 +15,13 @@ SC.Checkbox = SC.TemplateView.extend(
|
|
15
15
|
title: null,
|
16
16
|
value: null,
|
17
17
|
|
18
|
+
displayTitle: function() {
|
19
|
+
var title = this.get('title');
|
20
|
+
return title ? SC.String.loc(title) : null;
|
21
|
+
}.property('title').cacheable(),
|
22
|
+
|
18
23
|
classNames: ['sc-checkbox'],
|
19
|
-
template: SC.Handlebars.compile('<label><input type="checkbox">{{
|
24
|
+
template: SC.Handlebars.compile('<label><input type="checkbox">{{displayTitle}}</label>'),
|
20
25
|
|
21
26
|
didCreateLayer: function() {
|
22
27
|
var self = this;
|
@@ -49,8 +49,13 @@ SC.TextField = SC.TemplateView.extend(
|
|
49
49
|
var input = this.$input();
|
50
50
|
input.val(this._value);
|
51
51
|
|
52
|
-
SC.
|
53
|
-
|
52
|
+
if (SC.browser.msie) {
|
53
|
+
SC.Event.add(input, 'focusin', this, this.focusIn);
|
54
|
+
SC.Event.add(input, 'focusout', this, this.focusOut);
|
55
|
+
} else {
|
56
|
+
SC.Event.add(input, 'focus', this, this.focusIn);
|
57
|
+
SC.Event.add(input, 'blur', this, this.focusOut);
|
58
|
+
}
|
54
59
|
|
55
60
|
input.bind('change', function() {
|
56
61
|
self.domValueDidChange(SC.$(this));
|
@@ -77,8 +82,12 @@ SC.TextField = SC.TemplateView.extend(
|
|
77
82
|
var input = this.$input();
|
78
83
|
|
79
84
|
if (value !== undefined) {
|
80
|
-
|
81
|
-
|
85
|
+
// We don't want to unnecessarily set the value.
|
86
|
+
// Doing that could cause the selection to be lost.
|
87
|
+
if (this._value !== value || input.val() !== value) {
|
88
|
+
this._value = value;
|
89
|
+
input.val(value);
|
90
|
+
}
|
82
91
|
} else if (input.length) {
|
83
92
|
this._value = value = input.val();
|
84
93
|
} else {
|
@@ -135,8 +144,12 @@ SC.TextFieldSupport = /** @scope SC.TextFieldSupport */{
|
|
135
144
|
var input = this.$('input');
|
136
145
|
|
137
146
|
if (value !== undefined) {
|
138
|
-
|
139
|
-
|
147
|
+
// We don't want to unnecessarily set the value.
|
148
|
+
// Doing that could cause the selection to be lost.
|
149
|
+
if (this._value !== value || input.val() !== value) {
|
150
|
+
this._value = value;
|
151
|
+
input.val(value);
|
152
|
+
}
|
140
153
|
} else {
|
141
154
|
if (input.length > 0) {
|
142
155
|
value = this._value = input.val();
|
@@ -153,8 +166,13 @@ SC.TextFieldSupport = /** @scope SC.TextFieldSupport */{
|
|
153
166
|
|
154
167
|
input.val(this._value);
|
155
168
|
|
156
|
-
SC.
|
157
|
-
|
169
|
+
if (SC.browser.msie) {
|
170
|
+
SC.Event.add(input, 'focusin', this, this.focusIn);
|
171
|
+
SC.Event.add(input, 'focusout', this, this.focusOut);
|
172
|
+
} else {
|
173
|
+
SC.Event.add(input, 'focus', this, this.focusIn);
|
174
|
+
SC.Event.add(input, 'blur', this, this.focusOut);
|
175
|
+
}
|
158
176
|
},
|
159
177
|
|
160
178
|
focusIn: function(event) {
|
@@ -260,7 +260,9 @@ SC.Pane = SC.View.extend(SC.ResponderContext,
|
|
260
260
|
// if we are currently key pane, then notify key views of change also
|
261
261
|
if (isKeyPane) {
|
262
262
|
if (current) { current.tryToPerform('willLoseKeyResponderTo', view); }
|
263
|
-
if (view) {
|
263
|
+
if (view) {
|
264
|
+
view.tryToPerform('willBecomeKeyResponderFrom', current);
|
265
|
+
}
|
264
266
|
}
|
265
267
|
|
266
268
|
if (current) {
|
@@ -280,8 +282,11 @@ SC.Pane = SC.View.extend(SC.ResponderContext,
|
|
280
282
|
|
281
283
|
// and notify again if needed.
|
282
284
|
if (isKeyPane) {
|
283
|
-
if (view) {
|
284
|
-
|
285
|
+
if (view) {
|
286
|
+
view.tryToPerform('didBecomeKeyResponderFrom', current); }
|
287
|
+
if (current) {
|
288
|
+
current.tryToPerform('didLoseKeyResponderTo', view);
|
289
|
+
}
|
285
290
|
}
|
286
291
|
|
287
292
|
return this ;
|
@@ -293,7 +298,7 @@ SC.Pane = SC.View.extend(SC.ResponderContext,
|
|
293
298
|
giving it one last opportunity to save its state.
|
294
299
|
|
295
300
|
@param {SC.Pane} pane
|
296
|
-
@returns {SC.Pane}
|
301
|
+
@returns {SC.Pane} receiver
|
297
302
|
*/
|
298
303
|
willLoseKeyPaneTo: function(pane) {
|
299
304
|
this._forwardKeyChange(this.get('isKeyPane'), 'willLoseKeyResponderTo', pane, NO);
|
@@ -315,13 +320,15 @@ SC.Pane = SC.View.extend(SC.ResponderContext,
|
|
315
320
|
},
|
316
321
|
|
317
322
|
|
323
|
+
didBecomeKeyResponderFrom: function(responder) {},
|
324
|
+
|
318
325
|
/**
|
319
326
|
Called just after the pane has lost its keyPane status. Notifies the
|
320
327
|
current keyView of the change. The keyView can use this method to do any
|
321
328
|
final cleanup and changes its own display value if needed.
|
322
329
|
|
323
330
|
@param {SC.Pane} pane
|
324
|
-
@returns {SC.Pane}
|
331
|
+
@returns {SC.Pane} receiver
|
325
332
|
*/
|
326
333
|
didLoseKeyPaneTo: function(pane) {
|
327
334
|
var isKeyPane = this.get('isKeyPane');
|
@@ -5,20 +5,31 @@
|
|
5
5
|
// License: Licensed under MIT license (see license.js)
|
6
6
|
// ==========================================================================
|
7
7
|
|
8
|
-
/**
|
8
|
+
/** @class
|
9
|
+
|
9
10
|
SC.TemplatePane is a helper that will create a new pane based on
|
10
11
|
a single root TemplateView.
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
function main() {
|
14
|
+
MyApp.mainPane = SC.TemplatePane.append({
|
15
|
+
layerId: 'my-root-id',
|
16
|
+
templateName: 'app'
|
17
|
+
})
|
18
|
+
}
|
19
|
+
|
20
|
+
@extends SC.Object
|
21
|
+
@since SproutCore 1.5
|
18
22
|
*/
|
19
23
|
SC.TemplatePane = SC.Object.extend({});
|
20
24
|
|
21
|
-
SC.mixin(SC.TemplatePane
|
25
|
+
SC.TemplatePane.mixin( /** @scope SC.TemplatePane */ {
|
26
|
+
|
27
|
+
/**
|
28
|
+
Creates a new pane with a single TemplateView.
|
29
|
+
|
30
|
+
@param {Object} attrs describes the pane to create
|
31
|
+
@returns {SC.MainPane} the created pane
|
32
|
+
*/
|
22
33
|
append: function(attrs) {
|
23
34
|
var pane = SC.MainPane.extend({
|
24
35
|
childViews: ['contentView'],
|
@@ -38,6 +49,11 @@ SC.mixin(SC.TemplatePane, {
|
|
38
49
|
}
|
39
50
|
});
|
40
51
|
|
41
|
-
|
52
|
+
pane = pane.create().append();
|
53
|
+
|
54
|
+
// Normally the awake process is started in the Page, but we don't have a Page
|
55
|
+
pane.awake();
|
56
|
+
|
57
|
+
return pane;
|
42
58
|
}
|
43
59
|
});
|
@@ -66,6 +66,12 @@ SC.Locale = SC.Object.extend({
|
|
66
66
|
/** The strings hash for this locale. */
|
67
67
|
strings: {},
|
68
68
|
|
69
|
+
/**
|
70
|
+
The metrics for this locale. A metric is a singular value that is usually
|
71
|
+
used in a user interface layout, such as "width of the OK button".
|
72
|
+
*/
|
73
|
+
metrics: {},
|
74
|
+
|
69
75
|
toString: function() {
|
70
76
|
if (!this.language) SC.Locale._assignLocales() ;
|
71
77
|
return "SC.Locale["+this.language+"]"+SC.guidFor(this) ;
|
@@ -86,9 +92,107 @@ SC.Locale = SC.Object.extend({
|
|
86
92
|
if (SC.typeOf(ret) === SC.T_STRING) return ret;
|
87
93
|
else if (SC.typeOf(def) === SC.T_STRING) return def;
|
88
94
|
return string;
|
95
|
+
},
|
96
|
+
|
97
|
+
/**
|
98
|
+
Returns the localized value of the metric for the specified key, or
|
99
|
+
undefined if no match is found.
|
100
|
+
|
101
|
+
@param {String} key
|
102
|
+
@returns {Number} ret
|
103
|
+
*/
|
104
|
+
locMetric: function(key) {
|
105
|
+
var ret = this.metrics[key];
|
106
|
+
if (SC.typeOf(ret) === SC.T_NUMBER) {
|
107
|
+
return ret;
|
108
|
+
}
|
109
|
+
else if (ret === undefined) {
|
110
|
+
SC.warn("No localized metric found for key \"" + key + "\"");
|
111
|
+
return undefined;
|
112
|
+
}
|
113
|
+
else {
|
114
|
+
SC.warn("Unexpected metric type for key \"" + key + "\"");
|
115
|
+
return undefined;
|
116
|
+
}
|
117
|
+
},
|
118
|
+
|
119
|
+
/**
|
120
|
+
Creates and returns a new hash suitable for use as an SC.View’s 'layout'
|
121
|
+
hash. This hash will be created by looking for localized metrics following
|
122
|
+
a pattern based on the “base key” you specify.
|
123
|
+
|
124
|
+
For example, if you specify "Button.Confirm", the following metrics will be
|
125
|
+
used if they are defined:
|
126
|
+
|
127
|
+
Button.Confirm.left
|
128
|
+
Button.Confirm.top
|
129
|
+
Button.Confirm.right
|
130
|
+
Button.Confirm.bottom
|
131
|
+
Button.Confirm.width
|
132
|
+
Button.Confirm.height
|
133
|
+
Button.Confirm.midWidth
|
134
|
+
Button.Confirm.minHeight
|
135
|
+
Button.Confirm.centerX
|
136
|
+
Button.Confirm.centerY
|
137
|
+
|
138
|
+
Additionally, you can optionally specify a hash which will be merged on top
|
139
|
+
of the returned hash. For example, if you wish to allow a button’s width
|
140
|
+
to be configurable per-locale, but always wish for it to be centered
|
141
|
+
vertically and horizontally, you can call:
|
142
|
+
|
143
|
+
locLayout("Button.Confirm", {centerX:0, centerY:0})
|
144
|
+
|
145
|
+
…so that you can combine both localized and non-localized elements in the
|
146
|
+
returned hash. (An exception will be thrown if there is a locale-specific
|
147
|
+
key that matches a key specific in this hash.)
|
148
|
+
|
149
|
+
@param {String} baseKey
|
150
|
+
@param {String} (optional) additionalHash
|
151
|
+
@returns {Hash}
|
152
|
+
*/
|
153
|
+
locLayout: function(baseKey, additionalHash) {
|
154
|
+
// Note: In this method we'll directly access this.metrics rather than
|
155
|
+
// going through locMetric() for performance and to avoid
|
156
|
+
// locMetric()'s sanity checks.
|
157
|
+
|
158
|
+
var i, len, layoutKey, key, value,
|
159
|
+
layoutKeys = SC.Locale.layoutKeys,
|
160
|
+
metrics = this.metrics,
|
161
|
+
|
162
|
+
// Cache, to avoid repeated lookups
|
163
|
+
typeOfFunc = SC.typeOf,
|
164
|
+
numberType = SC.T_NUMBER,
|
165
|
+
|
166
|
+
ret = {};
|
167
|
+
|
168
|
+
|
169
|
+
// Start off by mixing in the additionalHash; we'll look for collisions with
|
170
|
+
// the localized values in the loop below.
|
171
|
+
if (additionalHash) SC.mixin(ret, additionalHash);
|
172
|
+
|
173
|
+
|
174
|
+
// For each possible key that can be included in a layout hash, see whether
|
175
|
+
// we have a localized value.
|
176
|
+
for (i = 0, len = layoutKeys.length; i < len; ++i) {
|
177
|
+
layoutKey = layoutKeys[i];
|
178
|
+
key = baseKey + "." + layoutKey;
|
179
|
+
value = metrics[key];
|
180
|
+
|
181
|
+
if (typeOfFunc(value) === numberType) {
|
182
|
+
// We have a localized value! As a sanity check, if the caller
|
183
|
+
// specified an additional hash and it has the same key, we'll throw an
|
184
|
+
// error.
|
185
|
+
if (additionalHash && additionalHash[layoutKey]) {
|
186
|
+
throw "locLayout(): There is a localized value for the key '" + key + "' but a value for '" + layoutKey + "' was also specified in the non-localized hash";
|
187
|
+
}
|
188
|
+
|
189
|
+
ret[layoutKey] = value;
|
190
|
+
}
|
191
|
+
}
|
192
|
+
|
193
|
+
return ret;
|
89
194
|
}
|
90
|
-
|
91
|
-
|
195
|
+
|
92
196
|
}) ;
|
93
197
|
|
94
198
|
SC.Locale.mixin(/** @scope SC.Locale */ {
|
@@ -98,12 +202,19 @@ SC.Locale.mixin(/** @scope SC.Locale */ {
|
|
98
202
|
preferred one.
|
99
203
|
*/
|
100
204
|
useAutodetectedLanguage: NO,
|
101
|
-
|
205
|
+
|
102
206
|
/**
|
103
207
|
This property is set by the build tools to the current build language.
|
104
208
|
*/
|
105
209
|
preferredLanguage: null,
|
106
|
-
|
210
|
+
|
211
|
+
/**
|
212
|
+
This property holds all attributes name which can be used for a layout hash
|
213
|
+
(for an SC.View). These are what we support inside the layoutFor() method.
|
214
|
+
*/
|
215
|
+
layoutKeys: ['left', 'top', 'right', 'bottom', 'width', 'height',
|
216
|
+
'minWidth', 'minHeight', 'centerX', 'centerY'],
|
217
|
+
|
107
218
|
/**
|
108
219
|
Invoked at the start of SproutCore's document onready handler to setup
|
109
220
|
the currentLocale. This will use the language properties you have set on
|
@@ -211,7 +322,37 @@ SC.Locale.mixin(/** @scope SC.Locale */ {
|
|
211
322
|
this.prototype.hasStrings = YES ;
|
212
323
|
return this;
|
213
324
|
},
|
214
|
-
|
325
|
+
|
326
|
+
/**
|
327
|
+
Adds the passed hash of metrics to the locale's metrics table, much as
|
328
|
+
addStrings() is used to add in strings. Note that if the receiver locale
|
329
|
+
inherits its metrics from its parent, then the metrics table will be cloned
|
330
|
+
first.
|
331
|
+
|
332
|
+
@returns {Object} receiver
|
333
|
+
*/
|
334
|
+
addMetrics: function(metricsHash) {
|
335
|
+
// make sure the target metrics hash exists and belongs to the locale
|
336
|
+
var metrics = this.prototype.metrics;
|
337
|
+
if (metrics) {
|
338
|
+
if (!this.prototype.hasOwnProperty(metrics)) {
|
339
|
+
this.prototype.metrics = SC.clone(metrics) ;
|
340
|
+
}
|
341
|
+
}
|
342
|
+
else {
|
343
|
+
metrics = this.prototype.metrics = {} ;
|
344
|
+
}
|
345
|
+
|
346
|
+
// add metrics hash
|
347
|
+
if (metricsHash) this.prototype.metrics = SC.mixin(metrics, metricsHash);
|
348
|
+
|
349
|
+
// Note: We don't need the equivalent of this.hasStrings here, because we
|
350
|
+
// are not burdened by an older API to look for like the strings
|
351
|
+
// support is.
|
352
|
+
|
353
|
+
return this;
|
354
|
+
},
|
355
|
+
|
215
356
|
_map: { english: 'en', french: 'fr', german: 'de', japanese: 'ja', jp: 'ja', spanish: 'es' },
|
216
357
|
|
217
358
|
/**
|
@@ -286,4 +427,15 @@ SC.stringsFor = function(languageCode, strings) {
|
|
286
427
|
return this ;
|
287
428
|
} ;
|
288
429
|
|
430
|
+
/**
|
431
|
+
Just like SC.stringsFor, but for metrics.
|
289
432
|
|
433
|
+
@param {String} languageCode
|
434
|
+
@param {Hash} metrics
|
435
|
+
@returns {Object} receiver
|
436
|
+
*/
|
437
|
+
SC.metricsFor = function(languageCode, metrics) {
|
438
|
+
var locale = SC.Locale.localeClassFor(languageCode);
|
439
|
+
locale.addMetrics(metrics);
|
440
|
+
return this;
|
441
|
+
};
|
@@ -50,7 +50,8 @@ SC.COMBO_STYLES = {
|
|
50
50
|
context.begin() <-- begins a new tag context
|
51
51
|
context.end() <-- ends the tag context...
|
52
52
|
*/
|
53
|
-
SC.RenderContext = SC.Builder.create(
|
53
|
+
SC.RenderContext = SC.Builder.create(
|
54
|
+
/** @lends SC.RenderContext */ {
|
54
55
|
|
55
56
|
SELF_CLOSING: SC.CoreSet.create().addEach(['area', 'base', 'basefront', 'br', 'hr', 'input', 'img', 'link', 'meta']),
|
56
57
|
|
@@ -259,7 +260,7 @@ SC.RenderContext = SC.Builder.create(/** SC.RenderContext.fn */ {
|
|
259
260
|
@returns {DOMElement} the element
|
260
261
|
*/
|
261
262
|
element: function() {
|
262
|
-
return this._elem ? this._elem : SC.$(this.join())[0]
|
263
|
+
return this._elem ? this._elem : SC.$(this.join())[0];
|
263
264
|
},
|
264
265
|
|
265
266
|
/**
|
@@ -295,7 +296,7 @@ SC.RenderContext = SC.Builder.create(/** SC.RenderContext.fn */ {
|
|
295
296
|
update: function() {
|
296
297
|
var elem = this._elem,
|
297
298
|
mode = this.updateMode,
|
298
|
-
cq,
|
299
|
+
cq, value, factory, cur, next;
|
299
300
|
|
300
301
|
this._innerHTMLReplaced = NO;
|
301
302
|
|
@@ -318,14 +319,13 @@ SC.RenderContext = SC.Builder.create(/** SC.RenderContext.fn */ {
|
|
318
319
|
} else {
|
319
320
|
factory = elem.cloneNode(false);
|
320
321
|
factory.innerHTML = this.join() ;
|
321
|
-
before = (mode === SC.MODE_APPEND) ? null : elem.firstChild;
|
322
322
|
cur = factory.firstChild ;
|
323
323
|
while(cur) {
|
324
324
|
next = cur.nextSibling ;
|
325
325
|
elem.insertBefore(cur, next);
|
326
326
|
cur = next ;
|
327
327
|
}
|
328
|
-
cur = next = factory =
|
328
|
+
cur = next = factory = null ; // cleanup
|
329
329
|
}
|
330
330
|
}
|
331
331
|
|
@@ -595,8 +595,9 @@ SC.RenderContext = SC.Builder.create(/** SC.RenderContext.fn */ {
|
|
595
595
|
this._classNamesDidChange = YES ;
|
596
596
|
}
|
597
597
|
} else {
|
598
|
+
var cl;
|
598
599
|
for(var i = 0, iLen= nameOrClasses.length; i<iLen; i++){
|
599
|
-
|
600
|
+
cl = nameOrClasses[i];
|
600
601
|
if (classNames.indexOf(cl)<0) {
|
601
602
|
classNames.push(cl);
|
602
603
|
this._classNamesDidChange = YES ;
|