sproutcore 1.6.0.beta.3 → 1.6.0.rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (280) hide show
  1. data/CHANGELOG +33 -0
  2. data/Rakefile +213 -10
  3. data/VERSION.yml +1 -1
  4. data/lib/Buildfile +5 -1
  5. data/lib/buildtasks/manifest.rake +7 -1
  6. data/lib/frameworks/sproutcore/Buildfile +3 -2
  7. data/lib/frameworks/sproutcore/CHANGELOG.md +154 -1
  8. data/lib/frameworks/sproutcore/README.md +1 -1
  9. data/lib/frameworks/sproutcore/apps/welcome/english.lproj/main_page.css +9 -0
  10. data/lib/frameworks/sproutcore/frameworks/ajax/system/request.js +254 -207
  11. data/lib/frameworks/sproutcore/frameworks/ajax/system/response.js +243 -172
  12. data/lib/frameworks/sproutcore/frameworks/ajax/tests/system/request.js +29 -0
  13. data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +5 -0
  14. data/lib/frameworks/sproutcore/frameworks/core_foundation/controls/button.js +6 -2
  15. data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/handlebars/bind.js +36 -14
  16. data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/handlebars/collection.js +3 -3
  17. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +14 -15
  18. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/template.js +14 -14
  19. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/application.js +2 -7
  20. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +3 -3
  21. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/platform.js +2 -2
  22. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/responder.js +1 -1
  23. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +20 -12
  24. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/string.js +61 -0
  25. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +20 -6
  26. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/array/array_case.js +42 -0
  27. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controls/button.js +39 -57
  28. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/helpers_style.js +5 -3
  29. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/sparse_array.js +32 -0
  30. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/collection.js +25 -0
  31. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/handlebars.js +28 -17
  32. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/keyboard.js +396 -0
  33. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js +1 -1
  34. data/lib/frameworks/sproutcore/frameworks/core_foundation/{system → views}/bindable_span.js +2 -1
  35. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template_collection.js +78 -51
  36. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +4 -3
  37. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/enabled.js +2 -1
  38. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/keyboard.js +233 -67
  39. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +3 -1
  40. data/lib/frameworks/sproutcore/frameworks/core_tools/core.js +8 -2
  41. data/lib/frameworks/sproutcore/frameworks/core_tools/data_source.js +1 -1
  42. data/lib/frameworks/sproutcore/frameworks/core_tools/models/target.js +1 -1
  43. data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +15 -8
  44. data/lib/frameworks/sproutcore/frameworks/datastore/models/child_record.js +2 -2
  45. data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +1 -0
  46. data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +3 -2
  47. data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +66 -55
  48. data/lib/frameworks/sproutcore/frameworks/datastore/tests/data_sources/data_source.js +190 -0
  49. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array.js +21 -0
  50. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +15 -1
  51. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/flush.js +0 -1
  52. data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/system/datetime.js +212 -182
  53. data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/system/datetime.js +14 -16
  54. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +1 -1
  55. data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +23 -11
  56. data/lib/frameworks/sproutcore/frameworks/desktop/resources/alert.css +49 -0
  57. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/debug/a_sample_image.jpg +0 -0
  58. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/debug/apple-logo1.jpeg +0 -0
  59. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/debug/iframe.html +0 -0
  60. data/lib/frameworks/sproutcore/frameworks/desktop/resources/disclosure.css +20 -0
  61. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/drag.css +1 -1
  62. data/lib/frameworks/sproutcore/frameworks/desktop/resources/icons.css +214 -0
  63. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/cap.png +0 -0
  64. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/downbutton.png +0 -0
  65. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-alert-16.png +0 -0
  66. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-alert-24.png +0 -0
  67. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-alert-48.png +0 -0
  68. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-bookmark-16.png +0 -0
  69. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-bookmark-24.png +0 -0
  70. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-cancel-24.png +0 -0
  71. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-document-16.png +0 -0
  72. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-document-24.png +0 -0
  73. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-down-24.png +0 -0
  74. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-error-48.png +0 -0
  75. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-favorite-16.png +0 -0
  76. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-favorite-24.png +0 -0
  77. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-folder-16.png +0 -0
  78. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-folder-24.png +0 -0
  79. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-group-16.png +0 -0
  80. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-group-24.png +0 -0
  81. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-help-16.png +0 -0
  82. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-help-24.png +0 -0
  83. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-info-16.png +0 -0
  84. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-info-24.png +0 -0
  85. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-info-48.png +0 -0
  86. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-left-24.png +0 -0
  87. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-options-16.png +0 -0
  88. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-options-24.png +0 -0
  89. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-redo-24.png +0 -0
  90. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-right-24.png +0 -0
  91. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-tools-24.png +0 -0
  92. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-trash-16.png +0 -0
  93. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-trash-24.png +0 -0
  94. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-undo-24.png +0 -0
  95. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-up-24.png +0 -0
  96. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-user-16.png +0 -0
  97. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-user-24.png +0 -0
  98. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/thumb-bottom.png +0 -0
  99. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/thumb-center.png +0 -0
  100. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/thumb-top.png +0 -0
  101. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/track.png +0 -0
  102. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/upbutton.png +0 -0
  103. data/lib/frameworks/sproutcore/frameworks/desktop/resources/list_item.css +145 -0
  104. data/lib/frameworks/sproutcore/frameworks/desktop/resources/menu.css +10 -0
  105. data/lib/frameworks/sproutcore/frameworks/desktop/resources/menu_item_view.css +88 -0
  106. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/modal.css +3 -4
  107. data/lib/frameworks/sproutcore/frameworks/desktop/resources/panel.css +91 -0
  108. data/lib/frameworks/sproutcore/frameworks/desktop/resources/picker.css +37 -0
  109. data/lib/frameworks/sproutcore/frameworks/desktop/resources/progress.css +29 -0
  110. data/lib/frameworks/sproutcore/frameworks/desktop/resources/radio.css +11 -0
  111. data/lib/frameworks/sproutcore/frameworks/desktop/resources/segmented.css +121 -0
  112. data/lib/frameworks/sproutcore/frameworks/desktop/resources/separator.css +20 -0
  113. data/lib/frameworks/sproutcore/frameworks/desktop/resources/slider.css +34 -0
  114. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/split.css +0 -0
  115. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/split_divider.css +0 -0
  116. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/tab.css +0 -0
  117. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/toolbar.css +0 -0
  118. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/touch-scroller.css +13 -13
  119. data/lib/frameworks/sproutcore/frameworks/desktop/resources/well.css +65 -0
  120. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +114 -103
  121. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/static_content.js +3 -2
  122. data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +7 -6
  123. data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +18 -0
  124. data/lib/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +4 -7
  125. data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +9 -2
  126. data/lib/frameworks/sproutcore/frameworks/desktop/{panes → views}/select_button.js +43 -0
  127. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form.js +35 -33
  128. data/lib/frameworks/sproutcore/frameworks/foundation/core.js +2 -2
  129. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +15 -8
  130. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/button.js +4 -7
  131. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/flowed_layout.js +55 -13
  132. data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/canvas_image.js +3 -1
  133. data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/render_delegate.js +7 -7
  134. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/benchmark.css +0 -0
  135. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/blank.gif +0 -0
  136. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/bootstrap.rhtml +0 -0
  137. data/lib/frameworks/sproutcore/frameworks/foundation/resources/button_view.css +36 -0
  138. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/checkbox_view.css +0 -0
  139. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/debug/control-test-pane.css +0 -0
  140. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/favicon.ico +0 -0
  141. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-logo.png +0 -0
  142. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup-landscape.jpg +0 -0
  143. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup-landscape.png +0 -0
  144. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup-portrait.jpg +0 -0
  145. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup-portrait.png +0 -0
  146. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup.png +0 -0
  147. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore.png +0 -0
  148. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/inline_editor.css +0 -0
  149. data/lib/frameworks/sproutcore/frameworks/foundation/resources/label.css +47 -0
  150. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/radio_view.css +0 -0
  151. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/static_layout.css +1 -1
  152. data/lib/frameworks/sproutcore/frameworks/foundation/resources/text_field.css +130 -0
  153. data/lib/frameworks/sproutcore/frameworks/foundation/system/chance.js +5 -1
  154. data/lib/frameworks/sproutcore/frameworks/foundation/system/string.js +0 -43
  155. data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/string_measurement.js +5 -2
  156. data/lib/frameworks/sproutcore/frameworks/foundation/validators/date.js +4 -4
  157. data/lib/frameworks/sproutcore/frameworks/foundation/views/container.js +4 -5
  158. data/lib/frameworks/sproutcore/frameworks/foundation/views/label.js +1 -1
  159. data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +5 -5
  160. data/lib/frameworks/sproutcore/frameworks/routing/system/routes.js +6 -3
  161. data/lib/frameworks/sproutcore/frameworks/routing/tests/system/routes.js +11 -0
  162. data/lib/frameworks/sproutcore/frameworks/runtime/core.js +2 -2
  163. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +2 -2
  164. data/lib/frameworks/sproutcore/frameworks/runtime/private/property_chain.js +2 -2
  165. data/lib/frameworks/sproutcore/frameworks/runtime/system/error.js +1 -1
  166. data/lib/frameworks/sproutcore/frameworks/runtime/system/logger.js +2 -2
  167. data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +2 -2
  168. data/lib/frameworks/sproutcore/frameworks/statechart/debug/monitor.js +4 -73
  169. data/lib/frameworks/sproutcore/frameworks/statechart/debug/sequence_matcher.js +189 -0
  170. data/lib/frameworks/sproutcore/frameworks/statechart/ext/function.js +122 -0
  171. data/lib/frameworks/sproutcore/frameworks/statechart/system/async.js +88 -0
  172. data/lib/frameworks/sproutcore/frameworks/statechart/system/empty_state.js +34 -0
  173. data/lib/frameworks/sproutcore/frameworks/statechart/system/history_state.js +97 -0
  174. data/lib/frameworks/sproutcore/frameworks/statechart/system/state.js +7 -189
  175. data/lib/frameworks/sproutcore/frameworks/statechart/system/statechart.js +14 -78
  176. data/lib/frameworks/sproutcore/frameworks/statechart/tests/debug/sequence_matcher.js +464 -0
  177. data/lib/frameworks/sproutcore/frameworks/statechart/tests/event_handling/basic/with_concurrent_states.js +31 -11
  178. data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/async/with_concurrent_states.js +6 -4
  179. data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/standard/with_concurrent_states/advanced.js +40 -6
  180. data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/standard/with_concurrent_states/basic.js +22 -2
  181. data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/standard/with_concurrent_states/intermediate.js +44 -3
  182. data/lib/frameworks/sproutcore/frameworks/testing/core.js +61 -9
  183. data/lib/frameworks/sproutcore/frameworks/testing/{english.lproj → resources}/additions.css +0 -0
  184. data/lib/frameworks/sproutcore/frameworks/testing/{english.lproj → resources}/runner.css +11 -2
  185. data/lib/frameworks/sproutcore/frameworks/testing/{english.lproj → resources}/testsuite.css +0 -0
  186. data/lib/frameworks/sproutcore/frameworks/testing/system/runner.js +66 -27
  187. data/lib/frameworks/sproutcore/frameworks/testing/tests/spy_on.js +41 -0
  188. data/lib/frameworks/sproutcore/frameworks/testing/tests/stub_method.js +9 -0
  189. data/lib/frameworks/sproutcore/frameworks/yuireset/resources/core.css +24 -0
  190. data/lib/frameworks/sproutcore/frameworks/yuireset/resources/fonts.css +39 -0
  191. data/lib/frameworks/sproutcore/frameworks/yuireset/resources/reset.css +126 -0
  192. data/lib/frameworks/sproutcore/frameworks/yuireset/resources/view.css +57 -0
  193. data/lib/frameworks/sproutcore/lib/index.rhtml +7 -4
  194. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_checked.png +0 -0
  195. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_checked_active.png +0 -0
  196. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_mixed.png +0 -0
  197. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_mixed_active.png +0 -0
  198. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_unchecked.png +0 -0
  199. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_unchecked_active.png +0 -0
  200. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_checked.png +0 -0
  201. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_checked_active.png +0 -0
  202. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_mixed.png +0 -0
  203. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_mixed_active.png +0 -0
  204. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_unchecked.png +0 -0
  205. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_unchecked_active.png +0 -0
  206. data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list.css +13 -4
  207. data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list_item.css +16 -14
  208. data/lib/frameworks/sproutcore/themes/ace/resources/menu/menu_item.png +0 -0
  209. data/lib/gen/app/templates/apps/@target_name@/Buildfile +1 -4
  210. data/lib/gen/app/templates/apps/@target_name@/core.js +1 -4
  211. data/lib/gen/app/templates/apps/@target_name@/main.js +1 -4
  212. data/lib/gen/app/templates/apps/@target_name@/resources/main_page.js +1 -4
  213. data/lib/gen/app/templates/apps/@target_name@/theme.js +1 -4
  214. data/lib/gen/controller/templates/controllers/{@filename@.js → @filename@_controller.js} +1 -4
  215. data/lib/gen/controller/templates/tests/controllers/{@filename@.js → @filename@_test.js} +1 -4
  216. data/lib/gen/data-source/templates/data_sources/{@filename@.js → @filename@_data_source.js} +1 -4
  217. data/lib/gen/design/templates/resources/@filename@.js +1 -4
  218. data/lib/gen/framework/templates/frameworks/@target_name@/core.js +1 -4
  219. data/lib/gen/framework/templates/frameworks/@target_name@/english.lproj/strings.js +1 -4
  220. data/lib/gen/html_app/templates/apps/@target_name@/@target_name@.js +1 -4
  221. data/lib/gen/html_app/templates/apps/@target_name@/resources/stylesheets/@target_name@.css +2 -0
  222. data/lib/gen/html_project/templates/@filename@/Buildfile +1 -4
  223. data/lib/gen/html_project/templates/@filename@/README +1 -4
  224. data/lib/gen/language/templates/@filename@/strings.js +1 -4
  225. data/lib/gen/model/templates/fixtures/{@filename@.js → @filename@_fixtures.js} +2 -5
  226. data/lib/gen/model/templates/models/{@filename@.js → @filename@_model.js} +1 -4
  227. data/lib/gen/model/templates/tests/models/{@filename@.js → @filename@_test.js} +1 -4
  228. data/lib/gen/page/templates/pages/@target_name@/Buildfile +1 -4
  229. data/lib/gen/page/templates/pages/@target_name@/core.js +1 -4
  230. data/lib/gen/page/templates/pages/@target_name@/en.lproj/strings.js +1 -4
  231. data/lib/gen/page/templates/pages/@target_name@/resources/body.css +3 -1
  232. data/lib/gen/project/templates/@filename@/Buildfile +1 -4
  233. data/lib/gen/project/templates/@filename@/README +1 -5
  234. data/lib/gen/responder/templates/states/{@filename@.js → @filename@_state.js} +1 -4
  235. data/lib/gen/test/templates/tests/{@filename@.js → @filename@_test.js} +1 -4
  236. data/lib/gen/theme/templates/themes/@target_name@/resources/theme_styles.css +1 -5
  237. data/lib/gen/theme/templates/themes/@target_name@/theme.js +1 -4
  238. data/lib/gen/view/templates/tests/views/{@filename@.js → @filename@_test.js} +1 -4
  239. data/lib/gen/view/templates/views/{@filename@.js → @filename@_view.js} +1 -4
  240. data/lib/sproutcore.rb +4 -1
  241. data/lib/sproutcore/builders/handlebars.rb +1 -1
  242. data/lib/sproutcore/builders/module.rb +2 -2
  243. data/lib/sproutcore/helpers/static_helper.rb +4 -2
  244. data/lib/sproutcore/models/generator.rb +22 -0
  245. data/lib/sproutcore/models/manifest_entry.rb +1 -0
  246. data/lib/sproutcore/models/target.rb +4 -1
  247. data/lib/sproutcore/rack/builder.rb +3 -0
  248. data/lib/sproutcore/tools.rb +11 -11
  249. data/lib/sproutcore/tools/init.rb +10 -22
  250. data/lib/sproutcore/tools/manifest.rb +21 -22
  251. data/spec/buildtasks/manifest/prepare_build_tasks/combine_spec.rb +21 -1
  252. data/spec/fixtures/ordered_entries/apps/template_style/a.js +0 -0
  253. data/spec/fixtures/ordered_entries/apps/template_style/template_style.js +0 -0
  254. data/spec/lib/buildfile_commands/build_task_spec.rb +1 -1
  255. data/spec/lib/tools/manifest_spec.rb +11 -0
  256. data/sproutcore.gemspec +2 -2
  257. data/vendor/chance/lib/chance/instance.rb +3 -1
  258. metadata +118 -74
  259. data/lib/frameworks/sproutcore/frameworks/core_foundation/resources/core.css +0 -378
  260. data/lib/frameworks/sproutcore/frameworks/core_foundation/resources/view.css +0 -57
  261. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/alert.css +0 -56
  262. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/disclosure.css +0 -73
  263. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/icons.css +0 -916
  264. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/images/icons/shared.png +0 -0
  265. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/list_item.css +0 -185
  266. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/menu.css +0 -12
  267. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/menu_item_view.css +0 -101
  268. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/panel.css +0 -91
  269. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/picker.css +0 -35
  270. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/progress.css +0 -33
  271. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/radio.css +0 -10
  272. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/segmented.css +0 -132
  273. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/separator.css +0 -19
  274. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/slider.css +0 -69
  275. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/strings.js +0 -14
  276. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/well.css +0 -71
  277. data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/button_view.css +0 -40
  278. data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/label.css +0 -47
  279. data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/text_field.css +0 -146
  280. data/lib/frameworks/sproutcore/themes/empty_theme/tests/mini_icons.rhtml +0 -69
@@ -136,4 +136,4 @@ including:
136
136
  * [jQuery](http://www.jquery.com/)
137
137
  * [Prototype](http://www.prototypejs.org/)
138
138
  * [Datejs](http://www.datejs.com/)
139
- * [JSON2](http://www.json.org/)
139
+ * [JSON2](http://www.json.org/)
@@ -12,6 +12,15 @@
12
12
  -moz-box-shadow: inset rgba(0,0,0,0.3) 0 3px 8px;
13
13
  }
14
14
 
15
+ .app-selector .sc-list-item-view {
16
+ font-size: 11px;
17
+ }
18
+
19
+ .app-selector .sc-collection-view {
20
+ background: none;
21
+ border-right: none;
22
+ }
23
+
15
24
  .sc-list-view .sc-list-item-view {
16
25
  border-bottom: 1px solid #ddd;
17
26
  font-weight: bold;
@@ -9,119 +9,135 @@ sc_require('system/response');
9
9
 
10
10
  /**
11
11
  @class
12
-
12
+
13
13
  Implements support for Ajax requests using XHR and other prototcols.
14
-
14
+
15
15
  SC.Request is much like an inverted version of the request/response objects
16
- you receive when implementing HTTP servers.
17
-
16
+ you receive when implementing HTTP servers.
17
+
18
18
  To send a request, you just need to create your request object, configure
19
19
  your options, and call send() to initiate the request.
20
-
20
+
21
21
  @extends SC.Object
22
22
  @extends SC.Copyable
23
23
  @extends SC.Freezable
24
24
  @since SproutCore 1.0
25
25
  */
26
-
27
26
  SC.Request = SC.Object.extend(SC.Copyable, SC.Freezable,
28
- /** @scope SC.Request.prototype */ {
29
-
27
+ /** @scope SC.Request.prototype */ {
28
+
30
29
  // ..........................................................
31
30
  // PROPERTIES
32
31
  //
33
-
34
- /**
35
- Sends the request asynchronously instead of blocking the browser. You
36
- should almost always make requests asynchronous. You can change this
37
- options with the async() helper option (or simply set it directly).
38
32
 
39
- @default YES
40
- @property {Boolean}
41
- */
42
- isAsynchronous: YES,
33
+ /**
34
+ Sends the request asynchronously instead of blocking the browser. You
35
+ should almost always make requests asynchronous. You can change this
36
+ options with the async() helper option (or simply set it directly).
37
+
38
+ @type Boolean
39
+ @default YES
40
+ */
41
+ isAsynchronous: YES,
43
42
 
44
43
  /**
45
- Processes the request and response as JSON if possible. You can change
44
+ Processes the request and response as JSON if possible. You can change
46
45
  this option with the json() helper method.
47
46
 
48
- @default NO
49
- @property {Boolean}
47
+ @type Boolean
48
+ @default NO
50
49
  */
51
50
  isJSON: NO,
52
51
 
53
52
  /**
54
- Process the request and response as XML if possible. You can change this
53
+ Process the request and response as XML if possible. You can change this
55
54
  option with the xml() helper method.
56
-
55
+
56
+ @type Boolean
57
57
  @default NO
58
- @property {Boolean}
59
58
  */
60
59
  isXML: NO,
61
-
60
+
61
+ /**
62
+ Specifies whether or not the request will have custom headers attached
63
+ to it. By default, SC.Request attaches X-Requested-With and
64
+ X-SproutCore-Version headers to all outgoing requests. This allows
65
+ you to override that behavior.
66
+
67
+ @type Boolean
68
+ @default YES
69
+ */
70
+ attachIdentifyingHeaders: YES,
62
71
 
63
72
  init: function() {
64
73
  sc_super();
65
- this.header('X-Requested-With', 'XMLHttpRequest');
66
- this.header('X-SproutCore-Version', SC.VERSION);
74
+
75
+ if (this.get('attachIdentifyingHeaders') !== NO) {
76
+ this.header('X-Requested-With', 'XMLHttpRequest');
77
+ this.header('X-SproutCore-Version', SC.VERSION);
78
+ }
67
79
  },
68
-
80
+
69
81
  /**
70
82
  Current set of headers for the request
83
+
84
+ @field
85
+ @type Hash
86
+ @default {}
71
87
  */
72
88
  headers: function() {
73
- var ret = this._headers ;
74
- if (!ret) ret = this._headers = {} ;
75
- return ret ;
89
+ var ret = this._headers;
90
+ if (!ret) { ret = this._headers = {}; }
91
+ return ret;
76
92
  }.property().cacheable(),
77
93
 
78
94
  /**
79
- Underlying response class to actually handle this request. Currently the
95
+ Underlying response class to actually handle this request. Currently the
80
96
  only supported option is SC.XHRResponse which uses a traditional
81
97
  XHR transport.
82
-
83
- @default SC.XHRResponse
84
- @property {SC.Response}
98
+
99
+ @type SC.Response
100
+ @default SC.XHRResponse
85
101
  */
86
102
  responseClass: SC.XHRResponse,
87
103
 
88
104
  /**
89
105
  The original request for copied requests.
90
-
91
- @default null
92
- @property {SC.Request}
106
+
107
+ @property SC.Request
108
+ @default null
93
109
  */
94
110
  source: null,
95
-
111
+
96
112
  /**
97
113
  The URL this request to go to.
98
-
99
- @default null
100
- @property {String}
114
+
115
+ @type String
116
+ @default null
101
117
  */
102
118
  address: null,
103
-
119
+
104
120
  /**
105
121
  The HTTP method to use.
106
-
107
- @default GET
108
- @param {String}
122
+
123
+ @type String
124
+ @default 'GET'
109
125
  */
110
126
  type: 'GET',
111
127
 
112
128
  /**
113
- An optional timeout value of the request, in milliseconds. The timer
129
+ An optional timeout value of the request, in milliseconds. The timer
114
130
  begins when SC.Response#fire is actually invoked by the request manager
115
- and not necessarily when SC.Request#send is invoked. If this timeout is
131
+ and not necessarily when SC.Request#send is invoked. If this timeout is
116
132
  reached before a response is received, the equivalent of
117
133
  SC.Request.manager#cancel() will be invoked on the SC.Response instance
118
134
  and the didReceive() callback will be called.
119
135
 
120
136
  An exception will be thrown if you try to invoke send() on a request that
121
137
  has both a timeout and isAsyncronous set to NO.
122
-
123
- @default null
124
- @property {Number}
138
+
139
+ @type Number
140
+ @default null
125
141
  */
126
142
  timeout: null,
127
143
 
@@ -129,159 +145,179 @@ isAsynchronous: YES,
129
145
  The body of the request. May be an object is isJSON or isXML is set,
130
146
  otherwise should be a string.
131
147
 
132
- @property {Object|String}
148
+ @type Object|String
149
+ @default null
133
150
  */
134
151
  body: null,
135
152
 
136
153
  /**
137
154
  The body, encoded as JSON or XML if needed.
138
155
 
139
- @property {Object|String}
156
+ @field
157
+ @type Object|String
158
+ @default #body
140
159
  */
141
160
  encodedBody: function() {
142
161
  // TODO: support XML
143
162
  var ret = this.get('body');
144
- if (ret && this.get('isJSON')) ret = SC.json.encode(ret);
145
- return ret ;
163
+ if (ret && this.get('isJSON')) { ret = SC.json.encode(ret); }
164
+ return ret;
146
165
  }.property('isJSON', 'isXML', 'body').cacheable(),
147
166
 
167
+
148
168
  // ..........................................................
149
169
  // CALLBACKS
150
- //
151
-
170
+ //
171
+
152
172
  /**
153
- Invoked on the original request object just before a copied request is
154
- frozen and then sent to the server. This gives you one last change to
173
+ Invoked on the original request object just before a copied request is
174
+ frozen and then sent to the server. This gives you one last change to
155
175
  fixup the request; possibly adding headers and other options.
156
-
176
+
157
177
  If you do not want the request to actually send, call cancel().
158
-
178
+
159
179
  @param {SC.Request} request A copy of the request object, not frozen
160
180
  @param {SC.Response} response The object that will wrap the response
161
181
  */
162
182
  willSend: function(request, response) {},
163
-
183
+
164
184
  /**
165
185
  Invoked on the original request object just after the request is sent to
166
- the server. You might use this callback to update some state in your
186
+ the server. You might use this callback to update some state in your
167
187
  application.
168
-
169
- The passed request is a frozen copy of the request, indicating the
188
+
189
+ The passed request is a frozen copy of the request, indicating the
170
190
  options set at the time of the request.
171
191
 
172
192
  @param {SC.Request} request A copy of the request object, frozen
173
193
  @param {SC.Response} response The object that will wrap the response
174
- @returns BOOL YES on success, NO on failure
194
+ @returns {Boolean} YES on success, NO on failure
175
195
  */
176
196
  didSend: function(request, response) {},
177
-
197
+
178
198
  /**
179
- Invoked when a response has been received but not yet processed. This is
180
- your chance to fix up the response based on the results. If you don't
199
+ Invoked when a response has been received but not yet processed. This is
200
+ your chance to fix up the response based on the results. If you don't
181
201
  want to continue processing the response call response.cancel().
182
202
 
183
203
  @param {SC.Request} request A copy of the request object, frozen
184
204
  @param {SC.Response} response The object that will wrap the response
185
205
  */
186
206
  willReceive: function(request, response) {},
187
-
207
+
188
208
  /**
189
209
  Invoked after a response has been processed but before any listeners are
190
- notified. You can do any standard processing on the request at this
191
- point. If you don't want to allow notifications to continue, call
210
+ notified. You can do any standard processing on the request at this
211
+ point. If you don't want to allow notifications to continue, call
192
212
  response.cancel()
193
213
 
194
214
  @param {SC.Request} request A copy of the request object, frozen
195
215
  @param {SC.Response} response The object that will wrap the response
196
216
  */
197
217
  didReceive: function(request, response) {},
198
-
218
+
219
+
199
220
  // ..........................................................
200
221
  // HELPER METHODS
201
- //
222
+ //
202
223
 
224
+ /** @private */
203
225
  concatenatedProperties: 'COPY_KEYS',
204
226
 
205
- COPY_KEYS: ['isAsynchronous', 'isJSON', 'isXML', 'address', 'type', 'timeout', 'body', 'responseClass', 'willSend', 'didSend', 'willReceive', 'didReceive'],
227
+ /** @private */
228
+ COPY_KEYS: ['attachIdentifyingHeaders', 'isAsynchronous', 'isJSON', 'isXML', 'address', 'type', 'timeout', 'body', 'responseClass', 'willSend', 'didSend', 'willReceive', 'didReceive'],
206
229
 
207
230
  /**
208
- Returns a copy of the current request. This will only copy certain
231
+ Returns a copy of the current request. This will only copy certain
209
232
  properties so if you want to add additional properties to the copy you
210
233
  will need to override copy() in a subclass.
211
-
234
+
212
235
  @returns {SC.Request} new request
213
236
  */
214
237
  copy: function() {
215
238
  var ret = {},
216
239
  keys = this.COPY_KEYS,
217
- loc = keys.length,
240
+ loc = keys.length,
218
241
  key, listeners, headers;
219
-
220
- while(--loc>=0) {
242
+
243
+ while(--loc >= 0) {
221
244
  key = keys[loc];
222
- if (this.hasOwnProperty(key)) ret[key] = this.get(key);
245
+ if (this.hasOwnProperty(key)) {
246
+ ret[key] = this.get(key);
247
+ }
223
248
  }
224
-
249
+
225
250
  if (this.hasOwnProperty('listeners')) {
226
251
  ret.listeners = SC.copy(this.get('listeners'));
227
252
  }
228
-
253
+
229
254
  if (this.hasOwnProperty('_headers')) {
230
255
  ret._headers = SC.copy(this._headers);
231
256
  }
232
-
233
- ret.source = this.get('source') || this ;
234
-
257
+
258
+ ret.source = this.get('source') || this;
259
+
235
260
  return this.constructor.create(ret);
236
261
  },
237
-
262
+
238
263
  /**
239
- To set headers on the request object. Pass either a single key/value
240
- pair or a hash of key/value pairs. If you pass only a header name, this
264
+ To set headers on the request object. Pass either a single key/value
265
+ pair or a hash of key/value pairs. If you pass only a header name, this
241
266
  will return the current value of the header.
242
-
267
+
243
268
  @param {String|Hash} key
244
269
  @param {String} value
245
270
  @returns {SC.Request|Object} receiver
246
271
  */
247
272
  header: function(key, value) {
248
273
  var headers;
249
-
274
+
250
275
  if (SC.typeOf(key) === SC.T_STRING) {
251
- headers = this._headers ;
252
- if (arguments.length===1) {
276
+ headers = this._headers;
277
+ if (arguments.length === 1) {
253
278
  return headers ? headers[key] : null;
254
279
  } else {
255
280
  this.propertyWillChange('headers');
256
- if (!headers) headers = this._headers = {};
281
+ if (!headers) { headers = this._headers = {}; }
257
282
  headers[key] = value;
258
283
  this.propertyDidChange('headers');
259
284
  return this;
260
285
  }
261
-
286
+
262
287
  // handle parsing hash of parameters
263
288
  } else if (value === undefined) {
264
289
  headers = key;
265
290
  this.beginPropertyChanges();
266
291
  for(key in headers) {
267
- if (!headers.hasOwnProperty(key)) continue ;
292
+ if (!headers.hasOwnProperty(key)) { continue; }
268
293
  this.header(key, headers[key]);
269
294
  }
270
295
  this.endPropertyChanges();
271
296
  return this;
272
297
  }
273
298
 
274
- return this ;
299
+ return this;
300
+ },
301
+
302
+ /**
303
+ Clears the list of headers that were set on this request.
304
+ This could be used by a subclass to blow-away any custom
305
+ headers that were added by the super class.
306
+ */
307
+ clearHeaders: function() {
308
+ this.propertyWillChange('headers');
309
+ this._headers = {};
310
+ this.propertyDidChange('headers');
275
311
  },
276
312
 
277
313
  /**
278
314
  Converts the current request to be asynchronous.
279
315
 
280
- @param {Boolean} flag YES to make asynchronous, NO or undefined
316
+ @param {Boolean} flag YES to make asynchronous, NO or undefined. Default YES.
281
317
  @returns {SC.Request} receiver
282
318
  */
283
319
  async: function(flag) {
284
- if (flag === undefined) flag = YES;
320
+ if (flag === undefined) { flag = YES; }
285
321
  return this.set('isAsynchronous', flag);
286
322
  },
287
323
 
@@ -297,30 +333,32 @@ isAsynchronous: YES,
297
333
 
298
334
  /**
299
335
  Converts the current request to use JSON.
300
-
301
- @param {Boolean} flag YES to make JSON, NO or undefined
336
+
337
+ @param {Boolean} flag YES to make JSON, NO or undefined. Default YES.
302
338
  @returns {SC.Request} receiver
303
339
  */
304
340
  json: function(flag) {
305
- if (flag === undefined) flag = YES;
306
- if (flag) this.set('isXML', NO);
341
+ if (flag === undefined) { flag = YES; }
342
+ if (flag) { this.set('isXML', NO); }
307
343
  return this.set('isJSON', flag);
308
344
  },
309
-
345
+
310
346
  /**
311
347
  Converts the current request to use XML.
312
-
313
- @param {Boolean} flag YES to make XML, NO or undefined
348
+
349
+ @param {Boolean} flag YES to make XML, NO or undefined. Default YES.
314
350
  @returns {SC.Request} recevier
315
351
  */
316
352
  xml: function(flag) {
317
- if (flag === undefined) flag = YES ;
318
- if (flag) this.set('isJSON', NO);
353
+ if (flag === undefined) { flag = YES; }
354
+ if (flag) { this.set('isJSON', NO); }
319
355
  return this.set('isXML', flag);
320
356
  },
321
-
322
- /**
323
- Called just before a request is enqueued. This will encode the body
357
+
358
+ /**
359
+ @private
360
+
361
+ Called just before a request is enqueued. This will encode the body
324
362
  into JSON if it is not already encoded.
325
363
  */
326
364
  _prep: function() {
@@ -330,110 +368,112 @@ isAsynchronous: YES,
330
368
  } else if (this.get('isXML') && !hasContentType) {
331
369
  this.header('Content-Type', 'text/xml');
332
370
  }
333
- return this ;
371
+ return this;
334
372
  },
335
373
 
336
374
  /**
337
- Will fire the actual request. If you have set the request to use JSON
338
- mode then you can pass any object that can be converted to JSON as the
339
- body. Otherwise you should pass a string body.
375
+ Will fire the actual request. If you have set the request to use JSON
376
+ mode then you can pass any object that can be converted to JSON as the
377
+ body. Otherwise you should pass a string body.
340
378
 
341
- @param {String|Object} body (optional)
342
- @returns {SC.Response} new response object
379
+ @param {String|Object} [body]
380
+ @returns {SC.Response} New response object
343
381
  */
344
382
  send: function(body) {
345
- // Sanity-check: Be sure a timeout value was not specified if the request
383
+ // Sanity-check: Be sure a timeout value was not specified if the request
346
384
  // is synchronous (because it wouldn't work).
347
385
  var timeout = this.get('timeout');
348
- if (timeout) {
349
- if (!this.get('isAsynchronous')) throw "Timeout values cannot be used with synchronous requests";
350
- }
351
- else if (timeout === 0) {
386
+ if (timeout && !this.get('isAsynchronous')) {
387
+ throw "Timeout values cannot be used with synchronous requests";
388
+ } else if (timeout === 0) {
352
389
  throw "The timeout value must either not be specified or must be greater than 0";
353
390
  }
354
-
355
- if (body) this.set('body', body);
391
+
392
+ if (body) { this.set('body', body); }
356
393
  return SC.Request.manager.sendRequest(this.copy()._prep());
357
394
  },
358
395
 
359
396
  /**
360
- Resends the current request. This is more efficient than calling send()
361
- for requests that have already been used in a send. Otherwise acts just
362
- like send(). Does not take a body argument.
363
-
397
+ Resends the current request. This is more efficient than calling send()
398
+ for requests that have already been used in a send. Otherwise acts just
399
+ like send(). Does not take a body argument.
400
+
364
401
  @returns {SC.Response} new response object
365
402
  */
366
403
  resend: function() {
367
404
  var req = this.get('source') ? this : this.copy()._prep();
368
405
  return SC.Request.manager.sendRequest(req);
369
406
  },
370
-
407
+
371
408
  /**
372
- Configures a callback to execute when a request completes. You must pass
409
+ Configures a callback to execute when a request completes. You must pass
373
410
  at least a target and action/method to this and optionally a status code.
374
411
  You may also pass additional parameters which will be passed along to your
375
412
  callback. If your callback handled the notification, it should return YES.
376
-
377
- Scoping With Status Codes
378
- ------
379
-
380
- If you pass a status code as the first option to this method, then your
413
+
414
+ ## Scoping With Status Codes
415
+
416
+ If you pass a status code as the first option to this method, then your
381
417
  notification callback will only be called if the response status matches
382
- the code. For example, if you pass 201 (or SC.Request.CREATED) then
418
+ the code. For example, if you pass 201 (or SC.Request.CREATED) then
383
419
  your method will only be called if the response status from the server
384
420
  is 201.
385
-
421
+
386
422
  You can also pass "generic" status codes such as 200, 300, or 400, which
387
- will be invoked anytime the status code is the range if a more specific
388
- notifier was not registered first and returned YES.
389
-
423
+ will be invoked anytime the status code is the range if a more specific
424
+ notifier was not registered first and returned YES.
425
+
390
426
  Finally, passing a status code of 0 or no status at all will cause your
391
- method to be executed no matter what the resulting status is unless a
427
+ method to be executed no matter what the resulting status is unless a
392
428
  more specific notifier was registered and returned YES.
393
-
394
- Callback Format
395
- ------
396
-
429
+
430
+ ## Callback Format
431
+
397
432
  Your notification callback should expect to receive the Response object
398
- as the first parameter plus any additional parameters that you pass.
399
-
433
+ as the first parameter plus any additional parameters that you pass.
434
+
400
435
  @param {Number} status
401
436
  @param {Object} target
402
- @param {String|function} action
437
+ @param {String|Function} action
403
438
  @param {Hash} params
404
439
  @returns {SC.Request} receiver
405
440
  */
406
441
  notify: function(status, target, action, params) {
407
-
408
442
  // normalize status
409
- var hasStatus = YES ;
443
+ var hasStatus = YES;
410
444
  if (SC.typeOf(status) !== SC.T_NUMBER) {
411
445
  params = SC.A(arguments).slice(2);
412
446
  action = target;
413
447
  target = status;
414
- status = 0 ;
415
- hasStatus = NO ;
416
- } else params = SC.A(arguments).slice(3);
417
-
448
+ status = 0;
449
+ hasStatus = NO;
450
+ } else {
451
+ params = SC.A(arguments).slice(3);
452
+ }
453
+
418
454
  var listeners = this.get('listeners');
419
- if (!listeners) this.set('listeners', listeners = {});
420
- listeners[status] = { target: target, action: action, params: params };
455
+ if (!listeners) { this.set('listeners', listeners = {}); }
456
+ if(!listeners[status]) { listeners[status] = []; }
457
+
458
+ listeners[status].push({target: target, action: action, params: params});
421
459
 
422
460
  return this;
423
461
  }
424
-
462
+
425
463
  });
426
464
 
427
- SC.Request.mixin(/** @scope SC.Request */ {
428
-
465
+ SC.Request.mixin(
466
+ /** @scope SC.Request */ {
467
+
429
468
  /**
430
469
  Helper method for quickly setting up a GET request.
431
470
 
432
471
  @param {String} address url of request
472
+ @param {Boolean} [attachHeaders] See documentation for SC.Request#attachIdentifyingHeaders
433
473
  @returns {SC.Request} receiver
434
474
  */
435
- getUrl: function(address) {
436
- return this.create().set('address', address).set('type', 'GET');
475
+ getUrl: function(address, attachHeaders) {
476
+ return this.create({attachIdentifyingHeaders: attachHeaders}).set('address', address).set('type', 'GET');
437
477
  },
438
478
 
439
479
  /**
@@ -441,22 +481,24 @@ SC.Request.mixin(/** @scope SC.Request */ {
441
481
 
442
482
  @param {String} address url of request
443
483
  @param {String} body
484
+ @param {Boolean} [attachHeaders] See documentation for SC.Request#attachIdentifyingHeaders
444
485
  @returns {SC.Request} receiver
445
486
  */
446
- postUrl: function(address, body) {
447
- var req = this.create().set('address', address).set('type', 'POST');
448
- if(body) req.set('body', body) ;
449
- return req ;
487
+ postUrl: function(address, body, attachHeaders) {
488
+ var req = this.create({attachIdentifyingHeaders: attachHeaders}).set('address', address).set('type', 'POST');
489
+ if(body) { req.set('body', body); }
490
+ return req;
450
491
  },
451
492
 
452
493
  /**
453
494
  Helper method for quickly setting up a DELETE request.
454
495
 
455
496
  @param {String} address url of request
497
+ @param {Boolean} [attachHeaders] See documentation for SC.Request#attachIdentifyingHeaders
456
498
  @returns {SC.Request} receiver
457
499
  */
458
- deleteUrl: function(address) {
459
- return this.create().set('address', address).set('type', 'DELETE');
500
+ deleteUrl: function(address, attachHeaders) {
501
+ return this.create({attachIdentifyingHeaders: attachHeaders}).set('address', address).set('type', 'DELETE');
460
502
  },
461
503
 
462
504
  /**
@@ -464,63 +506,69 @@ SC.Request.mixin(/** @scope SC.Request */ {
464
506
 
465
507
  @param {String} address url of request
466
508
  @param {String} body
509
+ @param {Boolean} [attachHeaders] See documentation for SC.Request#attachIdentifyingHeaders
467
510
  @returns {SC.Request} receiver
468
511
  */
469
- putUrl: function(address, body) {
470
- var req = this.create().set('address', address).set('type', 'PUT');
471
- if(body) req.set('body', body) ;
472
- return req ;
512
+ putUrl: function(address, body, attachHeaders) {
513
+ var req = this.create({attachIdentifyingHeaders: attachHeaders}).set('address', address).set('type', 'PUT');
514
+ if(body) { req.set('body', body); }
515
+ return req;
473
516
  }
517
+
474
518
  });
475
519
 
476
520
  /**
477
521
  @class
478
522
 
479
- The request manager coordinates all of the active XHR requests. It will
480
- only allow a certain number of requests to be active at a time; queuing
481
- any others. This allows you more precise control over which requests load
523
+ The request manager coordinates all of the active XHR requests. It will
524
+ only allow a certain number of requests to be active at a time; queuing
525
+ any others. This allows you more precise control over which requests load
482
526
  in which order.
483
527
 
484
528
  @since SproutCore 1.0
485
529
  */
486
530
  SC.Request.manager = SC.Object.create(
487
- /** @scope SC.Request.manager */{
531
+ /** @scope SC.Request.manager */{
488
532
 
489
533
  /**
490
- Maximum number of concurrent requests allowed. 6 for all browsers.
534
+ Maximum number of concurrent requests allowed. 6 for all browsers.
491
535
 
492
- @property {Number}
536
+ @type Number
537
+ @default 6
493
538
  */
494
539
  maxRequests: 6,
495
540
 
496
541
  /**
497
542
  Current requests that are inflight.
498
-
499
- @property {Array}
543
+
544
+ @type Array
545
+ @default []
500
546
  */
501
547
  inflight: [],
502
-
548
+
503
549
  /**
504
550
  Requests that are pending and have not been started yet.
505
-
506
- @property {Array}
551
+
552
+ @type Array
553
+ @default []
507
554
  */
508
555
  pending: [],
509
556
 
557
+
510
558
  // ..........................................................
511
559
  // METHODS
512
560
  //
513
561
 
514
562
  /**
515
- Invoked by the send() method on a request. This will create a new low-
563
+ Invoked by the send() method on a request. This will create a new low-
516
564
  level transport object and queue it if needed.
517
565
 
518
566
  @param {SC.Request} request the request to send
519
567
  @returns {SC.Object} response object
520
568
  */
521
569
  sendRequest: function(request) {
522
- if (!request) return null ;
523
-
570
+ if (!request) { return null; }
571
+
524
572
  // create low-level transport. copy all critical data for request over
525
573
  // so that if the request has been reconfigured the transport will still
526
574
  // work.
@@ -529,43 +577,41 @@ SC.Request.manager = SC.Object.create(
529
577
  // add to pending queue
530
578
  this.get('pending').pushObject(response);
531
579
  this.fireRequestIfNeeded();
532
-
533
- return response ;
580
+
581
+ return response;
534
582
  },
535
583
 
536
584
  /**
537
- Cancels a specific request. If the request is pending it will simply
538
- be removed. Otherwise it will actually be cancelled.
539
-
585
+ Cancels a specific request. If the request is pending it will simply
586
+ be removed. Otherwise it will actually be cancelled.
587
+
540
588
  @param {Object} response a response object
541
589
  @returns {Boolean} YES if cancelled
542
590
  */
543
591
  cancel: function(response) {
544
-
545
592
  var pending = this.get('pending'),
546
593
  inflight = this.get('inflight'),
547
- idx ;
594
+ idx;
548
595
 
549
596
  if (pending.indexOf(response) >= 0) {
550
597
  this.propertyWillChange('pending');
551
598
  pending.removeObject(response);
552
599
  this.propertyDidChange('pending');
553
600
  return YES;
554
-
555
601
  } else if (inflight.indexOf(response) >= 0) {
556
-
557
602
  response.cancel();
558
-
603
+
559
604
  inflight.removeObject(response);
560
605
  this.fireRequestIfNeeded();
561
606
  return YES;
607
+ }
562
608
 
563
- } else return NO ;
564
- },
609
+ return NO;
610
+ },
565
611
 
566
612
  /**
567
- Cancels all inflight and pending requests.
568
-
613
+ Cancels all inflight and pending requests.
614
+
569
615
  @returns {Boolean} YES if any items were cancelled.
570
616
  */
571
617
  cancelAll: function() {
@@ -574,22 +620,23 @@ SC.Request.manager = SC.Object.create(
574
620
  this.get('inflight').forEach(function(r) { r.cancel(); });
575
621
  this.set('inflight', []);
576
622
  return YES;
577
-
578
- } else return NO ;
623
+ }
624
+
625
+ return NO;
579
626
  },
580
627
 
581
628
  /**
582
- Checks the inflight queue. If there is an open slot, this will move a
629
+ Checks the inflight queue. If there is an open slot, this will move a
583
630
  request from pending to inflight.
584
-
631
+
585
632
  @returns {Object} receiver
586
633
  */
587
634
  fireRequestIfNeeded: function() {
588
- var pending = this.get('pending'),
635
+ var pending = this.get('pending'),
589
636
  inflight = this.get('inflight'),
590
637
  max = this.get('maxRequests'),
591
- next ;
592
-
638
+ next;
639
+
593
640
  if ((pending.length>0) && (inflight.length<max)) {
594
641
  next = pending.shiftObject();
595
642
  inflight.pushObject(next);
@@ -598,12 +645,12 @@ SC.Request.manager = SC.Object.create(
598
645
  },
599
646
 
600
647
  /**
601
- Called by a response/transport object when finishes running. Removes
648
+ Called by a response/transport object when finishes running. Removes
602
649
  the transport from the queue and kicks off the next one.
603
650
  */
604
651
  transportDidClose: function(response) {
605
652
  this.get('inflight').removeObject(response);
606
653
  this.fireRequestIfNeeded();
607
654
  }
608
-
655
+
609
656
  });