sproutcore 1.0.1003 → 1.0.1008

Sign up to get free protection for your applications and to get access to all the features.
Files changed (276) hide show
  1. data/Buildfile +15 -3
  2. data/Rakefile +3 -7
  3. data/VERSION.yml +2 -2
  4. data/buildtasks/manifest.rake +2 -0
  5. data/frameworks/sproutcore/Buildfile +2 -0
  6. data/frameworks/sproutcore/HISTORY +218 -203
  7. data/frameworks/sproutcore/README +47 -6
  8. data/frameworks/sproutcore/apps/tests/english.lproj/main_page.css +4 -0
  9. data/frameworks/sproutcore/design/Design Charts.graffle +2945 -4332
  10. data/frameworks/sproutcore/frameworks/bootstrap/README +9 -0
  11. data/frameworks/sproutcore/frameworks/bootstrap/core.js +7 -0
  12. data/frameworks/sproutcore/frameworks/bootstrap/setup_body_class_names.js +10 -0
  13. data/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +28 -0
  14. data/frameworks/sproutcore/frameworks/bootstrap/system/loader.js +45 -0
  15. data/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +9 -8
  16. data/frameworks/sproutcore/frameworks/datastore/models/record.js +49 -9
  17. data/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +9 -0
  18. data/frameworks/sproutcore/frameworks/datastore/models/single_attribute.js +3 -2
  19. data/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +81 -8
  20. data/frameworks/sproutcore/frameworks/datastore/system/query.js +26 -5
  21. data/frameworks/sproutcore/frameworks/datastore/system/record_array.js +47 -0
  22. data/frameworks/sproutcore/frameworks/datastore/system/store.js +164 -32
  23. data/frameworks/sproutcore/frameworks/datastore/tests/models/many_attribute.js +32 -4
  24. data/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js +56 -0
  25. data/frameworks/sproutcore/frameworks/datastore/tests/models/record/normalize.js +1 -1
  26. data/frameworks/sproutcore/frameworks/datastore/tests/models/record/unknownProperty.js +15 -0
  27. data/frameworks/sproutcore/frameworks/datastore/tests/models/record/writeAttribute.js +16 -1
  28. data/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +1 -1
  29. data/frameworks/sproutcore/frameworks/datastore/tests/models/single_attribute.js +22 -1
  30. data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/chain.js +32 -1
  31. data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/core_methods.js +70 -0
  32. data/frameworks/sproutcore/frameworks/datastore/tests/system/query/evaluation.js +12 -0
  33. data/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/error_methods.js +50 -0
  34. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitRecord.js +9 -9
  35. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/core_methods.js +8 -1
  36. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataHashDidChange.js +79 -0
  37. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataSourceCallbacks.js +24 -0
  38. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/error_methods.js +62 -0
  39. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/init.js +2 -0
  40. data/frameworks/sproutcore/frameworks/debug/core.js +10 -6
  41. data/frameworks/sproutcore/frameworks/designer/controllers/page_design.js +43 -18
  42. data/frameworks/sproutcore/frameworks/designer/core.js +10 -0
  43. data/frameworks/sproutcore/frameworks/designer/english.lproj/selection_handles.css +58 -0
  44. data/frameworks/sproutcore/frameworks/designer/{views/mixins → mixins}/button.js +0 -0
  45. data/frameworks/sproutcore/frameworks/designer/views/{controls/button.js → button.js} +6 -2
  46. data/frameworks/sproutcore/frameworks/designer/views/designer.js +566 -136
  47. data/frameworks/sproutcore/frameworks/designer/views/selection_handles.js +77 -0
  48. data/frameworks/sproutcore/frameworks/desktop/core.js +12 -0
  49. data/frameworks/sproutcore/frameworks/desktop/english.lproj/alert.css +1 -1
  50. data/frameworks/sproutcore/frameworks/desktop/english.lproj/drag.css +3 -2
  51. data/frameworks/sproutcore/frameworks/desktop/english.lproj/list_item.css +0 -36
  52. data/frameworks/sproutcore/frameworks/desktop/english.lproj/menu.css +14 -0
  53. data/frameworks/sproutcore/frameworks/desktop/english.lproj/modal.css +4 -0
  54. data/frameworks/sproutcore/frameworks/desktop/english.lproj/slider.css +2 -0
  55. data/frameworks/sproutcore/frameworks/desktop/english.lproj/tab.css +0 -4
  56. data/frameworks/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +8 -5
  57. data/frameworks/sproutcore/frameworks/desktop/panes/alert.js +2 -2
  58. data/frameworks/sproutcore/frameworks/desktop/panes/menu.js +100 -111
  59. data/frameworks/sproutcore/frameworks/desktop/panes/panel.js +1 -1
  60. data/frameworks/sproutcore/frameworks/desktop/panes/picker.js +51 -13
  61. data/frameworks/sproutcore/frameworks/desktop/panes/{drop_down.js → select_button.js} +70 -109
  62. data/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +8 -0
  63. data/frameworks/sproutcore/frameworks/desktop/system/root_responder.js +69 -23
  64. data/frameworks/sproutcore/frameworks/desktop/system/undo_manager.js +4 -4
  65. data/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/methods.js +2 -0
  66. data/frameworks/sproutcore/frameworks/desktop/tests/panes/{dropDown → select_button}/methods.js +15 -11
  67. data/frameworks/sproutcore/frameworks/desktop/tests/panes/{dropDown → select_button}/ui.js +22 -22
  68. data/frameworks/sproutcore/frameworks/desktop/tests/views/button/methods.js +1 -1
  69. data/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +0 -1
  70. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/deleteSelection.js +1 -1
  71. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/deselect.js +19 -3
  72. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/itemViewForContentIndex.js +1 -1
  73. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/mouse.js +53 -28
  74. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/select.js +6 -6
  75. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/selectNextItem.js +23 -9
  76. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/selectPreviousItem.js +24 -10
  77. data/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowHeightForContentIndex.js +1 -1
  78. data/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_row_heights.js +1 -1
  79. data/frameworks/sproutcore/frameworks/desktop/tests/views/progress/ui.js +10 -3
  80. data/frameworks/sproutcore/frameworks/desktop/tests/views/radio/methods.js +1 -1
  81. data/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/ui.js +50 -28
  82. data/frameworks/sproutcore/frameworks/desktop/tests/views/scroller/methods.js +6 -6
  83. data/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/methods.js +3 -3
  84. data/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +8 -8
  85. data/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/methods.js +1 -1
  86. data/frameworks/sproutcore/frameworks/desktop/tests/views/tab/methods.js +1 -1
  87. data/frameworks/sproutcore/frameworks/desktop/views/button.js +5 -3
  88. data/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +4 -3
  89. data/frameworks/sproutcore/frameworks/desktop/views/collection.js +125 -96
  90. data/frameworks/sproutcore/frameworks/desktop/views/grid.js +1 -0
  91. data/frameworks/sproutcore/frameworks/desktop/views/list.js +68 -18
  92. data/frameworks/sproutcore/frameworks/desktop/views/list_item.js +134 -56
  93. data/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +18 -11
  94. data/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +562 -2
  95. data/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +13 -0
  96. data/frameworks/sproutcore/frameworks/desktop/views/progress.js +11 -8
  97. data/frameworks/sproutcore/frameworks/desktop/views/radio.js +7 -7
  98. data/frameworks/sproutcore/frameworks/desktop/views/scroll.js +99 -33
  99. data/frameworks/sproutcore/frameworks/desktop/views/scroller.js +3 -7
  100. data/frameworks/sproutcore/frameworks/desktop/views/segmented.js +0 -7
  101. data/frameworks/sproutcore/frameworks/desktop/views/separator.js +2 -3
  102. data/frameworks/sproutcore/frameworks/desktop/views/slider.js +0 -8
  103. data/frameworks/sproutcore/frameworks/desktop/views/source_list_group.js +1 -1
  104. data/frameworks/sproutcore/frameworks/desktop/views/split.js +27 -7
  105. data/frameworks/sproutcore/frameworks/desktop/views/tab.js +2 -6
  106. data/frameworks/sproutcore/frameworks/foundation/controllers/array.js +15 -10
  107. data/frameworks/sproutcore/frameworks/foundation/controllers/tree.js +20 -1
  108. data/frameworks/sproutcore/frameworks/foundation/debug/control_test_pane.js +1 -1
  109. data/frameworks/sproutcore/frameworks/foundation/english.lproj/bootstrap.rhtml +3 -6
  110. data/frameworks/sproutcore/frameworks/foundation/english.lproj/button_view.css +3 -0
  111. data/frameworks/sproutcore/frameworks/foundation/english.lproj/core.css +8 -0
  112. data/frameworks/sproutcore/frameworks/foundation/english.lproj/inline_editor.css +12 -0
  113. data/frameworks/sproutcore/frameworks/foundation/english.lproj/label.css +11 -0
  114. data/frameworks/sproutcore/frameworks/foundation/english.lproj/text_field.css +13 -0
  115. data/frameworks/sproutcore/frameworks/foundation/mixins/button.js +1 -2
  116. data/frameworks/sproutcore/frameworks/foundation/mixins/inline_text_field.js +70 -21
  117. data/frameworks/sproutcore/frameworks/foundation/mixins/selection_support.js +88 -54
  118. data/frameworks/sproutcore/frameworks/foundation/mixins/static_layout.js +0 -25
  119. data/frameworks/sproutcore/frameworks/foundation/mixins/string.js +23 -2
  120. data/frameworks/sproutcore/frameworks/foundation/panes/pane.js +34 -23
  121. data/frameworks/sproutcore/frameworks/foundation/private/tree_item_observer.js +20 -0
  122. data/frameworks/sproutcore/frameworks/foundation/system/benchmark.js +32 -23
  123. data/frameworks/sproutcore/frameworks/foundation/system/browser.js +2 -2
  124. data/frameworks/sproutcore/frameworks/foundation/system/bundle.js +77 -15
  125. data/frameworks/sproutcore/frameworks/foundation/system/core_query.js +5 -4
  126. data/frameworks/sproutcore/frameworks/foundation/system/cursor.js +1 -1
  127. data/frameworks/sproutcore/frameworks/foundation/system/render_context.js +22 -7
  128. data/frameworks/sproutcore/frameworks/foundation/system/request.js +466 -309
  129. data/frameworks/sproutcore/frameworks/foundation/system/responder.js +2 -1
  130. data/frameworks/sproutcore/frameworks/foundation/system/response.js +457 -0
  131. data/frameworks/sproutcore/frameworks/foundation/system/root_responder.js +66 -15
  132. data/frameworks/sproutcore/frameworks/foundation/system/routes.js +4 -4
  133. data/frameworks/sproutcore/frameworks/foundation/system/timer.js +6 -4
  134. data/frameworks/sproutcore/frameworks/foundation/system/utils.js +46 -8
  135. data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/array_case.js +17 -0
  136. data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/enum_case.js +18 -5
  137. data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/null_case.js +1 -1
  138. data/frameworks/sproutcore/frameworks/foundation/tests/mixins/staticLayout.js +0 -2
  139. data/frameworks/sproutcore/frameworks/foundation/tests/mixins/string.js +11 -0
  140. data/frameworks/sproutcore/frameworks/foundation/tests/private/tree_item_observer/group_case.js +14 -14
  141. data/frameworks/sproutcore/frameworks/foundation/tests/system/builder.js +2 -2
  142. data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/jquery_core.js +15 -3
  143. data/frameworks/sproutcore/frameworks/foundation/tests/system/datetime.js +1 -1
  144. data/frameworks/sproutcore/frameworks/foundation/tests/system/locale.js +8 -7
  145. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/tag.js +3 -2
  146. data/frameworks/sproutcore/frameworks/foundation/tests/system/request.js +51 -44
  147. data/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/targetForAction.js +2 -2
  148. data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/isPaused.js +4 -4
  149. data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/performAction.js +2 -0
  150. data/frameworks/sproutcore/frameworks/foundation/tests/validators/credit_card.js +9 -9
  151. data/frameworks/sproutcore/frameworks/foundation/tests/validators/number.js +2 -2
  152. data/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +3 -3
  153. data/frameworks/sproutcore/frameworks/foundation/tests/views/image/ui.js +10 -3
  154. data/frameworks/sproutcore/frameworks/foundation/tests/views/label/ui.js +2 -2
  155. data/frameworks/sproutcore/frameworks/foundation/tests/views/pane/append_remove.js +14 -0
  156. data/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/methods.js +5 -5
  157. data/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +1 -11
  158. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/clippingFrame.js +2 -2
  159. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/destroyLayer.js +2 -4
  160. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/findLayerInParentLayer.js +2 -4
  161. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/insertBefore.js +1 -1
  162. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/layoutStyle.js +0 -2
  163. data/frameworks/sproutcore/frameworks/foundation/validators/password.js +5 -5
  164. data/frameworks/sproutcore/frameworks/foundation/validators/validator.js +4 -2
  165. data/frameworks/sproutcore/frameworks/foundation/views/field.js +5 -8
  166. data/frameworks/sproutcore/frameworks/foundation/views/label.js +21 -5
  167. data/frameworks/sproutcore/frameworks/foundation/views/text_field.js +112 -69
  168. data/frameworks/sproutcore/frameworks/foundation/views/view.js +67 -6
  169. data/frameworks/sproutcore/frameworks/runtime/core.js +51 -2
  170. data/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +4 -1
  171. data/frameworks/sproutcore/frameworks/runtime/system/binding.js +2 -1
  172. data/frameworks/sproutcore/frameworks/runtime/system/enumerator.js +5 -4
  173. data/frameworks/sproutcore/frameworks/runtime/system/index_set.js +6 -1
  174. data/frameworks/sproutcore/frameworks/runtime/system/logger.js +408 -0
  175. data/frameworks/sproutcore/frameworks/runtime/system/object.js +15 -4
  176. data/frameworks/sproutcore/frameworks/runtime/system/selection_set.js +30 -2
  177. data/frameworks/sproutcore/frameworks/runtime/tests/core/IsEqual.js +5 -1
  178. data/frameworks/sproutcore/frameworks/runtime/tests/core/beget.js +1 -1
  179. data/frameworks/sproutcore/frameworks/runtime/tests/core/compare.js +3 -3
  180. data/frameworks/sproutcore/frameworks/runtime/tests/core/guidFor.js +2 -0
  181. data/frameworks/sproutcore/frameworks/runtime/tests/core/isArray.js +1 -1
  182. data/frameworks/sproutcore/frameworks/runtime/tests/core/itemType.js +2 -1
  183. data/frameworks/sproutcore/frameworks/runtime/tests/core/tupleForPropertyPath.js +2 -2
  184. data/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/propertyChanges.js +1 -1
  185. data/frameworks/sproutcore/frameworks/runtime/tests/mixins/propertyChanges.js +1 -0
  186. data/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +11 -7
  187. data/frameworks/sproutcore/frameworks/runtime/tests/system/error.js +3 -2
  188. data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/add.js +18 -1
  189. data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/remove.js +1 -1
  190. data/frameworks/sproutcore/frameworks/runtime/tests/system/logger.js +165 -0
  191. data/frameworks/sproutcore/frameworks/runtime/tests/system/object/bindings.js +3 -0
  192. data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/copy.js +1 -1
  193. data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/indexSetForSource.js +13 -0
  194. data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/remove.js +24 -0
  195. data/frameworks/sproutcore/frameworks/runtime/tests/system/sparse_array.js +32 -13
  196. data/frameworks/sproutcore/frameworks/testing/english.lproj/runner.css +2 -2
  197. data/frameworks/sproutcore/frameworks/testing/english.lproj/testsuite.css +7 -2
  198. data/frameworks/sproutcore/lib/index.rhtml +6 -20
  199. data/frameworks/sproutcore/themes/standard_theme/Source/sc-theme-repeat-x.psd +0 -0
  200. data/frameworks/sproutcore/themes/standard_theme/english.lproj/button.css +0 -1
  201. data/frameworks/sproutcore/themes/standard_theme/english.lproj/checkbox.css +5 -4
  202. data/frameworks/sproutcore/themes/standard_theme/english.lproj/collection.css +4 -3
  203. data/frameworks/sproutcore/themes/standard_theme/english.lproj/disclosure.css +7 -7
  204. data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-repeat-x.png +0 -0
  205. data/frameworks/sproutcore/themes/standard_theme/english.lproj/list_item.css +38 -0
  206. data/frameworks/sproutcore/themes/standard_theme/english.lproj/menu.css +20 -0
  207. data/frameworks/sproutcore/themes/standard_theme/english.lproj/progress.css +1 -0
  208. data/frameworks/sproutcore/themes/standard_theme/english.lproj/radio.css +3 -1
  209. data/frameworks/sproutcore/themes/standard_theme/english.lproj/segmented.css +1 -0
  210. data/frameworks/sproutcore/themes/standard_theme/english.lproj/split_view.css +1 -1
  211. data/frameworks/sproutcore/themes/standard_theme/english.lproj/text_field.css +0 -15
  212. data/gen/data-source/Buildfile +18 -0
  213. data/gen/data-source/README +1 -0
  214. data/gen/data-source/USAGE +15 -0
  215. data/gen/data-source/templates/data_sources/@filename@.js +64 -0
  216. data/lib/sproutcore/builders/combine.rb +23 -0
  217. data/lib/sproutcore/builders/javascript.rb +27 -2
  218. data/lib/sproutcore/buildfile/task.rb +1 -1
  219. data/lib/sproutcore/helpers/entry_sorter.rb +2 -2
  220. data/lib/sproutcore/helpers/static_helper.rb +79 -0
  221. data/lib/sproutcore/models/manifest.rb +2 -2
  222. data/lib/sproutcore/models/target.rb +1 -1
  223. data/lib/sproutcore/tools/build.rb +1 -1
  224. data/lib/sproutcore/tools/docs.rb +3 -3
  225. data/lib/sproutcore/tools/gen.rb +17 -15
  226. data/lib/sproutcore/tools/manifest.rb +9 -9
  227. data/lib/sproutcore/tools/server.rb +3 -3
  228. data/lib/sproutcore/tools.rb +259 -250
  229. data/lib/sproutcore.rb +9 -1
  230. data/spec/buildtasks/manifest/prepare_build_tasks/combine_spec.rb +2 -2
  231. data/spec/fixtures/entry_for_project/frameworks/unrelated/PLACEHOLDER +0 -0
  232. data/spec/fixtures/ordered_entries/apps/no_requires/{lproj → english.lproj}/strings.js +0 -0
  233. data/spec/fixtures/ordered_entries/apps/no_requires/main.js +1 -0
  234. data/spec/fixtures/ordered_entries/apps/no_requires/resources/main_page.js +1 -0
  235. data/spec/fixtures/ordered_entries/apps/no_requires/t.js +1 -0
  236. data/spec/lib/models/manifest/find_entry.rb +12 -0
  237. data/spec/lib/tools/gen_spec.rb +1 -0
  238. data/spec/lib/tools/tools_spec.rb +1 -0
  239. data/sproutcore-abbot.gemspec +36 -44
  240. metadata +43 -44
  241. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/indicator.gif +0 -0
  242. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/sc-theme-sprite.png +0 -0
  243. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/sticky-note.png +0 -0
  244. data/frameworks/sproutcore/frameworks/desktop/views/form.js +0 -594
  245. data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-sprite.png +0 -0
  246. data/lib/thor/CHANGELOG.rdoc +0 -52
  247. data/lib/thor/LICENSE +0 -20
  248. data/lib/thor/README.markdown +0 -76
  249. data/lib/thor/Rakefile +0 -6
  250. data/lib/thor/Thorfile +0 -45
  251. data/lib/thor/bin/rake2thor +0 -83
  252. data/lib/thor/bin/thor +0 -7
  253. data/lib/thor/lib/thor/error.rb +0 -3
  254. data/lib/thor/lib/thor/options.rb +0 -267
  255. data/lib/thor/lib/thor/ordered_hash.rb +0 -64
  256. data/lib/thor/lib/thor/runner.rb +0 -305
  257. data/lib/thor/lib/thor/task.rb +0 -83
  258. data/lib/thor/lib/thor/task_hash.rb +0 -22
  259. data/lib/thor/lib/thor/tasks/package.rb +0 -18
  260. data/lib/thor/lib/thor/tasks.rb +0 -77
  261. data/lib/thor/lib/thor/util.rb +0 -75
  262. data/lib/thor/lib/thor.rb +0 -170
  263. data/lib/thor/script/destroy +0 -14
  264. data/lib/thor/script/generate +0 -14
  265. data/lib/thor/spec/fixtures/task.thor +0 -10
  266. data/lib/thor/spec/options_spec.rb +0 -271
  267. data/lib/thor/spec/ordered_hash_spec.rb +0 -84
  268. data/lib/thor/spec/spec.opts +0 -1
  269. data/lib/thor/spec/spec_helper.rb +0 -30
  270. data/lib/thor/spec/task_spec.rb +0 -11
  271. data/lib/thor/spec/tasks_spec.rb +0 -28
  272. data/lib/thor/spec/thor_runner_spec.rb +0 -194
  273. data/lib/thor/spec/thor_spec.rb +0 -206
  274. data/lib/thor/spec/util_spec.rb +0 -99
  275. data/lib/thor/task.thor +0 -15
  276. data/lib/thor/thor.gemspec +0 -29
@@ -5,7 +5,7 @@
5
5
  // License: Licened under MIT license (see license.js)
6
6
  // ==========================================================================
7
7
 
8
- /*global module test htmlbody ok equals same stop start */
8
+ /*global module test htmlbody ok equals same stop start Q$*/
9
9
 
10
10
  var pane, view , view1, view2, view3;
11
11
  module("SC.SelectFieldView",{
@@ -8,7 +8,7 @@
8
8
  /*global module test htmlbody ok equals same stop start */
9
9
 
10
10
  var iconURL= "http://www.freeiconsweb.com/Icons/16x16_people_icons/People_046.gif";
11
-
11
+ var pane, view;
12
12
  module("SC.TabView", {
13
13
  setup: function() {
14
14
  SC.RunLoop.begin();
@@ -230,13 +230,15 @@ SC.ButtonView = SC.View.extend(SC.Control, SC.Button, SC.StaticLayout,
230
230
  if (!this.get('isEnabled')) return YES ; // handled event, but do nothing
231
231
  this.set('isActive', YES);
232
232
  this._isMouseDown = YES;
233
- if (!this._isFocused) {
233
+
234
+ if (!this._isFocused && (this.get('buttonBehavior')!==SC.PUSH_BEHAVIOR)) {
234
235
  this._isFocused = YES ;
235
236
  this.becomeFirstResponder();
236
237
  if (this.get('isVisibleInWindow')) {
237
238
  this.$()[0].focus();
238
239
  }
239
240
  }
241
+
240
242
  return YES ;
241
243
  },
242
244
 
@@ -353,8 +355,8 @@ SC.ButtonView = SC.View.extend(SC.Control, SC.Button, SC.StaticLayout,
353
355
 
354
356
  /** tied to the isEnabled state */
355
357
  acceptsFirstResponder: function() {
356
- return this.get('isEnabled');
357
- }.property('isEnabled'),
358
+ return this.get('isEnabled');
359
+ }.property('isEnabled'),
358
360
 
359
361
  willBecomeKeyResponderFrom: function(keyView) {
360
362
  // focus the text field.
@@ -119,8 +119,9 @@ SC.CheckboxView = SC.FieldView.extend(SC.StaticLayout, SC.Button,
119
119
  },
120
120
 
121
121
  mouseDown: function(evt) {
122
- this.$input()[0].focus();
123
- sc_super();
124
- },
122
+ this.set('isActive', YES);
123
+ this._field_isMouseDown = YES;
124
+ return YES;
125
+ }
125
126
 
126
127
  }) ;
@@ -107,8 +107,7 @@ SC.CollectionView = SC.View.extend(
107
107
  @type {SC.IndexSet}
108
108
  */
109
109
  nowShowing: function() {
110
- var ret = this.computeNowShowing();
111
- return ret ? ret.frozenCopy() : null;
110
+ return this.computeNowShowing();
112
111
  }.property('length', 'clippingFrame').cacheable(),
113
112
 
114
113
  /**
@@ -385,6 +384,30 @@ SC.CollectionView = SC.View.extend(
385
384
  */
386
385
  isActive: NO,
387
386
 
387
+
388
+ /**
389
+ This property is used to store the calculated height to have
390
+ a consistent scrolling behavior due to the issues generated by using top
391
+ instead of scrollTop. We could look at the min-height set in the view, but
392
+ to avoid perf hits we simply store it and the scrollView will use it if
393
+ different than 0.
394
+
395
+ @type Number
396
+ */
397
+ calculatedHeight: 0,
398
+
399
+ /**
400
+ This property is used to store the calculated width to have
401
+ a consistent scrolling behavior due to the issues generated by using left
402
+ instead of scrollLeft. We could look at the min-width set in the view, but
403
+ to avoid perf hits we simply store it and the scrollView will use it if
404
+ different than 0.
405
+
406
+ @type Number
407
+ */
408
+ calculatedWidth: 0,
409
+
410
+
388
411
  // ..........................................................
389
412
  // SUBCLASS METHODS
390
413
  //
@@ -415,6 +438,18 @@ SC.CollectionView = SC.View.extend(
415
438
  return null ;
416
439
  },
417
440
 
441
+ /**
442
+ This computed property returns an index set selecting all content indexes.
443
+ It will recompute anytime the length of the collection view changes.
444
+
445
+ This is used by the default contentIndexesInRect() implementation.
446
+
447
+ @property {SC.Range}
448
+ */
449
+ allContentIndexes: function() {
450
+ return SC.IndexSet.create(0, this.get('length')).freeze();
451
+ }.property('length').cacheable(),
452
+
418
453
  /**
419
454
  Override to return an IndexSet with the indexes that are at least
420
455
  partially visible in the passed rectangle. This method is used by the
@@ -429,7 +464,7 @@ SC.CollectionView = SC.View.extend(
429
464
  @returns {SC.IndexSet} now showing indexes
430
465
  */
431
466
  contentIndexesInRect: function(rect) {
432
- return SC.IndexSet.create(0, this.get('length'));
467
+ return null; // select all
433
468
  },
434
469
 
435
470
  /**
@@ -442,16 +477,16 @@ SC.CollectionView = SC.View.extend(
442
477
  @returns {SC.IndexSet} new now showing range
443
478
  */
444
479
  computeNowShowing: function() {
445
- var r = this.contentIndexesInRect(this.get('clippingFrame')),
446
- content = SC.makeArray(this.get('content')),
447
- len = content.get('length');
448
-
449
- // default show all.
450
- if (!r) r = SC.IndexSet.create(0, len);
480
+ var r = this.contentIndexesInRect(this.get('clippingFrame'));
481
+ if (!r) r = this.get('allContentIndexes'); // default show all
451
482
 
452
483
  // make sure the index set doesn't contain any indexes greater than the
453
484
  // actual content.
454
- if (r.get('max') > len) r.remove(len, r.get('max')-len);
485
+ else {
486
+ var len = this.get('length'),
487
+ max = r.get('max');
488
+ if (max > len) r = r.copy().remove(len, max-len).freeze();
489
+ }
455
490
 
456
491
  return r ;
457
492
  },
@@ -811,6 +846,15 @@ SC.CollectionView = SC.View.extend(
811
846
  // if not nowShowing, then remove the item view if needed
812
847
  } else if (existing && existing.parentView === containerView) {
813
848
  delete itemViews[idx];
849
+
850
+ // if the existing view has a layer, remove it immediately from
851
+ // the parent...
852
+ layer = existing.get('layer');
853
+ if (layer && layer.parentNode) {
854
+ layer.parentNode.removeChild(layer);
855
+ }
856
+ layer = null ; // avoid leaks
857
+
814
858
  containerView.removeChild(existing);
815
859
  }
816
860
  },this);
@@ -958,6 +1002,15 @@ SC.CollectionView = SC.View.extend(
958
1002
  return ret ;
959
1003
  },
960
1004
 
1005
+ /**
1006
+ Helper method for getting the item view of a specific content object
1007
+
1008
+ @param {Object} object
1009
+ */
1010
+ itemViewForContentObject: function(object) {
1011
+ return this.itemViewForContentIndex(this.get('content').indexOf(object));
1012
+ },
1013
+
961
1014
  _TMP_LAYERID: [],
962
1015
 
963
1016
  /**
@@ -1268,7 +1321,17 @@ SC.CollectionView = SC.View.extend(
1268
1321
  // build the selection object, merging if needed
1269
1322
  if (extend && (sel = this.get('selection'))) sel = sel.copy();
1270
1323
  else sel = SC.SelectionSet.create();
1271
- if (indexes) sel.add(content, indexes);
1324
+
1325
+ if (indexes && indexes.get('length')>0) {
1326
+
1327
+ // when selecting only one item, always select by content
1328
+ if (indexes.get('length')===1) {
1329
+ sel.addObject(content.objectAt(indexes.get('firstObject')));
1330
+
1331
+ // otherwise select an index range
1332
+ } else sel.add(content, indexes);
1333
+
1334
+ }
1272
1335
 
1273
1336
  // give delegate one last chance
1274
1337
  sel = del.collectionViewSelectionForProposedSelection(this, sel);
@@ -1560,12 +1623,6 @@ SC.CollectionView = SC.View.extend(
1560
1623
  // delegate implementation just uses standard SC.Array methods to do the
1561
1624
  // right thing.
1562
1625
  del.collectionViewDeleteContent(this, this.get('content'), indexes);
1563
-
1564
- // also, fix up the selection by removing the actual items we removed
1565
- // set selection directly instead of calling select() since we are just
1566
- // fixing up the selection.
1567
-
1568
- this.selectPreviousItem(false, 1) ;
1569
1626
 
1570
1627
  return YES ;
1571
1628
  },
@@ -1594,17 +1651,7 @@ SC.CollectionView = SC.View.extend(
1594
1651
  @returns {SC.CollectionView} receiver
1595
1652
  */
1596
1653
  scrollToItemView: function(view) {
1597
- if (!view.get('parentView')) return this; // nothing to do
1598
- if (!view.get('layer')) {
1599
- if (this.get('layer')) view.updateLayerLocation();
1600
- else return this; // nothing to do
1601
- }
1602
-
1603
- var scrollable = this;
1604
- while (scrollable && !scrollable.isPane) {
1605
- if (scrollable.get('isScrollable')) scrollable.scrollToVisible(view);
1606
- scrollable = scrollable.get('parentView');
1607
- }
1654
+ if (view) view.scrollToVisible();
1608
1655
  return this ;
1609
1656
  },
1610
1657
 
@@ -1621,6 +1668,19 @@ SC.CollectionView = SC.View.extend(
1621
1668
  /** @private */
1622
1669
  keyUp: function() { return true; },
1623
1670
 
1671
+ /** @private
1672
+ Handle space key event. Do action
1673
+ */
1674
+ insertText: function(chr, evt) {
1675
+ if (chr === ' ') {
1676
+ var sel = this.get('selection');
1677
+ if (sel && sel.get('length')>0) {
1678
+ this.invokeLater(this._cv_action, 0, null, evt);
1679
+ }
1680
+ return YES ;
1681
+ } else return NO ;
1682
+ },
1683
+
1624
1684
  /** @private
1625
1685
  Handle select all keyboard event.
1626
1686
  */
@@ -2132,6 +2192,8 @@ SC.CollectionView = SC.View.extend(
2132
2192
  content = this.get('content'),
2133
2193
  sel = this.get('selection'),
2134
2194
  info = this.mouseDownInfo,
2195
+ cdel = this.get('contentDelegate'),
2196
+ groupIndexes = cdel.contentGroupIndexes(this, content),
2135
2197
  dragContent, dragDataTypes, dragView;
2136
2198
 
2137
2199
  // if the mouse down event was cleared, there is nothing to do; return.
@@ -2154,7 +2216,16 @@ SC.CollectionView = SC.View.extend(
2154
2216
  if (!this.get("selectOnMouseDown")) {
2155
2217
  dragContent = SC.IndexSet.create(info.contentIndex);
2156
2218
  } else dragContent = sel ? sel.indexSetForSource(content) : null;
2219
+
2220
+ // remove any group indexes. groups cannot be dragged.
2221
+ if (dragContent && groupIndexes && groupIndexes.get('length')>0) {
2222
+ dragContent = dragContent.copy().remove(groupIndexes);
2223
+ if (dragContent.get('length')===0) dragContent = null;
2224
+ else dragContent.freeze();
2225
+ }
2226
+
2157
2227
  if (!dragContent) return YES; // nothing to drag
2228
+ else dragContent = dragContent.frozenCopy(); // so it doesn't change
2158
2229
 
2159
2230
  dragContent = { content: content, indexes: dragContent };
2160
2231
  this.set('dragContent', dragContent) ;
@@ -2334,7 +2405,7 @@ SC.CollectionView = SC.View.extend(
2334
2405
  dropOp = SC.DROP_BEFORE,
2335
2406
  del = this.get('selectionDelegate'),
2336
2407
  canReorder = this.get('canReorderContent'),
2337
- objects, content, isPreviousInDrag, isNextInDrag, len;
2408
+ objects, content, isPreviousInDrag, isNextInDrag, len, tmp;
2338
2409
 
2339
2410
  // STEP 1: Try with a DROP_ON option -- send straight to delegate if
2340
2411
  // supported by view.
@@ -2357,13 +2428,13 @@ SC.CollectionView = SC.View.extend(
2357
2428
  // the collection delegate.
2358
2429
  this.set('proposedInsertionIndex', idx) ;
2359
2430
  this.set('proposedDropOperation', dropOp) ;
2360
- dragOp = del.collectionViewValidateDragOperation(this, drag, dragOp, idx, dropOp) ;
2431
+ tmp = del.collectionViewValidateDragOperation(this, drag, dragOp, idx, dropOp) ;
2361
2432
  idx = this.get('proposedInsertionIndex') ;
2362
2433
  dropOp = this.get('proposedDropOperation') ;
2363
2434
  this._dropInsertionIndex = this._dropOperation = null ;
2364
2435
 
2365
2436
  // The delegate is OK with a drop on also, so just return.
2366
- if (dragOp !== SC.DRAG_NONE) return [idx, dropOp, dragOp] ;
2437
+ if (tmp !== SC.DRAG_NONE) return [idx, dropOp, tmp] ;
2367
2438
 
2368
2439
  // The delegate is NOT OK with a drop on, try to get the insertion
2369
2440
  // index again, but this time prefer SC.DROP_BEFORE, then let the
@@ -2416,7 +2487,7 @@ SC.CollectionView = SC.View.extend(
2416
2487
  if (idx >= 0) dragOp = SC.DRAG_REORDER ;
2417
2488
  }
2418
2489
  }
2419
-
2490
+
2420
2491
  // Now save the insertion index and the dropOp. This may be changed by
2421
2492
  // the collection delegate.
2422
2493
  this.set('proposedInsertionIndex', idx) ;
@@ -2482,11 +2553,12 @@ SC.CollectionView = SC.View.extend(
2482
2553
  reordering content.
2483
2554
  */
2484
2555
  performDragOperation: function(drag, op) {
2556
+
2485
2557
  // Get the correct insertion point, drop operation, etc.
2486
2558
  var state = this._computeDropOperationState(drag, null, op),
2487
2559
  idx = state[0], dropOp = state[1], dragOp = state[2],
2488
2560
  del = this.get('selectionDelegate'),
2489
- performed, objects, data, content, shift;
2561
+ performed, objects, data, content, shift, indexes;
2490
2562
 
2491
2563
  // The dragOp is the kinds of ops allowed. The drag operation must
2492
2564
  // be included in that set.
@@ -2509,6 +2581,16 @@ SC.CollectionView = SC.View.extend(
2509
2581
  if (!data) return SC.DRAG_NONE ;
2510
2582
 
2511
2583
  content = this.get('content') ;
2584
+
2585
+ // check for special case - inserting BEFORE ourself...
2586
+ // in this case just pretend the move happened since it's a no-op
2587
+ // anyway
2588
+ indexes = data.indexes;
2589
+ if (indexes.get('length')===1) {
2590
+ if (((dropOp === SC.DROP_BEFORE) || (dropOp === SC.DROP_AFTER)) &&
2591
+ (indexes.get('min')===idx)) return SC.DRAG_MOVE;
2592
+ }
2593
+
2512
2594
  content.beginPropertyChanges(); // suspend notifications
2513
2595
 
2514
2596
  // get each object, then remove it from the content. they will be
@@ -2520,11 +2602,11 @@ SC.CollectionView = SC.View.extend(
2520
2602
  content.removeAt(i-shift);
2521
2603
  shift++;
2522
2604
  if (i < idx) idx--;
2523
- if ((dropOp === SC.DROP_AFTER) && (i === idx)) idx--;
2524
2605
  }, this);
2525
2606
 
2526
2607
  // now insert objects into new insertion locaiton
2527
- content.replace(idx, 0, objects);
2608
+ if (dropOp === SC.DROP_AFTER) idx++;
2609
+ content.replace(idx, 0, objects, dropOp);
2528
2610
  this.select(SC.IndexSet.create(idx, objects.length));
2529
2611
  content.endPropertyChanges(); // restart notifications
2530
2612
 
@@ -2579,62 +2661,7 @@ SC.CollectionView = SC.View.extend(
2579
2661
  @returns {Array} [proposed drop index, drop operation]
2580
2662
  */
2581
2663
  insertionIndexForLocation: function(loc, dropOperation) {
2582
- var ret = 0 ;
2583
-
2584
- // var content = this.get('content'),
2585
- // nowShowing = this.get('nowShowing'),
2586
- // orient = this.get('insertionOrientation'),
2587
- // lastSide = null,
2588
- // ret = null,
2589
- // itemView, curSide, f;
2590
- //
2591
- // for(var idx=0; ((ret === null) && (idx<content.length)); idx++) {
2592
- // // itemView = this.itemViewForContent(content.objectAt(idx));
2593
- // itemView = this.itemViewForContentIndex(idx);
2594
- // f = this.convertFrameFromView(itemView.get('frame'), itemView) ;
2595
- //
2596
- // // if we are a horizontal orientation, look for the first item that
2597
- // // will "switch sides" on the x path an the maxY is greater than Y.
2598
- // // This assumes you will flow top to bottom, but it should work if you
2599
- // // flow LTR or RTL.
2600
- // if (orient == SC.HORIZONTAL_ORIENTATION) {
2601
- // if (SC.maxY(f) > loc.y) {
2602
- // curSide = (SC.maxX(f) < loc.x) ? -1 : 1 ;
2603
- // } else curSide = null ;
2604
- //
2605
- // // if we are a vertical orientation, look for the first item that
2606
- // // will "switch sides" on the y path and the maxX is greater than X.
2607
- // // This assumes you will flow LTR, but it should work if you flow
2608
- // // bottom to top or top to bottom.
2609
- // } else {
2610
- // if (SC.minX(f) < loc.x) {
2611
- // curSide = (SC.maxY(f) < loc.y) ? -1 : 1 ;
2612
- // } else curSide = null ;
2613
- // }
2614
- //
2615
- // // if we "switched" sides then return this item view.
2616
- // if (curSide !== null) {
2617
- //
2618
- // // OK, we found an item view, while we have this data, decide if
2619
- // // we should insert before or after the view
2620
- // if ((lastSide !== null) && (curSide != lastSide)) {
2621
- // ret = idx ;
2622
- // if (orient == SC.HORIZONTAL_ORIENTATION) {
2623
- // if (SC.midX(f) < loc.x) ret++ ;
2624
- // } else {
2625
- // if (SC.midY(f) < loc.y) ret++ ;
2626
- // }
2627
- // }
2628
- // lastSide =curSide ;
2629
- // }
2630
- // }
2631
- //
2632
- // // Handle some edge cases
2633
- // if ((ret === null) || (ret < 0)) ret = 0 ;
2634
- // if (ret > content.length) ret = content.length ;
2635
-
2636
- // Done. Phew. Return.
2637
- return ret;
2664
+ return -1;
2638
2665
  },
2639
2666
 
2640
2667
  // ..........................................................
@@ -2678,11 +2705,13 @@ SC.CollectionView = SC.View.extend(
2678
2705
  // find the differences between the two
2679
2706
  // NOTE: reuse a TMP IndexSet object to avoid creating lots of objects
2680
2707
  // during scrolling
2681
- if (last && nowShowing && (last !== nowShowing)) {
2682
- diff1 = this._TMP_DIFF1.add(last).remove(nowShowing);
2683
- diff2 = this._TMP_DIFF2.add(nowShowing).remove(last);
2684
- diff = diff1.add(diff2);
2685
- } else diff = last || nowShowing ;
2708
+ if (last !== nowShowing) {
2709
+ if (last && nowShowing) {
2710
+ diff1 = this._TMP_DIFF1.add(last).remove(nowShowing);
2711
+ diff2 = this._TMP_DIFF2.add(nowShowing).remove(last);
2712
+ diff = diff1.add(diff2);
2713
+ } else diff = last || nowShowing ;
2714
+ }
2686
2715
 
2687
2716
  // if nowShowing has actually changed, then update
2688
2717
  if (diff && diff.get('length') > 0) {
@@ -104,6 +104,7 @@ SC.GridView = SC.ListView.extend(
104
104
 
105
105
  // set minHeight
106
106
  ret.minHeight = rows * rowHeight ;
107
+ this.calculatedHeight = ret.minHeight;
107
108
  return ret;
108
109
  },
109
110
 
@@ -290,6 +290,7 @@ SC.ListView = SC.CollectionView.extend(
290
290
  var ret = this._sclv_layout;
291
291
  if (!ret) ret = this._sclv_layout = {};
292
292
  ret.minHeight = this.rowOffsetForContentIndex(this.get('length'))+4;
293
+ this.calculatedHeight = ret.minHeight;
293
294
  return ret ;
294
295
  },
295
296
 
@@ -373,11 +374,11 @@ SC.ListView = SC.CollectionView.extend(
373
374
 
374
375
  // if height is greater than 0, on some platforms we should just render
375
376
  // to specific windows in order to minimize render time.
376
- if (height > 0 && !SC.browser.msie) {
377
- start = start - (start % 50);
378
- if (start < 0) start = 0 ;
379
- end = end - (end % 50) + 50;
380
- }
377
+ // if (height > 0 && !SC.browser.msie) {
378
+ // start = start - (start % 50);
379
+ // if (start < 0) start = 0 ;
380
+ // end = end - (end % 50) + 50;
381
+ // }
381
382
 
382
383
  if (end<start) end = start;
383
384
  if (end>len) end = len ;
@@ -419,9 +420,24 @@ SC.ListView = SC.CollectionView.extend(
419
420
  = this.get('insertionPointView').create();
420
421
  }
421
422
 
422
- var layout = SC.clone(itemView.get('layout')),
423
+ var index = itemView.get('contentIndex'),
424
+ len = this.get('length'),
425
+ layout = SC.clone(itemView.get('layout')),
423
426
  level = itemView.get('outlineLevel'),
424
- indent = itemView.get('outlineIndent') || 0;
427
+ indent = itemView.get('outlineIndent') || 0,
428
+ group;
429
+
430
+ // show item indented if we are inserting at the end and the last item
431
+ // is a group item. This is a special case that should really be
432
+ // converted into a more general protocol.
433
+ if ((index >= len) && index>0) {
434
+ group = this.itemViewForContentIndex(len-1);
435
+ if (group.get('isGroupView')) {
436
+ level = 1;
437
+ indent = group.get('outlineIndent');
438
+ }
439
+ }
440
+
425
441
  if (SC.none(level)) level = -1;
426
442
 
427
443
  if (dropOperation & SC.DROP_ON) {
@@ -477,7 +493,7 @@ SC.ListView = SC.CollectionView.extend(
477
493
  var indexes = this.contentIndexesInRect(loc),
478
494
  index = indexes.get('min'),
479
495
  len = this.get('length'),
480
- min, max, diff, clevel, cindent, plevel, pindent, itemView;
496
+ min, max, diff, clevel, cindent, plevel, pindent, itemView, pgroup;
481
497
 
482
498
  // if there are no indexes in the rect, then we need to either insert
483
499
  // before the top item or after the last item. Figure that out by
@@ -504,7 +520,7 @@ SC.ListView = SC.CollectionView.extend(
504
520
  }
505
521
  }
506
522
 
507
- dropOperation = SC.DROP_BEFORE;
523
+
508
524
 
509
525
  // ok, now if we are in last 10px, go to next item.
510
526
  if ((index<len) && (loc.y >= max-10)) index++;
@@ -512,28 +528,62 @@ SC.ListView = SC.CollectionView.extend(
512
528
  // finally, let's decide if we want to actually insert before/after. Only
513
529
  // matters if we are using outlining.
514
530
  if (index>0) {
515
- itemView = this.itemViewForContentIndex(index);
516
- clevel = itemView ? itemView.get('outlineLevel') : 0;
517
- cindent = (itemView ? itemView.get('outlineIndent') : 0) || 0;
518
- cindent *= clevel;
519
-
520
- itemView = this.itemViewForContentIndex(index);
531
+
532
+ itemView = this.itemViewForContentIndex(index-1);
521
533
  pindent = (itemView ? itemView.get('outlineIndent') : 0) || 0;
522
534
  plevel = itemView ? itemView.get('outlineLevel') : 0;
535
+
536
+ if (index<len) {
537
+ itemView = this.itemViewForContentIndex(index);
538
+ clevel = itemView ? itemView.get('outlineLevel') : 0;
539
+ cindent = (itemView ? itemView.get('outlineIndent') : 0) || 0;
540
+ cindent *= clevel;
541
+ } else {
542
+ clevel = itemView.get('isGroupView') ? 1 : 0; // special case...
543
+ cindent = pindent * clevel;
544
+ }
545
+
523
546
  pindent *= plevel;
524
547
 
525
548
  // if indent levels are different, then try to figure out which level
526
549
  // it should be on.
527
550
  if ((clevel !== plevel) && (cindent !== pindent)) {
551
+
528
552
  // use most inner indent as boundary
529
- if (((pindent > cindent) && (loc.x >= pindent)) ||
530
- ((pindent < cindent) && (loc.x <= cindent))) {
531
- index-- ;
553
+ if (pindent > cindent) {
554
+ index--;
532
555
  dropOperation = SC.DROP_AFTER;
533
556
  }
534
557
  }
535
558
  }
536
559
 
560
+ // we do not support dropping before a group item. If dropping before
561
+ // a group item, always try to instead drop after the previous item. If
562
+ // the previous item is also a group then, well, dropping is just not
563
+ // allowed. Note also that dropping at 0, first item must not be group
564
+ // and dropping at length, last item must not be a group
565
+ //
566
+ if (dropOperation === SC.DROP_BEFORE) {
567
+ itemView = (index<len) ? this.itemViewForContentIndex(index) : null;
568
+ if (!itemView || itemView.get('isGroupView')) {
569
+ if (index>0) {
570
+ itemView = this.itemViewForContentIndex(index-1);
571
+
572
+ // don't allow a drop if the previous item is a group view and we're
573
+ // insert before the end. For the end, allow the drop if the
574
+ // previous item is a group view but OPEN.
575
+ if (!itemView.get('isGroupView') || (itemView.get('disclosureState') === SC.BRANCH_OPEN)) {
576
+ index = index-1;
577
+ dropOperation = SC.DROP_AFTER;
578
+ } else index = -1;
579
+
580
+ } else index = -1;
581
+ }
582
+
583
+ if (index<0) dropOperation = SC.DRAG_NONE ;
584
+ }
585
+
586
+ // return whatever we came up with
537
587
  return [index, dropOperation];
538
588
  },
539
589