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.
Files changed (308) hide show
  1. data/.rspec +1 -0
  2. data/CHANGELOG +42 -0
  3. data/README.txt +25 -0
  4. data/VERSION.yml +1 -1
  5. data/bin/sc-build +1 -1
  6. data/bin/sc-build-number +1 -1
  7. data/bin/sc-docs +1 -1
  8. data/bin/sc-gen +1 -1
  9. data/bin/sc-init +1 -1
  10. data/bin/sc-manifest +1 -1
  11. data/bin/sc-server +1 -1
  12. data/bin/sproutcore +1 -1
  13. data/lib/buildtasks/build.rake +5 -0
  14. data/lib/buildtasks/manifest.rake +20 -1
  15. data/lib/frameworks/sproutcore/Buildfile +12 -9
  16. data/lib/frameworks/sproutcore/CHANGELOG.md +48 -0
  17. data/lib/frameworks/sproutcore/apps/greenhouse/README +2 -9
  18. data/lib/frameworks/sproutcore/apps/greenhouse/TODO +11 -27
  19. data/lib/frameworks/sproutcore/apps/greenhouse/controllers/library.js +3 -10
  20. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/main-page.css +4 -31
  21. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/dialogs.js +5 -4
  22. data/lib/frameworks/sproutcore/apps/greenhouse/models/dir.js +3 -3
  23. data/lib/frameworks/sproutcore/apps/greenhouse/models/file.js +2 -2
  24. data/lib/frameworks/sproutcore/apps/greenhouse/states/main.js +31 -14
  25. data/lib/frameworks/sproutcore/apps/greenhouse/states/modals.js +2 -1
  26. data/lib/frameworks/sproutcore/apps/greenhouse/states/ready.js +27 -1
  27. data/lib/frameworks/sproutcore/apps/greenhouse/tests/views/list_item.js +1 -0
  28. data/lib/frameworks/sproutcore/apps/greenhouse/tests/views/plist_item.js +20 -0
  29. data/lib/frameworks/sproutcore/apps/greenhouse/theme.js +25 -0
  30. data/lib/frameworks/sproutcore/apps/greenhouse/views/plist_item.js +161 -24
  31. data/lib/frameworks/sproutcore/apps/greenhouse/views/tear_off_picker.js +1 -1
  32. data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +37 -25
  33. data/lib/frameworks/sproutcore/frameworks/bootstrap/tests/system/browser.js +135 -26
  34. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/controllers/array.js +0 -0
  35. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/controllers/controller.js +0 -0
  36. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/controllers/object.js +1 -1
  37. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/core.js +0 -0
  38. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/ext/object.js +0 -0
  39. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/ext/run_loop.js +1 -0
  40. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/mixins/delegate_support.js +0 -0
  41. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/mixins/responder_context.js +0 -0
  42. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/mixins/selection_support.js +0 -0
  43. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/mixins/string.js +0 -0
  44. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/keyboard.js +68 -0
  45. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/layout.js +108 -0
  46. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/panes/main.js +2 -2
  47. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/manipulation.js +27 -0
  48. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/panes/pane.js +215 -505
  49. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/template.js +24 -0
  50. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/visibility.js +11 -0
  51. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/protocols/observable_protocol.js +0 -0
  52. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/protocols/sparse_array_delegate.js +0 -0
  53. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/resources/core.css +0 -0
  54. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/resources/view.css +0 -0
  55. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/application.js +0 -0
  56. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/browser.js +1 -0
  57. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/builder.js +0 -0
  58. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/core_query.js +1 -1
  59. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/cursor.js +0 -0
  60. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/device.js +210 -0
  61. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/event.js +5 -5
  62. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/json.js +0 -0
  63. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/locale.js +0 -0
  64. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/page.js +0 -0
  65. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/platform.js +31 -5
  66. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/ready.js +1 -1
  67. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/render_context.js +0 -0
  68. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/responder.js +0 -0
  69. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/root_responder.js +83 -110
  70. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/selection_set.js +7 -4
  71. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/sparse_array.js +0 -0
  72. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/theme.js +0 -0
  73. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/timer.js +0 -0
  74. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/utils/rect.js +0 -0
  75. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +151 -0
  76. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/array_case.js +0 -0
  77. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/enum_case.js +0 -0
  78. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/null_case.js +0 -0
  79. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/selection_support.js +26 -0
  80. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/single_case.js +0 -0
  81. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/object/empty_case.js +0 -0
  82. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/object/multiple_case.js +0 -0
  83. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/object/single_case.js +0 -0
  84. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/object/single_enumerable_case.js +0 -0
  85. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/mixins/responder_context.js +0 -0
  86. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/mixins/string.js +0 -0
  87. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/panes/template.js +14 -0
  88. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/builder.js +0 -0
  89. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/core_query/within.js +0 -0
  90. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/json.js +0 -0
  91. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/locale.js +0 -0
  92. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/begin.js +0 -0
  93. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/element.js +0 -0
  94. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/end.js +0 -0
  95. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/get.js +0 -0
  96. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/helpers_attr.js +0 -0
  97. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/helpers_basic.js +0 -0
  98. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/helpers_className.js +0 -0
  99. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/helpers_style.js +0 -0
  100. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/init.js +0 -0
  101. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/join.js +0 -0
  102. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/push_text.js +0 -0
  103. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/tag.js +0 -0
  104. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/update.js +0 -0
  105. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/makeKeyPane.js +0 -0
  106. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/makeMainPane.js +0 -0
  107. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/makeMenuPane.js +0 -0
  108. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/root_responder.js +0 -0
  109. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/targetForAction.js +0 -0
  110. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/add.js +0 -0
  111. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/copy.js +0 -0
  112. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/indexSetForSource.js +0 -0
  113. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/isEqual.js +0 -0
  114. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/remove.js +0 -0
  115. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/sparse_array.js +0 -0
  116. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/theme.js +0 -0
  117. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/invalidate.js +0 -0
  118. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/invokeLater.js +0 -0
  119. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/isPaused.js +0 -0
  120. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/performAction.js +0 -0
  121. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/schedule.js +0 -0
  122. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/utils/normalizeURL.js +0 -0
  123. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/utils/offset.js +268 -0
  124. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/utils/rect.js +0 -0
  125. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/main_pane.js +43 -0
  126. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/append_remove.js +107 -18
  127. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/child_view.js +20 -0
  128. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/firstResponder.js +0 -0
  129. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/keyPane.js +0 -0
  130. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/layout.js +0 -0
  131. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/sendEvent.js +0 -0
  132. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/checkbox_support.js +32 -0
  133. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/text_field_support.js +73 -0
  134. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template_view/collection.js +65 -0
  135. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template_view/core.js +67 -0
  136. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template_view/handlebars.js +295 -0
  137. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/animation.js +19 -18
  138. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/build.js +0 -0
  139. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/build_children.js +0 -0
  140. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/clippingFrame.js +0 -0
  141. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/convertFrames.js +0 -0
  142. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/convertLayouts.js +0 -0
  143. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/createChildViews.js +18 -15
  144. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/createLayer.js +0 -0
  145. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/destroyLayer.js +0 -0
  146. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/didAppendToDocument.js +11 -8
  147. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/findLayerInParentLayer.js +0 -0
  148. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/init.js +0 -0
  149. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/insertBefore.js +0 -0
  150. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/isVisible.js +28 -0
  151. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/isVisibleInWindow.js +0 -0
  152. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/keyboard.js +22 -0
  153. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/layer.js +0 -0
  154. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/layoutChildViews.js +0 -0
  155. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutDidChange.js +180 -0
  156. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +640 -0
  157. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/parentViewDidChange.js +0 -0
  158. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/prepareContext.js +0 -0
  159. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/removeChild.js +0 -0
  160. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/render.js +125 -0
  161. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/render_delegate_support.js +0 -0
  162. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/replaceChild.js +0 -0
  163. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/static_layout.js +21 -0
  164. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/theme.js +0 -0
  165. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/updateLayer.js +0 -0
  166. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/updateLayerLocation.js +0 -0
  167. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/view.js +0 -0
  168. data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/viewDidResize.js +0 -0
  169. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template/checkbox_support.js +20 -0
  170. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template/collection.js +99 -0
  171. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template/text_field_support.js +35 -0
  172. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template.js +77 -0
  173. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +187 -0
  174. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/base.js +1 -0
  175. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/cursor.js +41 -0
  176. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/enabled.js +57 -0
  177. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/keyboard.js +223 -0
  178. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +1150 -0
  179. data/lib/frameworks/sproutcore/frameworks/{amber/views → core_foundation/views/view}/layout_style.js +93 -1
  180. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +489 -0
  181. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/theming.js +362 -0
  182. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/touch.js +67 -0
  183. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/visibility.js +113 -0
  184. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +1280 -0
  185. data/lib/frameworks/sproutcore/frameworks/datastore/models/child_attribute.js +27 -53
  186. data/lib/frameworks/sproutcore/frameworks/datastore/models/children_attribute.js +13 -19
  187. data/lib/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +1 -0
  188. data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +183 -71
  189. data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +1 -2
  190. data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +26 -46
  191. data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +25 -4
  192. data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +139 -21
  193. data/lib/frameworks/sproutcore/frameworks/datastore/tests/data_sources/fixtures.js +6 -1
  194. data/lib/frameworks/sproutcore/frameworks/datastore/tests/integration/cyclical_relationship.js +1 -1
  195. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/{parentless.js → data_store.js} +62 -16
  196. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record.js +51 -17
  197. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array.js +36 -10
  198. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array_complex.js +11 -11
  199. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_complex.js +8 -8
  200. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/normalize.js +2 -2
  201. data/lib/frameworks/sproutcore/frameworks/{foundation/english.lproj → datetime/resources}/strings.js +1 -0
  202. data/lib/frameworks/sproutcore/frameworks/{foundation → datetime}/system/datetime.js +5 -37
  203. data/lib/frameworks/sproutcore/frameworks/{foundation → datetime}/tests/system/datetime.js +1 -0
  204. data/lib/frameworks/sproutcore/frameworks/debug/core.js +1 -1
  205. data/lib/frameworks/sproutcore/frameworks/designer/controllers/designs.js +1 -2
  206. data/lib/frameworks/sproutcore/frameworks/designer/designers/object_designer.js +3 -3
  207. data/lib/frameworks/sproutcore/frameworks/designer/designers/view_designer.js +3 -3
  208. data/lib/frameworks/sproutcore/frameworks/designer/views/designer_drop_target.js +9 -3
  209. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/segmented.css +71 -70
  210. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +10 -2
  211. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segment.js +4 -19
  212. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segmented.js +33 -14
  213. data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +25 -0
  214. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/date_field/ui.js +1 -1
  215. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/methods.js +25 -103
  216. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +102 -92
  217. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/tab/ui.js +22 -25
  218. data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +38 -25
  219. data/lib/frameworks/sproutcore/frameworks/desktop/views/date_field.js +1 -1
  220. data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +1 -1
  221. data/lib/frameworks/sproutcore/frameworks/desktop/views/segment.js +42 -22
  222. data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +513 -230
  223. data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +0 -2
  224. data/lib/frameworks/sproutcore/frameworks/experimental/README.md +23 -0
  225. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/device_motion/README.md +11 -0
  226. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/device_motion/device.js +215 -0
  227. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/device_motion/platform.js +67 -0
  228. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/README.md +34 -0
  229. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/models/polymorphic_single_attribute.js +183 -0
  230. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/models/record.js +23 -0
  231. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/tests/models/polymorphic/single.js +124 -0
  232. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +0 -2
  233. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inner_frame.js +151 -0
  234. data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/canvas_image.js +27 -17
  235. data/lib/frameworks/sproutcore/frameworks/foundation/system/image_queue.js +6 -3
  236. data/lib/frameworks/sproutcore/frameworks/foundation/system/logger.js +163 -0
  237. data/lib/frameworks/sproutcore/frameworks/foundation/system/user_defaults.js +6 -3
  238. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/beginEditing.js +1 -0
  239. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/logger.js +44 -0
  240. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/image/ui.js +200 -167
  241. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +1 -1
  242. data/lib/frameworks/sproutcore/frameworks/foundation/views/image.js +52 -137
  243. data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +7 -11
  244. data/lib/frameworks/sproutcore/frameworks/handlebars/extensions.js +138 -0
  245. data/lib/frameworks/sproutcore/frameworks/handlebars/handlebars.js +1338 -0
  246. data/lib/frameworks/sproutcore/frameworks/runtime/core.js +32 -26
  247. data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/base.js +162 -3
  248. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +10 -5
  249. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +123 -3
  250. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +12 -5
  251. data/lib/frameworks/sproutcore/frameworks/runtime/private/chain_observer.js +50 -13
  252. data/lib/frameworks/sproutcore/frameworks/runtime/system/logger.js +163 -333
  253. data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +58 -8
  254. data/lib/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +2 -0
  255. data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/itemType.js +9 -6
  256. data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/makeArray.js +15 -1
  257. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/array.js +2 -0
  258. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/chained.js +31 -0
  259. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/observable.js +18 -0
  260. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/logger.js +31 -143
  261. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/concatenated_properties.js +71 -0
  262. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/enhance.js +177 -0
  263. data/lib/frameworks/sproutcore/frameworks/table/views/table.js +5 -4
  264. data/lib/frameworks/sproutcore/frameworks/table/views/table_header.js +5 -3
  265. data/lib/frameworks/sproutcore/themes/ace/resources/button/button.js +8 -2
  266. data/lib/frameworks/sproutcore/themes/ace/resources/menu/menu.css +2 -3
  267. data/lib/frameworks/sproutcore/themes/ace/resources/segmented/18px/segmented.css +1 -1
  268. data/lib/frameworks/sproutcore/themes/ace/resources/segmented/24px/segmented.css +1 -1
  269. data/lib/frameworks/sproutcore/themes/ace/resources/segmented/30px/segmented.css +1 -1
  270. data/lib/frameworks/sproutcore/themes/ace/resources/segmented/44px/segmented.css +1 -1
  271. data/lib/frameworks/sproutcore/themes/ace/resources/segmented/segmented.css +2 -2
  272. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/segmented.css +62 -62
  273. data/lib/gen/html_app/Buildfile +36 -0
  274. data/lib/gen/html_app/README +1 -0
  275. data/lib/gen/html_app/USAGE +15 -0
  276. data/lib/gen/html_app/templates/apps/@target_name@/@target_name@.js +14 -0
  277. data/lib/gen/html_app/templates/apps/@target_name@/resources/images/.gitkeep +0 -0
  278. data/lib/gen/html_app/templates/apps/@target_name@/resources/stylesheets/@target_name@.css +0 -0
  279. data/lib/gen/html_app/templates/apps/@target_name@/resources/templates/@target_name@.handlebars +1 -0
  280. data/lib/gen/html_project/Buildfile +45 -0
  281. data/lib/gen/html_project/INIT +3 -0
  282. data/lib/gen/html_project/README +1 -0
  283. data/lib/gen/html_project/USAGE +2 -0
  284. data/lib/gen/html_project/templates/@filename@/Buildfile +8 -0
  285. data/lib/gen/html_project/templates/@filename@/README +7 -0
  286. data/lib/sproutcore/builders/handlebars.rb +30 -0
  287. data/lib/sproutcore/builders.rb +1 -1
  288. data/lib/sproutcore/helpers/static_helper.rb +3 -3
  289. data/lib/sproutcore/tools/init.rb +25 -9
  290. data/spec/buildtasks/manifest/prepare_build_tasks/handlebars_spec.rb +39 -0
  291. data/spec/fixtures/builder_tests/apps/handlebars_test/template.handlebars +5 -0
  292. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/templates/demo.handlebars +4 -0
  293. data/spec/lib/builders/handlebars_spec.rb +29 -0
  294. data/vendor/chance/lib/chance/imagers/data_url.rb +20 -7
  295. data/vendor/chance/lib/chance/instance.rb +4 -1
  296. data/vendor/chance/lib/chance/parser.rb +31 -31
  297. data/vendor/chance/lib/chance/slicing.rb +38 -8
  298. metadata +195 -225
  299. data/lib/frameworks/sproutcore/frameworks/amber/system/device.js +0 -143
  300. data/lib/frameworks/sproutcore/frameworks/amber/system/utils.js +0 -174
  301. data/lib/frameworks/sproutcore/frameworks/amber/tests/views/main_pane.js +0 -31
  302. data/lib/frameworks/sproutcore/frameworks/amber/tests/views/pane/sendTouchEvent.js +0 -267
  303. data/lib/frameworks/sproutcore/frameworks/amber/tests/views/view/layoutDidChange.js +0 -149
  304. data/lib/frameworks/sproutcore/frameworks/amber/tests/views/view/layoutStyle.js +0 -602
  305. data/lib/frameworks/sproutcore/frameworks/amber/tests/views/view/render.js +0 -115
  306. data/lib/frameworks/sproutcore/frameworks/amber/views/base.js +0 -1
  307. data/lib/frameworks/sproutcore/frameworks/amber/views/view.js +0 -4003
  308. 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.get('record').get('store');
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.get('record').get('storeKey');
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 = this._materializeChild(hash);
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
- children.replace(idx, amt, recs);
151
- for(var i = idx; i <= idx+amt; i+=1){
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
- this.dataHashes[storeKey] = SC.clone(pstore.dataHashes[storeKey], YES);
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, chDataHashes, chStatuses, chRevisions;
698
+ myEditables, myRevisions, myParentRecords, myChildRecords,
699
+ chDataHashes, chStatuses, chRevisions, chParentRecords, chChildRecords;
675
700
 
676
- myRevisions = this.revisions ;
677
- myDataHashes = this.dataHashes;
678
- myStatuses = this.statuses;
679
- myEditables = this.editables ;
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
- chDataHashes = nestedStore.dataHashes;
685
- chRevisions = nestedStore.revisions ;
686
- chStatuses = nestedStore.statuses;
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] = chDataHashes[storeKey];
693
- myStatuses[storeKey] = chStatuses[storeKey];
694
- myRevisions[storeKey] = chRevisions[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 == K.DESTROYED_DIRTY)) {
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==SC.DESTROYED_CLEAN || status==SC.ERROR)) {
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 == K.EMPTY) {
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 == K.READY_NEW) {
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
 
@@ -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
- * Complex Nested Records (SC.ChildRecord) Unit Test
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.ChildRecord.extend({
13
+ NestedRecord.Directory = SC.Record.extend({
14
14
  /** Child Record Namespace */
15
- childRecordNamespace: NestedRecord,
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', { nested: true })
17
+ contents: SC.Record.toMany('SC.Record', { isNested: true })
20
18
  });
21
19
 
22
- NestedRecord.File = SC.ChildRecord.extend({
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("Parentless SC.ChildRecord", {
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
- id: 1,
42
+ guid: 1,
47
43
  contents: [
48
44
  {
49
45
  type: 'Directory',
50
46
  name: 'Dir 2',
51
- id: 2,
47
+ guid: 2,
52
48
  contents: [
53
49
  {
54
50
  type: 'File',
55
- id: 3,
51
+ guid: 3,
56
52
  name: 'File 1'
57
53
  },
58
54
  {
59
55
  type: 'File',
60
- id: 4,
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.ChildRecord), "first record is a kind of a SC.ChildRecord Object");
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.ChildRecord), "second record is a kind of a SC.ChildRecord Object");
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
+ });