sproutcore 1.5.0.pre.3 → 1.5.0.pre.4
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/.rspec +1 -0
- data/CHANGELOG +42 -0
- data/README.txt +25 -0
- data/VERSION.yml +1 -1
- data/bin/sc-build +1 -1
- data/bin/sc-build-number +1 -1
- data/bin/sc-docs +1 -1
- data/bin/sc-gen +1 -1
- data/bin/sc-init +1 -1
- data/bin/sc-manifest +1 -1
- data/bin/sc-server +1 -1
- data/bin/sproutcore +1 -1
- data/lib/buildtasks/build.rake +5 -0
- data/lib/buildtasks/manifest.rake +20 -1
- data/lib/frameworks/sproutcore/Buildfile +12 -9
- data/lib/frameworks/sproutcore/CHANGELOG.md +48 -0
- data/lib/frameworks/sproutcore/apps/greenhouse/README +2 -9
- data/lib/frameworks/sproutcore/apps/greenhouse/TODO +11 -27
- data/lib/frameworks/sproutcore/apps/greenhouse/controllers/library.js +3 -10
- data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/main-page.css +4 -31
- data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/dialogs.js +5 -4
- data/lib/frameworks/sproutcore/apps/greenhouse/models/dir.js +3 -3
- data/lib/frameworks/sproutcore/apps/greenhouse/models/file.js +2 -2
- data/lib/frameworks/sproutcore/apps/greenhouse/states/main.js +31 -14
- data/lib/frameworks/sproutcore/apps/greenhouse/states/modals.js +2 -1
- data/lib/frameworks/sproutcore/apps/greenhouse/states/ready.js +27 -1
- data/lib/frameworks/sproutcore/apps/greenhouse/tests/views/list_item.js +1 -0
- data/lib/frameworks/sproutcore/apps/greenhouse/tests/views/plist_item.js +20 -0
- data/lib/frameworks/sproutcore/apps/greenhouse/theme.js +25 -0
- data/lib/frameworks/sproutcore/apps/greenhouse/views/plist_item.js +161 -24
- data/lib/frameworks/sproutcore/apps/greenhouse/views/tear_off_picker.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +37 -25
- data/lib/frameworks/sproutcore/frameworks/bootstrap/tests/system/browser.js +135 -26
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/controllers/array.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/controllers/controller.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/controllers/object.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/core.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/ext/object.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/ext/run_loop.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/mixins/delegate_support.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/mixins/responder_context.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/mixins/selection_support.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/mixins/string.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/keyboard.js +68 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/layout.js +108 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/panes/main.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/manipulation.js +27 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/panes/pane.js +215 -505
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/template.js +24 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/visibility.js +11 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/protocols/observable_protocol.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/protocols/sparse_array_delegate.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/resources/core.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/resources/view.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/application.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/browser.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/builder.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/core_query.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/cursor.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/device.js +210 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/event.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/json.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/locale.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/page.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/platform.js +31 -5
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/ready.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/render_context.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/responder.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/root_responder.js +83 -110
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/selection_set.js +7 -4
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/sparse_array.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/theme.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/timer.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/utils/rect.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +151 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/array_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/enum_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/null_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/selection_support.js +26 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/single_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/object/empty_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/object/multiple_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/object/single_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/object/single_enumerable_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/mixins/responder_context.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/mixins/string.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/panes/template.js +14 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/builder.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/core_query/within.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/json.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/locale.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/begin.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/element.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/end.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/get.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/helpers_attr.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/helpers_basic.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/helpers_className.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/helpers_style.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/init.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/join.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/push_text.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/tag.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/update.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/makeKeyPane.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/makeMainPane.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/makeMenuPane.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/root_responder.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/targetForAction.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/add.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/copy.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/indexSetForSource.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/isEqual.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/remove.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/sparse_array.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/theme.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/invalidate.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/invokeLater.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/isPaused.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/performAction.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/schedule.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/utils/normalizeURL.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/utils/offset.js +268 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/utils/rect.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/main_pane.js +43 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/append_remove.js +107 -18
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/child_view.js +20 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/firstResponder.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/keyPane.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/layout.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/sendEvent.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/checkbox_support.js +32 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/text_field_support.js +73 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template_view/collection.js +65 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template_view/core.js +67 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template_view/handlebars.js +295 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/animation.js +19 -18
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/build.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/build_children.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/clippingFrame.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/convertFrames.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/convertLayouts.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/createChildViews.js +18 -15
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/createLayer.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/destroyLayer.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/didAppendToDocument.js +11 -8
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/findLayerInParentLayer.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/init.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/insertBefore.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/isVisible.js +28 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/isVisibleInWindow.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/keyboard.js +22 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/layer.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/layoutChildViews.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutDidChange.js +180 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +640 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/parentViewDidChange.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/prepareContext.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/removeChild.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/render.js +125 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/render_delegate_support.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/replaceChild.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/static_layout.js +21 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/theme.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/updateLayer.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/updateLayerLocation.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/view.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/viewDidResize.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template/checkbox_support.js +20 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template/collection.js +99 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template/text_field_support.js +35 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template.js +77 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +187 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/base.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/cursor.js +41 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/enabled.js +57 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/keyboard.js +223 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +1150 -0
- data/lib/frameworks/sproutcore/frameworks/{amber/views → core_foundation/views/view}/layout_style.js +93 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +489 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/theming.js +362 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/touch.js +67 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/visibility.js +113 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +1280 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/models/child_attribute.js +27 -53
- data/lib/frameworks/sproutcore/frameworks/datastore/models/children_attribute.js +13 -19
- data/lib/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +183 -71
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +26 -46
- data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +25 -4
- data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +139 -21
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/data_sources/fixtures.js +6 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/integration/cyclical_relationship.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/{parentless.js → data_store.js} +62 -16
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record.js +51 -17
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array.js +36 -10
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array_complex.js +11 -11
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_complex.js +8 -8
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/normalize.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/{foundation/english.lproj → datetime/resources}/strings.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/{foundation → datetime}/system/datetime.js +5 -37
- data/lib/frameworks/sproutcore/frameworks/{foundation → datetime}/tests/system/datetime.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/debug/core.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/designer/controllers/designs.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/designer/designers/object_designer.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/designer/designers/view_designer.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/designer/views/designer_drop_target.js +9 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/segmented.css +71 -70
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +10 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segment.js +4 -19
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segmented.js +33 -14
- data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +25 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/date_field/ui.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/methods.js +25 -103
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +102 -92
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/tab/ui.js +22 -25
- data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +38 -25
- data/lib/frameworks/sproutcore/frameworks/desktop/views/date_field.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segment.js +42 -22
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +513 -230
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +0 -2
- data/lib/frameworks/sproutcore/frameworks/experimental/README.md +23 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/device_motion/README.md +11 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/device_motion/device.js +215 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/device_motion/platform.js +67 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/README.md +34 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/models/polymorphic_single_attribute.js +183 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/models/record.js +23 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/tests/models/polymorphic/single.js +124 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +0 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inner_frame.js +151 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/canvas_image.js +27 -17
- data/lib/frameworks/sproutcore/frameworks/foundation/system/image_queue.js +6 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/system/logger.js +163 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/system/user_defaults.js +6 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/beginEditing.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/logger.js +44 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/image/ui.js +200 -167
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/views/image.js +52 -137
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +7 -11
- data/lib/frameworks/sproutcore/frameworks/handlebars/extensions.js +138 -0
- data/lib/frameworks/sproutcore/frameworks/handlebars/handlebars.js +1338 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +32 -26
- data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/base.js +162 -3
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +10 -5
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +123 -3
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +12 -5
- data/lib/frameworks/sproutcore/frameworks/runtime/private/chain_observer.js +50 -13
- data/lib/frameworks/sproutcore/frameworks/runtime/system/logger.js +163 -333
- data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +58 -8
- data/lib/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/itemType.js +9 -6
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/makeArray.js +15 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/array.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/chained.js +31 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/observable.js +18 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/logger.js +31 -143
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/concatenated_properties.js +71 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/enhance.js +177 -0
- data/lib/frameworks/sproutcore/frameworks/table/views/table.js +5 -4
- data/lib/frameworks/sproutcore/frameworks/table/views/table_header.js +5 -3
- data/lib/frameworks/sproutcore/themes/ace/resources/button/button.js +8 -2
- data/lib/frameworks/sproutcore/themes/ace/resources/menu/menu.css +2 -3
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/18px/segmented.css +1 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/24px/segmented.css +1 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/30px/segmented.css +1 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/44px/segmented.css +1 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/segmented.css +2 -2
- data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/segmented.css +62 -62
- data/lib/gen/html_app/Buildfile +36 -0
- data/lib/gen/html_app/README +1 -0
- data/lib/gen/html_app/USAGE +15 -0
- data/lib/gen/html_app/templates/apps/@target_name@/@target_name@.js +14 -0
- data/lib/gen/html_app/templates/apps/@target_name@/resources/images/.gitkeep +0 -0
- data/lib/gen/html_app/templates/apps/@target_name@/resources/stylesheets/@target_name@.css +0 -0
- data/lib/gen/html_app/templates/apps/@target_name@/resources/templates/@target_name@.handlebars +1 -0
- data/lib/gen/html_project/Buildfile +45 -0
- data/lib/gen/html_project/INIT +3 -0
- data/lib/gen/html_project/README +1 -0
- data/lib/gen/html_project/USAGE +2 -0
- data/lib/gen/html_project/templates/@filename@/Buildfile +8 -0
- data/lib/gen/html_project/templates/@filename@/README +7 -0
- data/lib/sproutcore/builders/handlebars.rb +30 -0
- data/lib/sproutcore/builders.rb +1 -1
- data/lib/sproutcore/helpers/static_helper.rb +3 -3
- data/lib/sproutcore/tools/init.rb +25 -9
- data/spec/buildtasks/manifest/prepare_build_tasks/handlebars_spec.rb +39 -0
- data/spec/fixtures/builder_tests/apps/handlebars_test/template.handlebars +5 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/templates/demo.handlebars +4 -0
- data/spec/lib/builders/handlebars_spec.rb +29 -0
- data/vendor/chance/lib/chance/imagers/data_url.rb +20 -7
- data/vendor/chance/lib/chance/instance.rb +4 -1
- data/vendor/chance/lib/chance/parser.rb +31 -31
- data/vendor/chance/lib/chance/slicing.rb +38 -8
- metadata +195 -225
- data/lib/frameworks/sproutcore/frameworks/amber/system/device.js +0 -143
- data/lib/frameworks/sproutcore/frameworks/amber/system/utils.js +0 -174
- data/lib/frameworks/sproutcore/frameworks/amber/tests/views/main_pane.js +0 -31
- data/lib/frameworks/sproutcore/frameworks/amber/tests/views/pane/sendTouchEvent.js +0 -267
- data/lib/frameworks/sproutcore/frameworks/amber/tests/views/view/layoutDidChange.js +0 -149
- data/lib/frameworks/sproutcore/frameworks/amber/tests/views/view/layoutStyle.js +0 -602
- data/lib/frameworks/sproutcore/frameworks/amber/tests/views/view/render.js +0 -115
- data/lib/frameworks/sproutcore/frameworks/amber/views/base.js +0 -1
- data/lib/frameworks/sproutcore/frameworks/amber/views/view.js +0 -4003
- data/lib/frameworks/sproutcore/frameworks/datastore/models/child_record.js +0 -105
|
@@ -27,66 +27,57 @@ sc_require('models/record_attribute');
|
|
|
27
27
|
SC.ChildAttribute = SC.RecordAttribute.extend(
|
|
28
28
|
/** @scope SC.ChildAttribute.prototype */ {
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
isNestedRecordTransform: YES,
|
|
31
31
|
|
|
32
32
|
// ..........................................................
|
|
33
33
|
// LOW-LEVEL METHODS
|
|
34
34
|
//
|
|
35
35
|
|
|
36
|
-
/** @private - adapted for to
|
|
37
|
-
toType: function(
|
|
38
|
-
var ret = null,
|
|
39
|
-
cacheKey = SC.keyFor('__kid__', SC.guidFor(this)),
|
|
36
|
+
/** @private - adapted for to one relationship */
|
|
37
|
+
toType: function(record, key, value) {
|
|
38
|
+
var ret = null, rel,
|
|
40
39
|
recordType = this.get('typeClass');
|
|
41
|
-
|
|
42
|
-
if (
|
|
43
|
-
|
|
44
|
-
if (!parentRecord) {
|
|
40
|
+
|
|
41
|
+
if (!record) {
|
|
45
42
|
throw 'SC.Child: Error during transform: Unable to retrieve parent record.';
|
|
46
43
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (hash){
|
|
50
|
-
// Get the record type.
|
|
51
|
-
var childNS = parentRecord.get('childRecordNamespace');
|
|
52
|
-
if (hash.type && !SC.none(childNS)) {
|
|
53
|
-
recordType = childNS[hash.type];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (!recordType || SC.typeOf(recordType) !== SC.T_CLASS) {
|
|
57
|
-
throw 'SC.Child: Error during transform: Invalid record type.';
|
|
58
|
-
}
|
|
59
|
-
// Create an instance of the record by registering it with the parent and return.
|
|
60
|
-
ret = parentRecord[cacheKey] = parentRecord.registerChildRecord(recordType, hash);
|
|
61
|
-
}
|
|
44
|
+
if (!SC.none(value)) ret = record.registerNestedRecord(value, key);
|
|
45
|
+
|
|
62
46
|
return ret;
|
|
63
47
|
},
|
|
64
48
|
|
|
65
49
|
// Default fromType is just returning itself
|
|
66
50
|
fromType: function(record, key, value){
|
|
67
|
-
|
|
51
|
+
var sk, store, ret;
|
|
52
|
+
if (record){
|
|
53
|
+
ret = record.registerNestedRecord(value, key, key);
|
|
54
|
+
if (ret) {
|
|
55
|
+
sk = ret.get('storeKey');
|
|
56
|
+
store = ret.get('store');
|
|
57
|
+
record.writeAttribute(key, store.readDataHash(sk));
|
|
58
|
+
}
|
|
59
|
+
else if (value) {
|
|
60
|
+
record.writeAttribute(key, value);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return ret;
|
|
68
65
|
},
|
|
69
66
|
|
|
70
67
|
/**
|
|
71
68
|
The core handler. Called from the property.
|
|
72
|
-
|
|
73
69
|
@param {SC.Record} record the record instance
|
|
74
70
|
@param {String} key the key used to access this attribute on the record
|
|
75
71
|
@param {Object} value the property value if called as a setter
|
|
76
72
|
@returns {Object} property value
|
|
77
73
|
*/
|
|
78
74
|
call: function(record, key, value) {
|
|
79
|
-
var attrKey = this.get('key') || key,
|
|
80
|
-
cacheKey = SC.keyFor('__kid__', SC.guidFor(this))
|
|
81
|
-
nvalue;
|
|
75
|
+
var attrKey = this.get('key') || key, cRef,
|
|
76
|
+
cacheKey = SC.keyFor('__kid__', SC.guidFor(this));
|
|
82
77
|
if (value !== undefined) {
|
|
83
|
-
//
|
|
84
|
-
//
|
|
85
|
-
|
|
86
|
-
nvalue = this.fromType(record, key, value) ; // convert to attribute.
|
|
87
|
-
record[cacheKey] = null;
|
|
88
|
-
record.writeAttribute(attrKey, nvalue);
|
|
89
|
-
value = this.toType(record, key, value); // need to convert to the child record for caching
|
|
78
|
+
// this.orphan(record, cacheKey, value);
|
|
79
|
+
value = this.fromType(record, key, value) ; // convert to attribute.
|
|
80
|
+
// record[cacheKey] = value;
|
|
90
81
|
} else {
|
|
91
82
|
value = record.readAttribute(attrKey);
|
|
92
83
|
if (SC.none(value) && (value = this.get('defaultValue'))) {
|
|
@@ -99,23 +90,6 @@ SC.ChildAttribute = SC.RecordAttribute.extend(
|
|
|
99
90
|
}
|
|
100
91
|
|
|
101
92
|
return value ;
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
orphan: function(parentRecord){
|
|
105
|
-
var cacheKey = SC.keyFor('__kid__', SC.guidFor(this)),
|
|
106
|
-
store, storeKey, attrs, key, param, cRef;
|
|
107
|
-
cRef = parentRecord ? parentRecord[cacheKey] : null;
|
|
108
|
-
if (cRef) {
|
|
109
|
-
attrs = cRef.get('readOnlyAttributes');
|
|
110
|
-
for(key in attrs) {
|
|
111
|
-
param = cRef[key];
|
|
112
|
-
// Orphan all the child record and child records in a tree to clean up the store
|
|
113
|
-
if(param && param.isChildRecordTransform) param.orphan(parentRecord);
|
|
114
|
-
}
|
|
115
|
-
store = cRef.get('store');
|
|
116
|
-
if(store) storeKey = cRef.storeKey;
|
|
117
|
-
if(storeKey) store.unloadRecord(undefined, undefined, storeKey);
|
|
118
|
-
}
|
|
119
93
|
}
|
|
120
94
|
});
|
|
121
95
|
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
sc_require('models/record');
|
|
8
8
|
sc_require('models/record_attribute');
|
|
9
9
|
sc_require('models/child_attribute');
|
|
10
|
+
sc_require('system/child_array');
|
|
10
11
|
|
|
11
12
|
/** @class
|
|
12
13
|
|
|
@@ -48,7 +49,7 @@ SC.ChildrenAttribute = SC.ChildAttribute.extend(
|
|
|
48
49
|
defaultRecordType: recordType
|
|
49
50
|
});
|
|
50
51
|
|
|
51
|
-
record[arrayKey] =
|
|
52
|
+
record[arrayKey] = ret ; // save on record
|
|
52
53
|
rel = record.get('relationships');
|
|
53
54
|
if (!rel) record.set('relationships', rel = []);
|
|
54
55
|
rel.push(ret); // make sure we get notified of changes...
|
|
@@ -56,25 +57,18 @@ SC.ChildrenAttribute = SC.ChildAttribute.extend(
|
|
|
56
57
|
|
|
57
58
|
return ret;
|
|
58
59
|
},
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
for(key in attrs) {
|
|
69
|
-
param = cr[key];
|
|
70
|
-
// Orphan all the child record and child records in a tree to clean up the store
|
|
71
|
-
if(param && param.isChildRecordTransform) param.orphan(parentRecord);
|
|
72
|
-
}
|
|
73
|
-
store = cr.get('store');
|
|
74
|
-
if(store) storeKey = cr.storeKey;
|
|
75
|
-
if(storeKey) store.unloadRecord(undefined, undefined, storeKey);
|
|
76
|
-
}, this);
|
|
60
|
+
|
|
61
|
+
// Default fromType is just returning itself
|
|
62
|
+
fromType: function(record, key, value){
|
|
63
|
+
var sk, store,
|
|
64
|
+
arrayKey = SC.keyFor('__kidsArray__', SC.guidFor(this)),
|
|
65
|
+
ret = record[arrayKey];
|
|
66
|
+
if (record) {
|
|
67
|
+
record.writeAttribute(key, value);
|
|
68
|
+
if (ret) ret = ret.recordPropertyDidChange();
|
|
77
69
|
}
|
|
70
|
+
|
|
71
|
+
return ret;
|
|
78
72
|
}
|
|
79
73
|
});
|
|
80
74
|
|
|
@@ -46,6 +46,11 @@ SC.Record = SC.Object.extend(
|
|
|
46
46
|
*/
|
|
47
47
|
isRecord: YES,
|
|
48
48
|
|
|
49
|
+
/**
|
|
50
|
+
If you have nested records
|
|
51
|
+
*/
|
|
52
|
+
isParentRecord: NO,
|
|
53
|
+
|
|
49
54
|
// ...............................
|
|
50
55
|
// PROPERTIES
|
|
51
56
|
//
|
|
@@ -202,15 +207,27 @@ SC.Record = SC.Object.extend(
|
|
|
202
207
|
}.property(),
|
|
203
208
|
|
|
204
209
|
/**
|
|
205
|
-
* The
|
|
210
|
+
* The namespace which to retrieve the childRecord Types from
|
|
206
211
|
*/
|
|
207
|
-
|
|
212
|
+
nestedRecordNamespace: null,
|
|
208
213
|
|
|
209
214
|
/**
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
215
|
+
Function that returns whether this is a nested Record
|
|
216
|
+
*/
|
|
217
|
+
isNestedRecord: function(){
|
|
218
|
+
var store = this.get('store'), ret,
|
|
219
|
+
sk = this.get('storeKey'),
|
|
220
|
+
prKey = store.parentStoreKeyExists(sk);
|
|
221
|
+
|
|
222
|
+
ret = prKey ? YES : NO;
|
|
223
|
+
return ret;
|
|
224
|
+
}.property().cacheable(),
|
|
225
|
+
|
|
226
|
+
parentRecord: function(){
|
|
227
|
+
var sk = this.storeKey, store = this.get('store');
|
|
228
|
+
return store.materializeParentRecord(sk);
|
|
229
|
+
}.property(),
|
|
230
|
+
|
|
214
231
|
// ...............................
|
|
215
232
|
// CRUD OPERATIONS
|
|
216
233
|
//
|
|
@@ -221,10 +238,26 @@ SC.Record = SC.Object.extend(
|
|
|
221
238
|
record data from the server. If the record is new and exists only in
|
|
222
239
|
memory then this call will have no effect.
|
|
223
240
|
|
|
241
|
+
@param {boolean} recordOnly, optional param if you want to only THIS record
|
|
242
|
+
even if it is a child record.
|
|
243
|
+
|
|
224
244
|
@returns {SC.Record} receiver
|
|
225
245
|
*/
|
|
226
|
-
refresh: function() {
|
|
227
|
-
this.get('store')
|
|
246
|
+
refresh: function(recordOnly) {
|
|
247
|
+
var store = this.get('store'), rec, ro,
|
|
248
|
+
sk = this.get('storeKey'),
|
|
249
|
+
prKey = store.parentStoreKeyExists();
|
|
250
|
+
|
|
251
|
+
// If we only want to commit this record or it doesn't have a parent record
|
|
252
|
+
// we will commit this record
|
|
253
|
+
ro = recordOnly || (SC.none(recordOnly) && SC.none(prKey));
|
|
254
|
+
if (ro){
|
|
255
|
+
store.refreshRecord(null, null, sk);
|
|
256
|
+
} else if (prKey){
|
|
257
|
+
rec = store.materializeRecord(prKey);
|
|
258
|
+
rec.refresh(recordOnly);
|
|
259
|
+
}
|
|
260
|
+
|
|
228
261
|
return this ;
|
|
229
262
|
},
|
|
230
263
|
|
|
@@ -234,16 +267,31 @@ SC.Record = SC.Object.extend(
|
|
|
234
267
|
property on the record to YES. If this is a new record, this will avoid
|
|
235
268
|
creating the record in the first place.
|
|
236
269
|
|
|
270
|
+
@param {boolean} recordOnly, optional param if you want to only THIS record
|
|
271
|
+
even if it is a child record.
|
|
272
|
+
|
|
237
273
|
@returns {SC.Record} receiver
|
|
238
274
|
*/
|
|
239
|
-
destroy: function() {
|
|
240
|
-
this.get('store')
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
//
|
|
245
|
-
this
|
|
246
|
-
|
|
275
|
+
destroy: function(recordOnly) {
|
|
276
|
+
var store = this.get('store'), rec, ro,
|
|
277
|
+
sk = this.get('storeKey'),
|
|
278
|
+
prKey = store.parentStoreKeyExists();
|
|
279
|
+
|
|
280
|
+
// If we only want to commit this record or it doesn't have a parent record
|
|
281
|
+
// we will commit this record
|
|
282
|
+
ro = recordOnly || (SC.none(recordOnly) && SC.none(prKey));
|
|
283
|
+
if (ro){
|
|
284
|
+
store.destroyRecord(null, null, sk);
|
|
285
|
+
this.notifyPropertyChange('status');
|
|
286
|
+
// If there are any aggregate records, we might need to propagate our new
|
|
287
|
+
// status to them.
|
|
288
|
+
this.propagateToAggregates();
|
|
289
|
+
|
|
290
|
+
} else if (prKey){
|
|
291
|
+
rec = store.materializeRecord(prKey);
|
|
292
|
+
rec.destroy(recordOnly);
|
|
293
|
+
}
|
|
294
|
+
|
|
247
295
|
return this ;
|
|
248
296
|
},
|
|
249
297
|
|
|
@@ -262,6 +310,11 @@ SC.Record = SC.Object.extend(
|
|
|
262
310
|
@returns {SC.Record} receiver
|
|
263
311
|
*/
|
|
264
312
|
recordDidChange: function(key) {
|
|
313
|
+
|
|
314
|
+
// If we have a parent, they changed too!
|
|
315
|
+
var p = this.get('parentRecord');
|
|
316
|
+
if (p) p.recordDidChange();
|
|
317
|
+
|
|
265
318
|
this.get('store').recordDidChange(null, null, this.get('storeKey'), key);
|
|
266
319
|
this.notifyPropertyChange('status');
|
|
267
320
|
|
|
@@ -452,7 +505,7 @@ SC.Record = SC.Object.extend(
|
|
|
452
505
|
// also notify manyArrays
|
|
453
506
|
var manyArrays = this.relationships,
|
|
454
507
|
loc = manyArrays ? manyArrays.length : 0 ;
|
|
455
|
-
while(--loc>=0) manyArrays[loc].recordPropertyDidChange(keys);
|
|
508
|
+
while(--loc>=0) manyArrays[loc].recordPropertyDidChange(keys);
|
|
456
509
|
}
|
|
457
510
|
},
|
|
458
511
|
|
|
@@ -496,7 +549,7 @@ SC.Record = SC.Object.extend(
|
|
|
496
549
|
if (typeClass) {
|
|
497
550
|
keyForDataHash = valueForKey.get('key') || key; // handle alt keys
|
|
498
551
|
isRecord = SC.typeOf(typeClass.call(valueForKey))===SC.T_CLASS;
|
|
499
|
-
isChild = valueForKey.
|
|
552
|
+
isChild = valueForKey.isNestedRecordTransform;
|
|
500
553
|
if (!isRecord && !isChild) {
|
|
501
554
|
attrValue = this.get(key);
|
|
502
555
|
if(attrValue!==undefined || (attrValue===null && includeNull)) {
|
|
@@ -591,11 +644,25 @@ SC.Record = SC.Object.extend(
|
|
|
591
644
|
|
|
592
645
|
@param {Hash} params optional additonal params that will passed down
|
|
593
646
|
to the data source
|
|
647
|
+
@param {boolean} recordOnly, optional param if you want to only commit a single
|
|
648
|
+
record if it has a parent.
|
|
594
649
|
@returns {SC.Record} receiver
|
|
595
650
|
*/
|
|
596
|
-
commitRecord: function(params) {
|
|
597
|
-
var store = this.get('store')
|
|
598
|
-
|
|
651
|
+
commitRecord: function(params, recordOnly) {
|
|
652
|
+
var store = this.get('store'), rec, ro,
|
|
653
|
+
sk = this.get('storeKey'),
|
|
654
|
+
prKey = store.parentStoreKeyExists();
|
|
655
|
+
|
|
656
|
+
// If we only want to commit this record or it doesn't have a parent record
|
|
657
|
+
// we will commit this record
|
|
658
|
+
ro = recordOnly || (SC.none(recordOnly) && SC.none(prKey));
|
|
659
|
+
if (ro){
|
|
660
|
+
store.commitRecord(undefined, undefined, this.get('storeKey'), params);
|
|
661
|
+
} else if (prKey){
|
|
662
|
+
rec = store.materializeRecord(prKey);
|
|
663
|
+
rec.commitRecord(params, recordOnly);
|
|
664
|
+
}
|
|
665
|
+
|
|
599
666
|
return this ;
|
|
600
667
|
},
|
|
601
668
|
|
|
@@ -698,64 +765,119 @@ SC.Record = SC.Object.extend(
|
|
|
698
765
|
instance. If not, create the child record instance and add it to the child
|
|
699
766
|
record cache.
|
|
700
767
|
|
|
701
|
-
@param {
|
|
702
|
-
|
|
703
|
-
@param {Hash} hash The hash of attributes to apply to the child record.
|
|
768
|
+
@param {Hash} value The hash of attributes to apply to the child record.
|
|
769
|
+
@param {Integer} key The store key that we are asking for
|
|
704
770
|
*/
|
|
705
|
-
|
|
706
|
-
var
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
if
|
|
711
|
-
|
|
771
|
+
registerNestedRecord: function(value, key, path) {
|
|
772
|
+
var store, psk, csk, childRecord, recordType;
|
|
773
|
+
|
|
774
|
+
// if no path is entered it must be the key
|
|
775
|
+
if (SC.none(path)) path = key;
|
|
776
|
+
// if a record instance is passed, simply use the storeKey. This allows
|
|
777
|
+
// you to pass a record from a chained store to get the same record in the
|
|
778
|
+
// current store.
|
|
779
|
+
if (value && value.get && value.get('isRecord')) {
|
|
780
|
+
childRecord = value;
|
|
781
|
+
}
|
|
782
|
+
else {
|
|
783
|
+
recordType = this._materializeNestedRecordType(value, key);
|
|
784
|
+
childRecord = this.createNestedRecord(recordType, value);
|
|
785
|
+
}
|
|
786
|
+
if (childRecord){
|
|
787
|
+
this.isParentRecord = YES;
|
|
788
|
+
store = this.get('store');
|
|
789
|
+
psk = this.get('storeKey');
|
|
790
|
+
csk = childRecord.get('storeKey');
|
|
791
|
+
store.registerChildToParent(psk, csk, path);
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
return childRecord;
|
|
795
|
+
},
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
private method that retrieves the recordType from the hash that is provided.
|
|
799
|
+
|
|
800
|
+
Important for use in polymorphism but you must have the following items in the
|
|
801
|
+
parent record:
|
|
802
|
+
|
|
803
|
+
nestedRecordNamespace <= this is the object that has the SC.Records defined
|
|
804
|
+
|
|
805
|
+
@param {Hash} value The hash of attributes to apply to the child record.
|
|
806
|
+
@param {String} key the name of the key on the attribute
|
|
807
|
+
*/
|
|
808
|
+
_materializeNestedRecordType: function(value, key){
|
|
809
|
+
var childNS, recordType, ret;
|
|
810
|
+
|
|
811
|
+
// Get the record type, first checking the "type" property on the hash.
|
|
812
|
+
if (SC.typeOf(value) === SC.T_HASH) {
|
|
813
|
+
// Get the record type.
|
|
814
|
+
childNS = this.get('nestedRecordNamespace');
|
|
815
|
+
if (value.type && !SC.none(childNS)) {
|
|
816
|
+
recordType = childNS[value.type];
|
|
817
|
+
}
|
|
712
818
|
}
|
|
713
819
|
|
|
714
|
-
|
|
820
|
+
// Maybe it's not a hash or there was no type property.
|
|
821
|
+
if (!recordType && key && this[key]) {
|
|
822
|
+
recordType = this[key].get('typeClass');
|
|
823
|
+
}
|
|
715
824
|
|
|
716
|
-
|
|
825
|
+
// When all else fails throw and exception.
|
|
826
|
+
if (!recordType || !SC.kindOf(recordType, SC.Record)) {
|
|
827
|
+
throw 'SC.Child: Error during transform: Invalid record type.';
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
return recordType;
|
|
717
831
|
},
|
|
718
832
|
|
|
719
833
|
/**
|
|
720
|
-
Creates a new
|
|
834
|
+
Creates a new nested record instance.
|
|
721
835
|
|
|
722
|
-
@param {SC.
|
|
836
|
+
@param {SC.Record} recordType The type of the nested record to create.
|
|
723
837
|
@param {Hash} hash The hash of attributes to apply to the child record.
|
|
724
838
|
(may be null)
|
|
725
839
|
*/
|
|
726
|
-
|
|
727
|
-
var cr = null;
|
|
840
|
+
createNestedRecord: function(recordType, hash) {
|
|
841
|
+
var store, id, sk, pk, cr = null, existingId = null;
|
|
728
842
|
SC.run(function() {
|
|
729
|
-
// Generate the key used by the parent's child record manager.
|
|
730
|
-
var key = SC.Record._generateChildKey();
|
|
731
843
|
hash = hash || {}; // init if needed
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
var store = this.get('store');
|
|
844
|
+
|
|
845
|
+
existingId = hash[recordType.prototype.primaryKey];
|
|
846
|
+
|
|
847
|
+
store = this.get('store');
|
|
737
848
|
if (SC.none(store)) throw 'Error: during the creation of a child record: NO STORE ON PARENT!';
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
849
|
+
|
|
850
|
+
if (!id && (pk = recordType.prototype.primaryKey)) {
|
|
851
|
+
id = hash[pk];
|
|
852
|
+
// In case there isnt a primary key supplied then we create on
|
|
853
|
+
// on the fly
|
|
854
|
+
sk = id ? store.storeKeyExists(recordType, id) : null;
|
|
855
|
+
if (sk){
|
|
856
|
+
store.writeDataHash(sk, hash);
|
|
857
|
+
cr = store.materializeRecord(sk);
|
|
858
|
+
} else {
|
|
859
|
+
cr = store.createRecord(recordType, hash) ;
|
|
860
|
+
if (SC.none(id)){
|
|
861
|
+
sk = cr.get('storeKey');
|
|
862
|
+
id = 'cr'+sk;
|
|
863
|
+
SC.Store.replaceIdFor(sk, id);
|
|
864
|
+
hash = store.readEditableDataHash(sk);
|
|
865
|
+
hash[pk] = id;
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
|
|
751
869
|
}
|
|
870
|
+
|
|
871
|
+
// ID processing if necessary
|
|
872
|
+
if (SC.none(existingId) && this.generateIdForChild) this.generateIdForChild(cr);
|
|
752
873
|
|
|
753
|
-
crManager[key] = cr;
|
|
754
874
|
}, this);
|
|
755
875
|
|
|
756
876
|
return cr;
|
|
757
877
|
},
|
|
758
878
|
|
|
879
|
+
_nestedRecordKey: 0,
|
|
880
|
+
|
|
759
881
|
/**
|
|
760
882
|
* Override this function if you want to have a special way of creating
|
|
761
883
|
* ids for your child records
|
|
@@ -976,7 +1098,7 @@ SC.Record.mixin( /** @scope SC.Record */ {
|
|
|
976
1098
|
|
|
977
1099
|
@property {SC.Error}
|
|
978
1100
|
*/
|
|
979
|
-
BAD_STATE_ERROR: SC.$error("Internal Inconsistency"),
|
|
1101
|
+
BAD_STATE_ERROR: SC.$error("Internal barf Inconsistency"),
|
|
980
1102
|
|
|
981
1103
|
/**
|
|
982
1104
|
Error for when you try to create a new record that already exists.
|
|
@@ -1083,7 +1205,7 @@ SC.Record.mixin( /** @scope SC.Record */ {
|
|
|
1083
1205
|
*/
|
|
1084
1206
|
toMany: function(recordType, opts) {
|
|
1085
1207
|
opts = opts || {};
|
|
1086
|
-
var isNested = opts.nested;
|
|
1208
|
+
var isNested = opts.nested || opts.isNested;
|
|
1087
1209
|
var attr;
|
|
1088
1210
|
if(isNested){
|
|
1089
1211
|
attr = SC.ChildrenAttribute.attr(recordType, opts);
|
|
@@ -1109,7 +1231,7 @@ SC.Record.mixin( /** @scope SC.Record */ {
|
|
|
1109
1231
|
*/
|
|
1110
1232
|
toOne: function(recordType, opts) {
|
|
1111
1233
|
opts = opts || {};
|
|
1112
|
-
var isNested = opts.nested;
|
|
1234
|
+
var isNested = opts.nested || opts.isNested;
|
|
1113
1235
|
var attr;
|
|
1114
1236
|
if(isNested){
|
|
1115
1237
|
attr = SC.ChildAttribute.attr(recordType, opts);
|
|
@@ -1190,15 +1312,5 @@ SC.Record.mixin( /** @scope SC.Record */ {
|
|
|
1190
1312
|
var ret = SC.Object.extend.apply(this, arguments);
|
|
1191
1313
|
SC.Query._scq_didDefineRecordType(ret);
|
|
1192
1314
|
return ret ;
|
|
1193
|
-
},
|
|
1194
|
-
|
|
1195
|
-
// ..........................................................
|
|
1196
|
-
// PRIVATE METHODS
|
|
1197
|
-
//
|
|
1198
|
-
|
|
1199
|
-
_generateChildKey: function() {
|
|
1200
|
-
var newIdx = SC.Record._nextChildKey + 1;
|
|
1201
|
-
SC.Record._nextChildKey = newIdx;
|
|
1202
|
-
return newIdx;
|
|
1203
1315
|
}
|
|
1204
1316
|
}) ;
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
// ==========================================================================
|
|
7
7
|
|
|
8
8
|
sc_require('models/record');
|
|
9
|
-
sc_require('models/child_record');
|
|
10
9
|
|
|
11
10
|
/** @class
|
|
12
11
|
|
|
@@ -463,7 +462,7 @@ SC.RecordAttribute.registerTransform(Date, {
|
|
|
463
462
|
if (d[12]) { date.setMilliseconds(Number("0." + d[12]) * 1000); }
|
|
464
463
|
if (d[14]) {
|
|
465
464
|
offset = (Number(d[16]) * 60) + Number(d[17]);
|
|
466
|
-
offset *= ((d[15]
|
|
465
|
+
offset *= ((d[15] === '-') ? 1 : -1);
|
|
467
466
|
}
|
|
468
467
|
|
|
469
468
|
offset -= date.getTimezoneOffset();
|