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
|
@@ -52,7 +52,7 @@ SC.ChildArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
|
52
52
|
@property {SC.Store}
|
|
53
53
|
*/
|
|
54
54
|
store: function() {
|
|
55
|
-
return this.
|
|
55
|
+
return this.getPath('record.store');
|
|
56
56
|
}.property('record').cacheable(),
|
|
57
57
|
|
|
58
58
|
/**
|
|
@@ -62,7 +62,7 @@ SC.ChildArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
|
62
62
|
@property {Number}
|
|
63
63
|
*/
|
|
64
64
|
storeKey: function() {
|
|
65
|
-
return this.
|
|
65
|
+
return this.getPath('record.storeKey');
|
|
66
66
|
}.property('record').cacheable(),
|
|
67
67
|
|
|
68
68
|
/**
|
|
@@ -118,7 +118,8 @@ SC.ChildArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
|
118
118
|
objectAt: function(idx) {
|
|
119
119
|
var recs = this._records,
|
|
120
120
|
children = this.get('readOnlyChildren'),
|
|
121
|
-
hash, ret
|
|
121
|
+
hash, ret, pname = this.get('propertyName'),
|
|
122
|
+
parent = this.get('record');
|
|
122
123
|
var len = children ? children.length : 0;
|
|
123
124
|
|
|
124
125
|
if (!children) return undefined; // nothing to do
|
|
@@ -131,7 +132,7 @@ SC.ChildArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
|
131
132
|
if (!hash) return undefined;
|
|
132
133
|
|
|
133
134
|
// not in cache, materialize
|
|
134
|
-
recs[idx] = ret =
|
|
135
|
+
recs[idx] = ret = parent.registerNestedRecord(hash, pname, pname+'.'+idx);
|
|
135
136
|
|
|
136
137
|
return ret;
|
|
137
138
|
},
|
|
@@ -143,20 +144,32 @@ SC.ChildArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
|
143
144
|
replace: function(idx, amt, recs) {
|
|
144
145
|
var children = this.get('editableChildren'),
|
|
145
146
|
len = recs ? (recs.get ? recs.get('length') : recs.length) : 0,
|
|
146
|
-
record = this.get('record'),
|
|
147
|
+
record = this.get('record'), newRecs,
|
|
147
148
|
|
|
148
149
|
pname = this.get('propertyName'),
|
|
149
|
-
cr, recordType;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
this.objectAt(i);
|
|
153
|
-
}
|
|
150
|
+
cr, recordType;
|
|
151
|
+
newRecs = this._processRecordsToHashes(recs);
|
|
152
|
+
children.replace(idx, amt, newRecs);
|
|
154
153
|
// notify that the record did change...
|
|
155
154
|
record.recordDidChange(pname);
|
|
156
|
-
|
|
155
|
+
|
|
157
156
|
return this;
|
|
158
157
|
},
|
|
159
158
|
|
|
159
|
+
_processRecordsToHashes: function(recs){
|
|
160
|
+
var store, sk;
|
|
161
|
+
recs = recs || [];
|
|
162
|
+
recs.forEach( function(me, idx){
|
|
163
|
+
if (me.isNestedRecord){
|
|
164
|
+
store = me.get('store');
|
|
165
|
+
sk = me.storeKey;
|
|
166
|
+
recs[idx] = store.readDataHash(sk);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
return recs;
|
|
171
|
+
},
|
|
172
|
+
|
|
160
173
|
/*
|
|
161
174
|
calls normalize on each object in the array
|
|
162
175
|
*/
|
|
@@ -170,57 +183,24 @@ SC.ChildArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
|
170
183
|
// INTERNAL SUPPORT
|
|
171
184
|
//
|
|
172
185
|
|
|
173
|
-
/** @private
|
|
174
|
-
Call to create an object from a hash
|
|
175
|
-
*/
|
|
176
|
-
_materializeChild: function(hash){
|
|
177
|
-
var store = this.get('store'),
|
|
178
|
-
parentRecord = this.get('record'),
|
|
179
|
-
recordType = this.get('defaultRecordType'),
|
|
180
|
-
id, ret, storeKey, pm;
|
|
181
|
-
|
|
182
|
-
// Find the record type
|
|
183
|
-
if (!parentRecord) return undefined;
|
|
184
|
-
var nspace = parentRecord.get('childRecordNamespace');
|
|
185
|
-
// Get the record type.
|
|
186
|
-
if (hash.type && !SC.none(nspace)) {
|
|
187
|
-
recordType = nspace[hash.type];
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
if (!recordType || SC.typeOf(recordType) !== SC.T_CLASS) {
|
|
191
|
-
throw 'ChildrenArray: Error during transform: Invalid record type.';
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
pm = recordType.prototype.primaryKey || 'childRecordKey';
|
|
195
|
-
id = hash[pm];
|
|
196
|
-
storeKey = store.storeKeyExists(recordType, id);
|
|
197
|
-
if (storeKey){
|
|
198
|
-
ret = store.materializeRecord(storeKey);
|
|
199
|
-
}
|
|
200
|
-
else {
|
|
201
|
-
ret = parentRecord.registerChildRecord(recordType, hash);
|
|
202
|
-
}
|
|
203
|
-
return ret;
|
|
204
|
-
},
|
|
205
|
-
|
|
206
186
|
/** @private
|
|
207
187
|
Invoked whenever the children array changes. Observes changes.
|
|
208
188
|
*/
|
|
209
189
|
recordPropertyDidChange: function(keys) {
|
|
210
|
-
|
|
211
190
|
if (keys && !keys.contains(this.get('propertyName'))) return this;
|
|
212
191
|
|
|
213
192
|
var children = this.get('readOnlyChildren');
|
|
214
193
|
var prev = this._prevChildren, f = this._childrenContentDidChange;
|
|
215
194
|
|
|
216
195
|
if (children === prev) return this; // nothing to do
|
|
217
|
-
|
|
196
|
+
|
|
218
197
|
if (prev) prev.removeObserver('[]', this, f);
|
|
219
198
|
this._prevChildren = children;
|
|
220
199
|
if (children) children.addObserver('[]', this, f);
|
|
221
200
|
|
|
222
201
|
var rev = (children) ? children.propertyRevision : -1 ;
|
|
223
202
|
this._childrenContentDidChange(children, '[]', children, rev);
|
|
203
|
+
return this;
|
|
224
204
|
},
|
|
225
205
|
|
|
226
206
|
/** @private
|
|
@@ -185,7 +185,7 @@ SC.NestedStore = SC.Store.extend(
|
|
|
185
185
|
@returns {SC.Store} receiver
|
|
186
186
|
*/
|
|
187
187
|
reset: function() {
|
|
188
|
-
|
|
188
|
+
var nRecords, nr, sk;
|
|
189
189
|
// requires a pstore to reset
|
|
190
190
|
var parentStore = this.get('parentStore');
|
|
191
191
|
if (!parentStore) throw SC.Store.NO_PARENT_STORE_ERROR;
|
|
@@ -195,6 +195,10 @@ SC.NestedStore = SC.Store.extend(
|
|
|
195
195
|
this.revisions = SC.beget(parentStore.revisions);
|
|
196
196
|
this.statuses = SC.beget(parentStore.statuses);
|
|
197
197
|
|
|
198
|
+
// beget nested records references
|
|
199
|
+
this.childRecords = parentStore.childRecords ? SC.beget(parentStore.childRecords) : {};
|
|
200
|
+
this.parentRecords = parentStore.parentRecords ? SC.beget(parentStore.parentRecords) : {};
|
|
201
|
+
|
|
198
202
|
// also, reset private temporary objects
|
|
199
203
|
this.chainedChanges = this.locks = this.editables = null;
|
|
200
204
|
this.changelog = null ;
|
|
@@ -266,7 +270,8 @@ SC.NestedStore = SC.Store.extend(
|
|
|
266
270
|
store.
|
|
267
271
|
*/
|
|
268
272
|
_lock: function(storeKey) {
|
|
269
|
-
var locks = this.locks, rev, editables
|
|
273
|
+
var locks = this.locks, rev, editables,
|
|
274
|
+
pk, pr, path, tup, obj, key;
|
|
270
275
|
|
|
271
276
|
// already locked -- nothing to do
|
|
272
277
|
if (locks && locks[storeKey]) return this;
|
|
@@ -288,7 +293,24 @@ SC.NestedStore = SC.Store.extend(
|
|
|
288
293
|
}
|
|
289
294
|
|
|
290
295
|
if (pstore && editState === SC.Store.EDITABLE) {
|
|
291
|
-
|
|
296
|
+
|
|
297
|
+
pk = this.childRecords[storeKey];
|
|
298
|
+
if (pk){
|
|
299
|
+
// Since this is a nested record we have to actually walk up the parent chain
|
|
300
|
+
// to get to the root parent and clone that hash. And then reconstruct the
|
|
301
|
+
// memory space linking.
|
|
302
|
+
this._lock(pk);
|
|
303
|
+
pr = this.parentRecords[pk];
|
|
304
|
+
if (pr) {
|
|
305
|
+
path = pr[storeKey];
|
|
306
|
+
tup = path ? SC.tupleForPropertyPath(path, this.dataHashes[pk]) : null;
|
|
307
|
+
if (tup){ obj = tup[0]; key = tup[1]; }
|
|
308
|
+
this.dataHashes[storeKey] = obj && key ? obj[key] : null;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
this.dataHashes[storeKey] = SC.clone(pstore.dataHashes[storeKey], YES);
|
|
313
|
+
}
|
|
292
314
|
if (!editables) editables = this.editables = [];
|
|
293
315
|
editables[storeKey] = 1 ; // mark as editable
|
|
294
316
|
|
|
@@ -375,7 +397,6 @@ SC.NestedStore = SC.Store.extend(
|
|
|
375
397
|
|
|
376
398
|
/** @private - book-keeping for a single data hash. */
|
|
377
399
|
dataHashDidChange: function(storeKeys, rev, statusOnly, key) {
|
|
378
|
-
|
|
379
400
|
// update the revision for storeKey. Use generateStoreKey() because that
|
|
380
401
|
// gaurantees a universally (to this store hierarchy anyway) unique
|
|
381
402
|
// key value.
|
|
@@ -147,6 +147,10 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
|
147
147
|
newStoreClass = SC.NestedStore;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
// Replicate parent records references
|
|
151
|
+
attrs.childRecords = this.childRecords ? SC.clone(this.childRecords) : {};
|
|
152
|
+
attrs.parentRecords = this.parentRecords ? SC.clone(this.parentRecords) : {};
|
|
153
|
+
|
|
150
154
|
var ret = newStoreClass.create(attrs),
|
|
151
155
|
nested = this.nestedStores;
|
|
152
156
|
|
|
@@ -265,6 +269,16 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
|
265
269
|
*/
|
|
266
270
|
queryErrors: null,
|
|
267
271
|
|
|
272
|
+
/**
|
|
273
|
+
A hash of child Records and there immediate parents
|
|
274
|
+
*/
|
|
275
|
+
childRecords: null,
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
A hash of parent records with registered children
|
|
279
|
+
*/
|
|
280
|
+
parentRecords: null,
|
|
281
|
+
|
|
268
282
|
// ..........................................................
|
|
269
283
|
// CORE ATTRIBUTE API
|
|
270
284
|
//
|
|
@@ -378,6 +392,11 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
|
378
392
|
if (!editables) editables = this.editables = [];
|
|
379
393
|
editables[storeKey] = 1 ; // use number for dense array support
|
|
380
394
|
|
|
395
|
+
var that = this;
|
|
396
|
+
this._propagateToChildren(storeKey, function(storeKey){
|
|
397
|
+
that.writeDataHash(storeKey, null, status);
|
|
398
|
+
});
|
|
399
|
+
|
|
381
400
|
return this ;
|
|
382
401
|
},
|
|
383
402
|
|
|
@@ -480,10 +499,15 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
|
480
499
|
storeKey = storeKeys;
|
|
481
500
|
}
|
|
482
501
|
|
|
502
|
+
var that = this;
|
|
483
503
|
for(idx=0;idx<len;idx++) {
|
|
484
504
|
if (isArray) storeKey = storeKeys[idx];
|
|
485
505
|
this.revisions[storeKey] = rev;
|
|
486
506
|
this._notifyRecordPropertyChange(storeKey, statusOnly, key);
|
|
507
|
+
|
|
508
|
+
this._propagateToChildren(storeKey, function(storeKey){
|
|
509
|
+
that.dataHashDidChange(storeKey, null, statusOnly, key);
|
|
510
|
+
});
|
|
487
511
|
}
|
|
488
512
|
|
|
489
513
|
return this ;
|
|
@@ -671,27 +695,33 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
|
671
695
|
// OK, no locking issues. So let's just copy them changes.
|
|
672
696
|
// get local reference to values.
|
|
673
697
|
var len = changes.length, i, storeKey, myDataHashes, myStatuses,
|
|
674
|
-
myEditables, myRevisions,
|
|
698
|
+
myEditables, myRevisions, myParentRecords, myChildRecords,
|
|
699
|
+
chDataHashes, chStatuses, chRevisions, chParentRecords, chChildRecords;
|
|
675
700
|
|
|
676
|
-
myRevisions
|
|
677
|
-
myDataHashes
|
|
678
|
-
myStatuses
|
|
679
|
-
myEditables
|
|
701
|
+
myRevisions = this.revisions ;
|
|
702
|
+
myDataHashes = this.dataHashes;
|
|
703
|
+
myStatuses = this.statuses;
|
|
704
|
+
myEditables = this.editables ;
|
|
705
|
+
myParentRecords = this.parentRecords ? this.parentRecords : this.parentRecords ={} ;
|
|
706
|
+
myChildRecords = this.childRecords ? this.childRecords : this.childRecords = {} ;
|
|
680
707
|
|
|
681
708
|
// setup some arrays if needed
|
|
682
709
|
if (!myEditables) myEditables = this.editables = [] ;
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
710
|
+
chDataHashes = nestedStore.dataHashes;
|
|
711
|
+
chRevisions = nestedStore.revisions ;
|
|
712
|
+
chStatuses = nestedStore.statuses;
|
|
713
|
+
chParentRecords = nestedStore.parentRecords || {};
|
|
714
|
+
chChildRecords = nestedStore.childRecords || {};
|
|
687
715
|
|
|
688
716
|
for(i=0;i<len;i++) {
|
|
689
717
|
storeKey = changes[i];
|
|
690
718
|
|
|
691
719
|
// now copy changes
|
|
692
|
-
myDataHashes[storeKey]
|
|
693
|
-
myStatuses[storeKey]
|
|
694
|
-
myRevisions[storeKey]
|
|
720
|
+
myDataHashes[storeKey] = chDataHashes[storeKey];
|
|
721
|
+
myStatuses[storeKey] = chStatuses[storeKey];
|
|
722
|
+
myRevisions[storeKey] = chRevisions[storeKey];
|
|
723
|
+
myParentRecords[storeKey] = chParentRecords[storeKey];
|
|
724
|
+
myChildRecords[storeKey] = chChildRecords[storeKey];
|
|
695
725
|
|
|
696
726
|
myEditables[storeKey] = 0 ; // always make dataHash no longer editable
|
|
697
727
|
|
|
@@ -1081,11 +1111,11 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
|
1081
1111
|
// any busy or ready state or destroyed dirty state is not allowed
|
|
1082
1112
|
if ((status & K.BUSY) ||
|
|
1083
1113
|
(status & K.READY) ||
|
|
1084
|
-
(status
|
|
1114
|
+
(status === K.DESTROYED_DIRTY)) {
|
|
1085
1115
|
throw id ? K.RECORD_EXISTS_ERROR : K.BAD_STATE_ERROR;
|
|
1086
1116
|
|
|
1087
1117
|
// allow error or destroyed state only with id
|
|
1088
|
-
} else if (!id && (status
|
|
1118
|
+
} else if (!id && (status===SC.DESTROYED_CLEAN || status===SC.ERROR)) {
|
|
1089
1119
|
throw K.BAD_STATE_ERROR;
|
|
1090
1120
|
}
|
|
1091
1121
|
|
|
@@ -1111,7 +1141,7 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
|
1111
1141
|
ret = this.materializeRecord(storeKey);
|
|
1112
1142
|
if (ret) ret.propagateToAggregates();
|
|
1113
1143
|
return ret;
|
|
1114
|
-
},
|
|
1144
|
+
},
|
|
1115
1145
|
|
|
1116
1146
|
/**
|
|
1117
1147
|
Creates an array of new records. You must pass an array of dataHashes
|
|
@@ -1168,7 +1198,13 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
|
1168
1198
|
// remove the data hash, set new status
|
|
1169
1199
|
this.removeDataHash(storeKey, status);
|
|
1170
1200
|
this.dataHashDidChange(storeKey);
|
|
1171
|
-
|
|
1201
|
+
|
|
1202
|
+
// Handle all the child Records
|
|
1203
|
+
var that = this;
|
|
1204
|
+
this._propagateToChildren(storeKey, function(storeKey){
|
|
1205
|
+
that.unloadRecord(null, null, storeKey, newStatus);
|
|
1206
|
+
});
|
|
1207
|
+
|
|
1172
1208
|
return this ;
|
|
1173
1209
|
},
|
|
1174
1210
|
|
|
@@ -1244,7 +1280,7 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
|
1244
1280
|
return this; // nothing to do
|
|
1245
1281
|
|
|
1246
1282
|
// error out if empty
|
|
1247
|
-
} else if (status
|
|
1283
|
+
} else if (status === K.EMPTY) {
|
|
1248
1284
|
throw K.NOT_FOUND_ERROR ;
|
|
1249
1285
|
|
|
1250
1286
|
// error out if busy
|
|
@@ -1252,7 +1288,7 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
|
1252
1288
|
throw K.BUSY_ERROR ;
|
|
1253
1289
|
|
|
1254
1290
|
// if new status, destroy but leave in clean state
|
|
1255
|
-
} else if (status
|
|
1291
|
+
} else if (status === K.READY_NEW) {
|
|
1256
1292
|
status = K.DESTROYED_CLEAN ;
|
|
1257
1293
|
|
|
1258
1294
|
// otherwise, destroy in dirty state
|
|
@@ -1273,6 +1309,11 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
|
1273
1309
|
if(this.get('commitRecordsAutomatically')){
|
|
1274
1310
|
this.invokeLast(this.commitRecords);
|
|
1275
1311
|
}
|
|
1312
|
+
|
|
1313
|
+
var that = this;
|
|
1314
|
+
this._propagateToChildren(storeKey, function(storeKey){
|
|
1315
|
+
that.destroyRecord(null, null, storeKey);
|
|
1316
|
+
});
|
|
1276
1317
|
|
|
1277
1318
|
return this ;
|
|
1278
1319
|
},
|
|
@@ -1318,6 +1359,66 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
|
1318
1359
|
return this ;
|
|
1319
1360
|
},
|
|
1320
1361
|
|
|
1362
|
+
/**
|
|
1363
|
+
register a Child Record to the parent
|
|
1364
|
+
*/
|
|
1365
|
+
registerChildToParent: function(parentStoreKey, childStoreKey, path){
|
|
1366
|
+
var prs, crs, oldPk, oldChildren, pkRef;
|
|
1367
|
+
// Check the child to see if it has a parent
|
|
1368
|
+
crs = this.childRecords || {};
|
|
1369
|
+
prs = this.parentRecords || {};
|
|
1370
|
+
// first rid of the old parent
|
|
1371
|
+
oldPk = crs[childStoreKey];
|
|
1372
|
+
if (oldPk){
|
|
1373
|
+
oldChildren = prs[oldPk];
|
|
1374
|
+
delete oldChildren[childStoreKey];
|
|
1375
|
+
// this.recordDidChange(null, null, oldPk, key);
|
|
1376
|
+
}
|
|
1377
|
+
pkRef = prs[parentStoreKey] || {};
|
|
1378
|
+
pkRef[childStoreKey] = path || YES;
|
|
1379
|
+
prs[parentStoreKey] = pkRef;
|
|
1380
|
+
crs[childStoreKey] = parentStoreKey;
|
|
1381
|
+
// sync the status of the child
|
|
1382
|
+
this.writeStatus(childStoreKey, this.statuses[parentStoreKey]);
|
|
1383
|
+
this.childRecords = crs;
|
|
1384
|
+
this.parentRecords = prs;
|
|
1385
|
+
},
|
|
1386
|
+
|
|
1387
|
+
/**
|
|
1388
|
+
materialize the parent when passing in a store key for the child
|
|
1389
|
+
*/
|
|
1390
|
+
materializeParentRecord: function(childStoreKey){
|
|
1391
|
+
var pk, crs;
|
|
1392
|
+
if (SC.none(childStoreKey)) return null;
|
|
1393
|
+
crs = this.childRecords;
|
|
1394
|
+
pk = crs ? this.childRecords[childStoreKey] : null ;
|
|
1395
|
+
if (SC.none(pk)) return null;
|
|
1396
|
+
|
|
1397
|
+
return this.materializeRecord(pk);
|
|
1398
|
+
},
|
|
1399
|
+
|
|
1400
|
+
/**
|
|
1401
|
+
function for retrieving a parent record key
|
|
1402
|
+
*/
|
|
1403
|
+
parentStoreKeyExists: function(storeKey){
|
|
1404
|
+
if (SC.none(storeKey)) return ;
|
|
1405
|
+
var crs = this.childRecords || {};
|
|
1406
|
+
return crs[storeKey];
|
|
1407
|
+
},
|
|
1408
|
+
|
|
1409
|
+
/**
|
|
1410
|
+
function that propigates a function all to all children
|
|
1411
|
+
*/
|
|
1412
|
+
_propagateToChildren: function(storeKey, func){
|
|
1413
|
+
// Handle all the child Records
|
|
1414
|
+
if ( SC.none(this.parentRecords) ) return;
|
|
1415
|
+
var children = this.parentRecords[storeKey] || {};
|
|
1416
|
+
if (SC.none(func)) return;
|
|
1417
|
+
for (var key in children) {
|
|
1418
|
+
if (children.hasOwnProperty(key)) func(key);
|
|
1419
|
+
}
|
|
1420
|
+
},
|
|
1421
|
+
|
|
1321
1422
|
/**
|
|
1322
1423
|
Notes that the data for the given record id has changed. The record will
|
|
1323
1424
|
be committed to the server the next time you commit the root store. Only
|
|
@@ -1910,7 +2011,6 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
|
1910
2011
|
// DESTROYED_DIRTY
|
|
1911
2012
|
if (!(status & K.BUSY)) {
|
|
1912
2013
|
throw K.BAD_STATE_ERROR; // should never be called in this state
|
|
1913
|
-
|
|
1914
2014
|
}
|
|
1915
2015
|
|
|
1916
2016
|
// otherwise, determine proper state transition
|
|
@@ -1978,7 +2078,13 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
|
1978
2078
|
|
|
1979
2079
|
statusOnly = dataHash || newId ? NO : YES;
|
|
1980
2080
|
this.dataHashDidChange(storeKey, null, statusOnly);
|
|
1981
|
-
|
|
2081
|
+
|
|
2082
|
+
// Force record to refresh its cached properties based on store key
|
|
2083
|
+
var record = this.materializeRecord(storeKey);
|
|
2084
|
+
if (record != null) {
|
|
2085
|
+
record.notifyPropertyChange('status');
|
|
2086
|
+
}
|
|
2087
|
+
|
|
1982
2088
|
return this ;
|
|
1983
2089
|
},
|
|
1984
2090
|
|
|
@@ -2004,6 +2110,12 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
|
2004
2110
|
this.removeDataHash(storeKey, status) ;
|
|
2005
2111
|
this.dataHashDidChange(storeKey);
|
|
2006
2112
|
|
|
2113
|
+
// Force record to refresh its cached properties based on store key
|
|
2114
|
+
var record = this.materializeRecord(storeKey);
|
|
2115
|
+
if (record != null) {
|
|
2116
|
+
record.notifyPropertyChange('status');
|
|
2117
|
+
}
|
|
2118
|
+
|
|
2007
2119
|
return this ;
|
|
2008
2120
|
},
|
|
2009
2121
|
|
|
@@ -2019,7 +2131,7 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
|
2019
2131
|
|
|
2020
2132
|
// EMPTY, ERROR, READY_CLEAN, READY_NEW, READY_DIRTY, DESTROYED_CLEAN,
|
|
2021
2133
|
// DESTROYED_DIRTY
|
|
2022
|
-
if (!(status & K.BUSY)) throw K.BAD_STATE_ERROR;
|
|
2134
|
+
if (!(status & K.BUSY)) { throw K.BAD_STATE_ERROR; }
|
|
2023
2135
|
|
|
2024
2136
|
// otherwise, determine proper state transition
|
|
2025
2137
|
else status = K.ERROR ;
|
|
@@ -2033,6 +2145,12 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
|
|
|
2033
2145
|
this.writeStatus(storeKey, status) ;
|
|
2034
2146
|
this.dataHashDidChange(storeKey, null, YES);
|
|
2035
2147
|
|
|
2148
|
+
// Force record to refresh its cached properties based on store key
|
|
2149
|
+
var record = this.materializeRecord(storeKey);
|
|
2150
|
+
if (record != null) {
|
|
2151
|
+
record.notifyPropertyChange('status');
|
|
2152
|
+
}
|
|
2153
|
+
|
|
2036
2154
|
return this ;
|
|
2037
2155
|
},
|
|
2038
2156
|
|
|
@@ -107,10 +107,15 @@ test("Update and commit a record", function() {
|
|
|
107
107
|
fixture = fixtures.fixtureForStoreKey(store, storeKey);
|
|
108
108
|
|
|
109
109
|
equals(fixture.name, rec.get('name'), 'precond - fixture state should match name');
|
|
110
|
+
equals(rec.get('status'), SC.Record.READY_CLEAN, "Status should be READY_CLEAN because no changes have been made");
|
|
110
111
|
|
|
111
112
|
rec.set('name', 'foo');
|
|
113
|
+
equals(rec.get('status'), SC.Record.READY_DIRTY, "Status should be READY_DIRTY after changing name");
|
|
114
|
+
|
|
112
115
|
store.commitRecords();
|
|
113
|
-
|
|
116
|
+
equals(store.readStatus(storeKey), SC.Record.READY_CLEAN, "Status in store should be READY_CLEAN after save");
|
|
117
|
+
equals(rec.get('status'), SC.Record.READY_CLEAN, "Status in record should be READY_CLEAN after save");
|
|
118
|
+
|
|
114
119
|
fixture = fixtures.fixtureForStoreKey(store, storeKey);
|
|
115
120
|
equals(fixture.name, rec.get('name'), 'fixture state should update to match new name');
|
|
116
121
|
|
data/lib/frameworks/sproutcore/frameworks/datastore/tests/integration/cyclical_relationship.js
CHANGED
|
@@ -95,7 +95,7 @@ module("Cyclical relationships", {
|
|
|
95
95
|
test("getting all contacts in a group", function() {
|
|
96
96
|
var group = AB.store.find(AB.Group, 100);
|
|
97
97
|
var expected = AB.store.find(AB.Contact).filterProperty('group', group);
|
|
98
|
-
same(group.get('contacts'), expected, 'contacts');
|
|
98
|
+
same(group.get('contacts').toArray(), expected, 'contacts');
|
|
99
99
|
});
|
|
100
100
|
|
|
101
101
|
test("finding favoriteContacts", function() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Nested Records and the Data Store(SC.Record) Unit Test
|
|
3
3
|
*
|
|
4
4
|
* @author Evin Grano
|
|
5
5
|
*/
|
|
@@ -10,18 +10,14 @@
|
|
|
10
10
|
var NestedRecord, store, storeKeys;
|
|
11
11
|
|
|
12
12
|
var initModels = function(){
|
|
13
|
-
NestedRecord.Directory = SC.
|
|
13
|
+
NestedRecord.Directory = SC.Record.extend({
|
|
14
14
|
/** Child Record Namespace */
|
|
15
|
-
|
|
16
|
-
primaryKey: 'id',
|
|
17
|
-
id: SC.Record.attr(Number),
|
|
15
|
+
nestedRecordNamespace: NestedRecord,
|
|
18
16
|
name: SC.Record.attr(String),
|
|
19
|
-
contents: SC.Record.toMany('SC.Record', {
|
|
17
|
+
contents: SC.Record.toMany('SC.Record', { isNested: true })
|
|
20
18
|
});
|
|
21
19
|
|
|
22
|
-
NestedRecord.File = SC.
|
|
23
|
-
primaryKey: 'id',
|
|
24
|
-
id: SC.Record.attr(Number),
|
|
20
|
+
NestedRecord.File = SC.Record.extend({
|
|
25
21
|
name: SC.Record.attr(String)
|
|
26
22
|
});
|
|
27
23
|
|
|
@@ -30,7 +26,7 @@ var initModels = function(){
|
|
|
30
26
|
// ..........................................................
|
|
31
27
|
// Basic SC.Record Stuff
|
|
32
28
|
//
|
|
33
|
-
module("
|
|
29
|
+
module("Data Store Tests for Nested Records", {
|
|
34
30
|
|
|
35
31
|
setup: function() {
|
|
36
32
|
NestedRecord = SC.Object.create({
|
|
@@ -43,21 +39,21 @@ module("Parentless SC.ChildRecord", {
|
|
|
43
39
|
{
|
|
44
40
|
type: 'Directory',
|
|
45
41
|
name: 'Dir 1',
|
|
46
|
-
|
|
42
|
+
guid: 1,
|
|
47
43
|
contents: [
|
|
48
44
|
{
|
|
49
45
|
type: 'Directory',
|
|
50
46
|
name: 'Dir 2',
|
|
51
|
-
|
|
47
|
+
guid: 2,
|
|
52
48
|
contents: [
|
|
53
49
|
{
|
|
54
50
|
type: 'File',
|
|
55
|
-
|
|
51
|
+
guid: 3,
|
|
56
52
|
name: 'File 1'
|
|
57
53
|
},
|
|
58
54
|
{
|
|
59
55
|
type: 'File',
|
|
60
|
-
|
|
56
|
+
guid: 4,
|
|
61
57
|
name: 'File 2'
|
|
62
58
|
}
|
|
63
59
|
]
|
|
@@ -87,12 +83,12 @@ test("Proper Initialization",function() {
|
|
|
87
83
|
|
|
88
84
|
// First
|
|
89
85
|
first = store.materializeRecord(storeKeys[0]);
|
|
90
|
-
ok(SC.kindOf(first, SC.
|
|
86
|
+
ok(SC.kindOf(first, SC.Record), "first record is a kind of a SC.Record Object");
|
|
91
87
|
ok(SC.instanceOf(first, NestedRecord.Directory), "first record is a instance of a NestedRecord.Directory Object");
|
|
92
88
|
|
|
93
89
|
// Second
|
|
94
90
|
second = store.materializeRecord(storeKeys[1]);
|
|
95
|
-
ok(SC.kindOf(second, SC.
|
|
91
|
+
ok(SC.kindOf(second, SC.Record), "second record is a kind of a SC.Record Object");
|
|
96
92
|
ok(SC.instanceOf(second, NestedRecord.File), "second record is a instance of a NestedRecord.File Object");
|
|
97
93
|
});
|
|
98
94
|
|
|
@@ -132,3 +128,53 @@ test("Can Push onto child array",function() {
|
|
|
132
128
|
});
|
|
133
129
|
|
|
134
130
|
});
|
|
131
|
+
|
|
132
|
+
test("Use in Nested Store", function(){
|
|
133
|
+
var nstore, dir, c, file,
|
|
134
|
+
pk, id, nFile, nDir;
|
|
135
|
+
|
|
136
|
+
// First, find the first file
|
|
137
|
+
dir = store.find(NestedRecord.Directory, 1);
|
|
138
|
+
ok(dir, "Directory id:1 exists");
|
|
139
|
+
equals(dir.get('name'), 'Dir 1', "Directory id:1 has a name of 'Dir 1'");
|
|
140
|
+
c = dir.get('contents');
|
|
141
|
+
ok(c, "Content of Directory id:1 exists");
|
|
142
|
+
dir = c.objectAt(0);
|
|
143
|
+
ok(dir, "Directory id:2 exists");
|
|
144
|
+
equals(dir.get('name'), 'Dir 2', "Directory id:2 has a name of 'Dir 2'");
|
|
145
|
+
c = dir.get('contents');
|
|
146
|
+
ok(c, "Content of Directory id:2 exists");
|
|
147
|
+
file = c.objectAt(0);
|
|
148
|
+
ok(file, "File id:1 exists");
|
|
149
|
+
equals(file.get('name'), 'File 1', "File id:1 has a name of 'File 1'");
|
|
150
|
+
|
|
151
|
+
// Second, create nested store
|
|
152
|
+
nstore = store.chain();
|
|
153
|
+
SC.RunLoop.begin();
|
|
154
|
+
pk = file.get('primaryKey');
|
|
155
|
+
id = file.get(pk);
|
|
156
|
+
nFile = nstore.find(NestedRecord.File, id);
|
|
157
|
+
SC.RunLoop.end();
|
|
158
|
+
ok(nFile, "Nested > File id:1 exists");
|
|
159
|
+
equals(nFile.get('name'), 'File 1', "Nested > File id:1 has a name of 'File 1'");
|
|
160
|
+
|
|
161
|
+
// Third, change the name of the nested store and see what happens
|
|
162
|
+
nFile.set('name', 'Change Name');
|
|
163
|
+
equals(nFile.get('name'), 'Change Name', "Nested > File id:1 has changed the name to 'Changed Name'");
|
|
164
|
+
equals(file.get('name'), 'File 1', "Base > File id:1 still has the name of 'File 1'");
|
|
165
|
+
nDir = nstore.find(NestedRecord.Directory, 1);
|
|
166
|
+
|
|
167
|
+
// Fourth, commit the changes
|
|
168
|
+
nstore.commitChanges();
|
|
169
|
+
nstore.destroy();
|
|
170
|
+
nstore = null;
|
|
171
|
+
equals(file.get('name'), 'Change Name', "Base > File id:1 has changed to name of 'Changed Name'");
|
|
172
|
+
|
|
173
|
+
// Fifth, double check that the change exists
|
|
174
|
+
dir = store.find(NestedRecord.Directory, 1);
|
|
175
|
+
file = dir.get('contents').objectAt(0).get('contents').objectAt(0);
|
|
176
|
+
equals(dir.get('status'), SC.Record.READY_DIRTY, 'Base > Directory id:1 has a READY_DIRTY State');
|
|
177
|
+
equals(file.get('status'), SC.Record.READY_DIRTY, 'Base > File id:1 has a READY_DIRTY State');
|
|
178
|
+
equals(file.get('name'), 'Change Name', "Base > File id:1 has actually changed to name of 'Changed Name'");
|
|
179
|
+
|
|
180
|
+
});
|