activeadmin 2.6.1 → 3.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (326) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +438 -9
  3. data/CONTRIBUTING.md +12 -36
  4. data/README.md +8 -8
  5. data/app/assets/javascripts/active_admin/base.js +27 -25
  6. data/app/assets/stylesheets/active_admin/_base.scss +53 -37
  7. data/app/assets/stylesheets/active_admin/_forms.scss +2 -13
  8. data/app/assets/stylesheets/active_admin/_header.scss +37 -3
  9. data/app/assets/stylesheets/active_admin/_normalize.scss +25 -123
  10. data/app/assets/stylesheets/active_admin/components/_comments.scss +2 -2
  11. data/app/assets/stylesheets/active_admin/components/_date_picker.scss +1 -2
  12. data/app/assets/stylesheets/active_admin/components/_dropdown_menu.scss +7 -5
  13. data/app/assets/stylesheets/active_admin/components/_pagination.scss +5 -2
  14. data/app/assets/stylesheets/active_admin/components/_table_tools.scss +9 -6
  15. data/app/assets/stylesheets/active_admin/components/_tabs.scss +10 -7
  16. data/app/assets/stylesheets/active_admin/mixins/_buttons.scss +2 -2
  17. data/app/assets/stylesheets/active_admin/mixins/_variables.scss +12 -0
  18. data/app/assets/stylesheets/active_admin/pages/_logged_out.scss +1 -1
  19. data/app/assets/stylesheets/active_admin/structure/_footer.scss +6 -1
  20. data/app/assets/stylesheets/active_admin/structure/_title_bar.scss +6 -4
  21. data/app/javascript/active_admin/initializers/has-many.js +4 -1
  22. data/app/javascript/active_admin/initializers/per-page.js +1 -1
  23. data/app/javascript/active_admin/lib/checkbox-toggler.js +3 -3
  24. data/app/javascript/active_admin/lib/dropdown-menu.js +1 -1
  25. data/app/javascript/active_admin/lib/modal-dialog.js +7 -7
  26. data/app/javascript/active_admin/lib/per-page.js +1 -1
  27. data/app/javascript/active_admin/lib/table-checkbox-toggler.js +1 -1
  28. data/app/views/active_admin/devise/mailer/reset_password_instructions.html.erb +1 -1
  29. data/app/views/active_admin/devise/mailer/unlock_instructions.html.erb +2 -2
  30. data/app/views/active_admin/devise/shared/_links.erb +1 -1
  31. data/app/views/active_admin/page/index.html.arb +1 -0
  32. data/app/views/active_admin/resource/edit.html.arb +1 -0
  33. data/app/views/active_admin/resource/index.html.arb +1 -0
  34. data/app/views/active_admin/resource/new.html.arb +1 -0
  35. data/app/views/active_admin/resource/show.html.arb +1 -0
  36. data/app/views/layouts/active_admin.html.arb +1 -0
  37. data/app/views/layouts/active_admin_logged_out.html.erb +18 -7
  38. data/config/locales/ar.yml +6 -13
  39. data/config/locales/az.yml +0 -7
  40. data/config/locales/bg.yml +0 -7
  41. data/config/locales/bs.yml +0 -7
  42. data/config/locales/ca.yml +0 -7
  43. data/config/locales/cs.yml +0 -7
  44. data/config/locales/da.yml +0 -7
  45. data/config/locales/de-CH.yml +0 -7
  46. data/config/locales/de.yml +0 -8
  47. data/config/locales/el.yml +0 -7
  48. data/config/locales/en-CA.yml +0 -7
  49. data/config/locales/en-GB.yml +0 -7
  50. data/config/locales/en.yml +0 -8
  51. data/config/locales/eo.yml +0 -8
  52. data/config/locales/es-MX.yml +2 -8
  53. data/config/locales/es.yml +2 -10
  54. data/config/locales/fa.yml +0 -7
  55. data/config/locales/fi.yml +0 -7
  56. data/config/locales/fr.yml +3 -11
  57. data/config/locales/he.yml +0 -9
  58. data/config/locales/hr.yml +0 -7
  59. data/config/locales/hu.yml +0 -8
  60. data/config/locales/id.yml +0 -7
  61. data/config/locales/it.yml +18 -8
  62. data/config/locales/ja.yml +2 -10
  63. data/config/locales/ko.yml +1 -8
  64. data/config/locales/lt.yml +0 -8
  65. data/config/locales/lv.yml +0 -7
  66. data/config/locales/mk.yml +0 -8
  67. data/config/locales/nb.yml +0 -8
  68. data/config/locales/nl.yml +1 -9
  69. data/config/locales/pl.yml +0 -8
  70. data/config/locales/pt-BR.yml +0 -8
  71. data/config/locales/pt-PT.yml +0 -7
  72. data/config/locales/ro.yml +3 -9
  73. data/config/locales/ru.yml +0 -6
  74. data/config/locales/sk.yml +0 -8
  75. data/config/locales/sv-SE.yml +58 -39
  76. data/config/locales/tr.yml +0 -11
  77. data/config/locales/uk.yml +0 -6
  78. data/config/locales/vi.yml +38 -19
  79. data/config/locales/zh-CN.yml +34 -23
  80. data/config/locales/zh-TW.yml +0 -7
  81. data/lib/active_admin/abstract_view_factory.rb +1 -0
  82. data/lib/active_admin/application.rb +19 -19
  83. data/lib/active_admin/application_settings.rb +4 -3
  84. data/lib/active_admin/asset_registration.rb +4 -3
  85. data/lib/active_admin/authorization_adapter.rb +6 -3
  86. data/lib/active_admin/base_controller/authorization.rb +15 -13
  87. data/lib/active_admin/base_controller/menu.rb +1 -0
  88. data/lib/active_admin/base_controller.rb +6 -5
  89. data/lib/active_admin/batch_actions/controller.rb +4 -3
  90. data/lib/active_admin/batch_actions/resource_extension.rb +10 -8
  91. data/lib/active_admin/batch_actions/views/batch_action_form.rb +4 -3
  92. data/lib/active_admin/batch_actions/views/batch_action_selector.rb +7 -6
  93. data/lib/active_admin/batch_actions/views/selection_cells.rb +4 -3
  94. data/lib/active_admin/batch_actions.rb +1 -0
  95. data/lib/active_admin/callbacks.rb +1 -0
  96. data/lib/active_admin/cancan_adapter.rb +2 -1
  97. data/lib/active_admin/collection_decorator.rb +32 -0
  98. data/lib/active_admin/component.rb +1 -0
  99. data/lib/active_admin/controller_action.rb +1 -0
  100. data/lib/active_admin/csv_builder.rb +25 -17
  101. data/lib/active_admin/dependency.rb +12 -15
  102. data/lib/active_admin/devise.rb +16 -5
  103. data/lib/active_admin/dsl.rb +2 -1
  104. data/lib/active_admin/dynamic_setting.rb +1 -0
  105. data/lib/active_admin/dynamic_settings_node.rb +3 -2
  106. data/lib/active_admin/engine.rb +17 -9
  107. data/lib/active_admin/error.rb +1 -2
  108. data/lib/active_admin/filters/active.rb +2 -1
  109. data/lib/active_admin/filters/active_filter.rb +6 -6
  110. data/lib/active_admin/filters/active_sidebar.rb +4 -30
  111. data/lib/active_admin/filters/dsl.rb +1 -0
  112. data/lib/active_admin/filters/forms.rb +9 -8
  113. data/lib/active_admin/filters/formtastic_addons.rb +3 -7
  114. data/lib/active_admin/filters/resource_extension.rb +6 -5
  115. data/lib/active_admin/filters.rb +8 -7
  116. data/lib/active_admin/form_builder.rb +25 -20
  117. data/lib/active_admin/generators/boilerplate.rb +2 -1
  118. data/lib/active_admin/helpers/collection.rb +2 -0
  119. data/lib/active_admin/helpers/i18n.rb +1 -0
  120. data/lib/active_admin/helpers/optional_display.rb +3 -2
  121. data/lib/active_admin/helpers/routes/url_helpers.rb +1 -0
  122. data/lib/active_admin/helpers/scope_chain.rb +1 -0
  123. data/lib/active_admin/inputs/datepicker_input.rb +2 -1
  124. data/lib/active_admin/inputs/filters/base/search_method_select.rb +7 -6
  125. data/lib/active_admin/inputs/filters/base.rb +2 -1
  126. data/lib/active_admin/inputs/filters/boolean_input.rb +2 -1
  127. data/lib/active_admin/inputs/filters/check_boxes_input.rb +2 -1
  128. data/lib/active_admin/inputs/filters/date_picker_input.rb +1 -0
  129. data/lib/active_admin/inputs/filters/date_range_input.rb +3 -2
  130. data/lib/active_admin/inputs/filters/numeric_input.rb +2 -1
  131. data/lib/active_admin/inputs/filters/select_input.rb +5 -2
  132. data/lib/active_admin/inputs/filters/string_input.rb +2 -1
  133. data/lib/active_admin/inputs/filters/text_input.rb +1 -0
  134. data/lib/active_admin/inputs.rb +1 -0
  135. data/lib/active_admin/localizers/resource_localizer.rb +4 -3
  136. data/lib/active_admin/localizers.rb +2 -1
  137. data/lib/active_admin/menu.rb +8 -3
  138. data/lib/active_admin/menu_collection.rb +1 -0
  139. data/lib/active_admin/menu_item.rb +8 -7
  140. data/lib/active_admin/namespace.rb +16 -15
  141. data/lib/active_admin/namespace_settings.rb +9 -5
  142. data/lib/active_admin/order_clause.rb +2 -1
  143. data/lib/active_admin/orm/active_record/comments/comment.rb +12 -3
  144. data/lib/active_admin/orm/active_record/comments/namespace_helper.rb +1 -0
  145. data/lib/active_admin/orm/active_record/comments/resource_helper.rb +1 -0
  146. data/lib/active_admin/orm/active_record/comments/show_page_helper.rb +1 -0
  147. data/lib/active_admin/orm/active_record/comments/views/active_admin_comments.rb +21 -20
  148. data/lib/active_admin/orm/active_record/comments/views.rb +3 -2
  149. data/lib/active_admin/orm/active_record/comments.rb +28 -27
  150. data/lib/active_admin/orm/active_record.rb +2 -1
  151. data/lib/active_admin/orm/mongoid.rb +1 -0
  152. data/lib/active_admin/page.rb +2 -1
  153. data/lib/active_admin/page_controller.rb +1 -0
  154. data/lib/active_admin/page_dsl.rb +1 -0
  155. data/lib/active_admin/page_presenter.rb +1 -0
  156. data/lib/active_admin/pundit_adapter.rb +58 -16
  157. data/lib/active_admin/resource/action_items.rb +6 -5
  158. data/lib/active_admin/resource/attributes.rb +9 -1
  159. data/lib/active_admin/resource/belongs_to.rb +3 -2
  160. data/lib/active_admin/resource/controllers.rb +2 -1
  161. data/lib/active_admin/resource/includes.rb +1 -0
  162. data/lib/active_admin/resource/menu.rb +5 -4
  163. data/lib/active_admin/resource/model.rb +1 -0
  164. data/lib/active_admin/resource/naming.rb +5 -4
  165. data/lib/active_admin/resource/ordering.rb +1 -0
  166. data/lib/active_admin/resource/page_presenters.rb +1 -0
  167. data/lib/active_admin/resource/pagination.rb +1 -0
  168. data/lib/active_admin/resource/routes.rb +6 -7
  169. data/lib/active_admin/resource/scope_to.rb +8 -7
  170. data/lib/active_admin/resource/scopes.rb +1 -0
  171. data/lib/active_admin/resource/sidebars.rb +2 -1
  172. data/lib/active_admin/resource.rb +20 -19
  173. data/lib/active_admin/resource_collection.rb +1 -0
  174. data/lib/active_admin/resource_controller/action_builder.rb +1 -0
  175. data/lib/active_admin/resource_controller/data_access.rb +31 -5
  176. data/lib/active_admin/resource_controller/decorators.rb +7 -28
  177. data/lib/active_admin/resource_controller/polymorphic_routes.rb +1 -0
  178. data/lib/active_admin/resource_controller/resource_class_methods.rb +1 -0
  179. data/lib/active_admin/resource_controller/scoping.rb +1 -0
  180. data/lib/active_admin/resource_controller/sidebars.rb +1 -0
  181. data/lib/active_admin/resource_controller/streaming.rb +9 -7
  182. data/lib/active_admin/resource_controller.rb +13 -11
  183. data/lib/active_admin/resource_dsl.rb +11 -25
  184. data/lib/active_admin/router.rb +1 -0
  185. data/lib/active_admin/scope.rb +7 -6
  186. data/lib/active_admin/settings_node.rb +1 -0
  187. data/lib/active_admin/sidebar_section.rb +1 -0
  188. data/lib/active_admin/version.rb +2 -1
  189. data/lib/active_admin/view_factory.rb +18 -17
  190. data/lib/active_admin/view_helpers/active_admin_application_helper.rb +1 -0
  191. data/lib/active_admin/view_helpers/auto_link_helper.rb +2 -1
  192. data/lib/active_admin/view_helpers/breadcrumb_helper.rb +4 -3
  193. data/lib/active_admin/view_helpers/display_helper.rb +23 -8
  194. data/lib/active_admin/view_helpers/download_format_links_helper.rb +2 -1
  195. data/lib/active_admin/view_helpers/fields_for.rb +3 -2
  196. data/lib/active_admin/view_helpers/flash_helper.rb +1 -0
  197. data/lib/active_admin/view_helpers/form_helper.rb +1 -0
  198. data/lib/active_admin/view_helpers/method_or_proc_helper.rb +1 -0
  199. data/lib/active_admin/view_helpers/scope_name_helper.rb +1 -0
  200. data/lib/active_admin/view_helpers/sidebar_helper.rb +1 -0
  201. data/lib/active_admin/view_helpers/title_helper.rb +1 -0
  202. data/lib/active_admin/view_helpers/view_factory_helper.rb +1 -0
  203. data/lib/active_admin/view_helpers.rb +2 -1
  204. data/lib/active_admin/views/action_items.rb +1 -0
  205. data/lib/active_admin/views/components/active_admin_form.rb +8 -11
  206. data/lib/active_admin/views/components/active_filters_sidebar_content.rb +59 -0
  207. data/lib/active_admin/views/components/attributes_table.rb +6 -5
  208. data/lib/active_admin/views/components/blank_slate.rb +2 -1
  209. data/lib/active_admin/views/components/columns.rb +1 -0
  210. data/lib/active_admin/views/components/dropdown_menu.rb +7 -9
  211. data/lib/active_admin/views/components/index_list.rb +4 -3
  212. data/lib/active_admin/views/components/menu.rb +2 -1
  213. data/lib/active_admin/views/components/menu_item.rb +5 -4
  214. data/lib/active_admin/views/components/paginated_collection.rb +19 -18
  215. data/lib/active_admin/views/components/panel.rb +2 -1
  216. data/lib/active_admin/views/components/scopes.rb +8 -5
  217. data/lib/active_admin/views/components/sidebar.rb +1 -0
  218. data/lib/active_admin/views/components/sidebar_section.rb +1 -0
  219. data/lib/active_admin/views/components/site_title.rb +2 -1
  220. data/lib/active_admin/views/components/status_tag.rb +12 -11
  221. data/lib/active_admin/views/components/table_for.rb +18 -17
  222. data/lib/active_admin/views/components/tabs.rb +4 -3
  223. data/lib/active_admin/views/components/unsupported_browser.rb +1 -0
  224. data/lib/active_admin/views/footer.rb +3 -1
  225. data/lib/active_admin/views/header.rb +3 -2
  226. data/lib/active_admin/views/index_as_block.rb +1 -0
  227. data/lib/active_admin/views/index_as_blog.rb +2 -1
  228. data/lib/active_admin/views/index_as_grid.rb +2 -1
  229. data/lib/active_admin/views/index_as_table.rb +16 -19
  230. data/lib/active_admin/views/pages/base.rb +17 -11
  231. data/lib/active_admin/views/pages/form.rb +1 -0
  232. data/lib/active_admin/views/pages/index.rb +15 -13
  233. data/lib/active_admin/views/pages/layout.rb +1 -0
  234. data/lib/active_admin/views/pages/page.rb +1 -0
  235. data/lib/active_admin/views/pages/show.rb +2 -7
  236. data/lib/active_admin/views/tabbed_navigation.rb +3 -2
  237. data/lib/active_admin/views/title_bar.rb +2 -1
  238. data/lib/active_admin/views.rb +2 -1
  239. data/lib/active_admin.rb +63 -61
  240. data/lib/activeadmin.rb +2 -1
  241. data/lib/generators/active_admin/assets/assets_generator.rb +3 -2
  242. data/lib/generators/active_admin/assets/templates/active_admin.scss +2 -2
  243. data/lib/generators/active_admin/devise/devise_generator.rb +6 -5
  244. data/lib/generators/active_admin/install/install_generator.rb +15 -8
  245. data/lib/generators/active_admin/install/templates/active_admin.rb.erb +27 -3
  246. data/lib/generators/active_admin/install/templates/dashboard.rb +1 -0
  247. data/lib/generators/active_admin/page/page_generator.rb +2 -1
  248. data/lib/generators/active_admin/page/templates/page.rb +1 -0
  249. data/lib/generators/active_admin/resource/resource_generator.rb +4 -3
  250. data/lib/generators/active_admin/webpacker/plugins/jquery.js +7 -0
  251. data/lib/generators/active_admin/webpacker/templates/active_admin.js +5 -0
  252. data/lib/generators/active_admin/webpacker/templates/active_admin.scss +17 -0
  253. data/lib/generators/active_admin/webpacker/templates/print.scss +2 -0
  254. data/lib/generators/active_admin/webpacker/webpacker_generator.rb +27 -0
  255. data/vendor/assets/javascripts/jquery-ui/data.js +12 -8
  256. data/vendor/assets/javascripts/jquery-ui/disable-selection.js +10 -7
  257. data/vendor/assets/javascripts/jquery-ui/focusable.js +12 -9
  258. data/vendor/assets/javascripts/jquery-ui/form-reset-mixin.js +60 -57
  259. data/vendor/assets/javascripts/jquery-ui/form.js +15 -12
  260. data/vendor/assets/javascripts/jquery-ui/ie.js +5 -2
  261. data/vendor/assets/javascripts/jquery-ui/keycode.js +11 -7
  262. data/vendor/assets/javascripts/jquery-ui/labels.js +46 -40
  263. data/vendor/assets/javascripts/jquery-ui/plugin.js +5 -2
  264. data/vendor/assets/javascripts/jquery-ui/position.js +30 -17
  265. data/vendor/assets/javascripts/jquery-ui/safe-active-element.js +6 -2
  266. data/vendor/assets/javascripts/jquery-ui/safe-blur.js +6 -2
  267. data/vendor/assets/javascripts/jquery-ui/scroll-parent.js +10 -7
  268. data/vendor/assets/javascripts/jquery-ui/tabbable.js +11 -8
  269. data/vendor/assets/javascripts/jquery-ui/unique-id.js +10 -7
  270. data/vendor/assets/javascripts/jquery-ui/version.js +6 -3
  271. data/vendor/assets/javascripts/jquery-ui/widget.js +53 -30
  272. data/vendor/assets/javascripts/jquery-ui/widgets/button.js +87 -24
  273. data/vendor/assets/javascripts/jquery-ui/widgets/checkboxradio.js +276 -273
  274. data/vendor/assets/javascripts/jquery-ui/widgets/controlgroup.js +15 -11
  275. data/vendor/assets/javascripts/jquery-ui/widgets/datepicker.js +182 -62
  276. data/vendor/assets/javascripts/jquery-ui/widgets/dialog.js +53 -36
  277. data/vendor/assets/javascripts/jquery-ui/widgets/draggable.js +28 -19
  278. data/vendor/assets/javascripts/jquery-ui/widgets/mouse.js +22 -11
  279. data/vendor/assets/javascripts/jquery-ui/widgets/resizable.js +47 -26
  280. data/vendor/assets/javascripts/jquery-ui/widgets/sortable.js +186 -125
  281. data/vendor/assets/javascripts/jquery-ui/widgets/tabs.js +20 -20
  282. metadata +48 -114
  283. data/docs/.gitignore +0 -1
  284. data/docs/0-installation.md +0 -118
  285. data/docs/1-general-configuration.md +0 -224
  286. data/docs/10-custom-pages.md +0 -150
  287. data/docs/11-decorators.md +0 -59
  288. data/docs/12-arbre-components.md +0 -214
  289. data/docs/13-authorization-adapter.md +0 -285
  290. data/docs/14-gotchas.md +0 -138
  291. data/docs/2-resource-customization.md +0 -466
  292. data/docs/3-index-pages/custom-index.md +0 -35
  293. data/docs/3-index-pages/index-as-block.md +0 -19
  294. data/docs/3-index-pages/index-as-blog.md +0 -69
  295. data/docs/3-index-pages/index-as-grid.md +0 -27
  296. data/docs/3-index-pages/index-as-table.md +0 -234
  297. data/docs/3-index-pages.md +0 -328
  298. data/docs/4-csv-format.md +0 -74
  299. data/docs/5-forms.md +0 -232
  300. data/docs/6-show-pages.md +0 -81
  301. data/docs/7-sidebars.md +0 -75
  302. data/docs/8-custom-actions.md +0 -177
  303. data/docs/9-batch-actions.md +0 -237
  304. data/docs/CNAME +0 -1
  305. data/docs/Gemfile +0 -3
  306. data/docs/Gemfile.lock +0 -248
  307. data/docs/README.md +0 -24
  308. data/docs/_config.yml +0 -4
  309. data/docs/_includes/footer.html +0 -8
  310. data/docs/_includes/google-analytics.html +0 -16
  311. data/docs/_includes/head.html +0 -7
  312. data/docs/_includes/toc.html +0 -98
  313. data/docs/_includes/top-menu.html +0 -17
  314. data/docs/_layouts/default.html +0 -21
  315. data/docs/documentation.md +0 -60
  316. data/docs/images/activeadmin.png +0 -0
  317. data/docs/images/code-header.png +0 -0
  318. data/docs/images/divider.png +0 -0
  319. data/docs/images/features.png +0 -0
  320. data/docs/images/tidelift.svg +0 -14
  321. data/docs/index.html +0 -226
  322. data/docs/stylesheets/main.css +0 -1205
  323. data/lib/active_admin/deprecation.rb +0 -10
  324. data/lib/ransack_ext.rb +0 -20
  325. data/vendor/assets/javascripts/jquery-ui/escape-selector.js +0 -23
  326. /data/app/assets/stylesheets/active_admin/{print.scss → _print.scss} +0 -0
@@ -6,22 +6,24 @@
6
6
  //= require jquery-ui/widget
7
7
 
8
8
  /*!
9
- * jQuery UI Sortable 1.12.1
10
- * http://jqueryui.com
9
+ * jQuery UI Sortable 1.13.3
10
+ * https://jqueryui.com
11
11
  *
12
- * Copyright jQuery Foundation and other contributors
12
+ * Copyright OpenJS Foundation and other contributors
13
13
  * Released under the MIT license.
14
- * http://jquery.org/license
14
+ * https://jquery.org/license
15
15
  */
16
16
 
17
17
  //>>label: Sortable
18
18
  //>>group: Interactions
19
19
  //>>description: Enables items in a list to be sorted using the mouse.
20
- //>>docs: http://api.jqueryui.com/sortable/
21
- //>>demos: http://jqueryui.com/sortable/
20
+ //>>docs: https://api.jqueryui.com/sortable/
21
+ //>>demos: https://jqueryui.com/sortable/
22
22
  //>>css.structure: ../../themes/base/sortable.css
23
23
 
24
24
  ( function( factory ) {
25
+ "use strict";
26
+
25
27
  if ( typeof define === "function" && define.amd ) {
26
28
 
27
29
  // AMD. Register as an anonymous module.
@@ -39,10 +41,11 @@
39
41
  // Browser globals
40
42
  factory( jQuery );
41
43
  }
42
- }( function( $ ) {
44
+ } )( function( $ ) {
45
+ "use strict";
43
46
 
44
47
  return $.widget( "ui.sortable", $.ui.mouse, {
45
- version: "1.12.1",
48
+ version: "1.13.3",
46
49
  widgetEventPrefix: "sort",
47
50
  ready: false,
48
51
  options: {
@@ -202,6 +205,11 @@ return $.widget( "ui.sortable", $.ui.mouse, {
202
205
  // mouseCapture
203
206
  this.refreshPositions();
204
207
 
208
+ //Prepare the dragged items parent
209
+ this.appendTo = $( o.appendTo !== "parent" ?
210
+ o.appendTo :
211
+ this.currentItem.parent() );
212
+
205
213
  //Create and append the visible helper
206
214
  this.helper = this._createHelper( event );
207
215
 
@@ -216,9 +224,6 @@ return $.widget( "ui.sortable", $.ui.mouse, {
216
224
  //Cache the margins of the original element
217
225
  this._cacheMargins();
218
226
 
219
- //Get the next scrolling parent
220
- this.scrollParent = this.helper.scrollParent();
221
-
222
227
  //The element's absolute position on the page minus margins
223
228
  this.offset = this.currentItem.offset();
224
229
  this.offset = {
@@ -231,25 +236,22 @@ return $.widget( "ui.sortable", $.ui.mouse, {
231
236
  left: event.pageX - this.offset.left,
232
237
  top: event.pageY - this.offset.top
233
238
  },
234
- parent: this._getParentOffset(),
235
239
 
236
240
  // This is a relative to absolute position minus the actual position calculation -
237
241
  // only used for relative positioned helper
238
242
  relative: this._getRelativeOffset()
239
243
  } );
240
244
 
241
- // Only after we got the offset, we can change the helper's position to absolute
245
+ // After we get the helper offset, but before we get the parent offset we can
246
+ // change the helper's position to absolute
242
247
  // TODO: Still need to figure out a way to make relative sorting possible
243
248
  this.helper.css( "position", "absolute" );
244
249
  this.cssPosition = this.helper.css( "position" );
245
250
 
246
- //Generate the original position
247
- this.originalPosition = this._generatePosition( event );
248
- this.originalPageX = event.pageX;
249
- this.originalPageY = event.pageY;
250
-
251
251
  //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
252
- ( o.cursorAt && this._adjustOffsetFromHelper( o.cursorAt ) );
252
+ if ( o.cursorAt ) {
253
+ this._adjustOffsetFromHelper( o.cursorAt );
254
+ }
253
255
 
254
256
  //Cache the former DOM position
255
257
  this.domPosition = {
@@ -266,6 +268,13 @@ return $.widget( "ui.sortable", $.ui.mouse, {
266
268
  //Create the placeholder
267
269
  this._createPlaceholder();
268
270
 
271
+ //Get the next scrolling parent
272
+ this.scrollParent = this.placeholder.scrollParent();
273
+
274
+ $.extend( this.offset, {
275
+ parent: this._getParentOffset()
276
+ } );
277
+
269
278
  //Set a containment if given in the options
270
279
  if ( o.containment ) {
271
280
  this._setContainment();
@@ -282,13 +291,9 @@ return $.widget( "ui.sortable", $.ui.mouse, {
282
291
  $( "<style>*{ cursor: " + o.cursor + " !important; }</style>" ).appendTo( body );
283
292
  }
284
293
 
285
- if ( o.opacity ) { // opacity option
286
- if ( this.helper.css( "opacity" ) ) {
287
- this._storedOpacity = this.helper.css( "opacity" );
288
- }
289
- this.helper.css( "opacity", o.opacity );
290
- }
291
-
294
+ // We need to make sure to grab the zIndex before setting the
295
+ // opacity, because setting the opacity to anything lower than 1
296
+ // causes the zIndex to change from "auto" to 0.
292
297
  if ( o.zIndex ) { // zIndex option
293
298
  if ( this.helper.css( "zIndex" ) ) {
294
299
  this._storedZIndex = this.helper.css( "zIndex" );
@@ -296,6 +301,13 @@ return $.widget( "ui.sortable", $.ui.mouse, {
296
301
  this.helper.css( "zIndex", o.zIndex );
297
302
  }
298
303
 
304
+ if ( o.opacity ) { // opacity option
305
+ if ( this.helper.css( "opacity" ) ) {
306
+ this._storedOpacity = this.helper.css( "opacity" );
307
+ }
308
+ this.helper.css( "opacity", o.opacity );
309
+ }
310
+
299
311
  //Prepare scrolling
300
312
  if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
301
313
  this.scrollParent[ 0 ].tagName !== "HTML" ) {
@@ -330,77 +342,82 @@ return $.widget( "ui.sortable", $.ui.mouse, {
330
342
 
331
343
  this._addClass( this.helper, "ui-sortable-helper" );
332
344
 
333
- // Execute the drag once - this causes the helper not to be visiblebefore getting its
334
- // correct position
335
- this._mouseDrag( event );
336
- return true;
345
+ //Move the helper, if needed
346
+ if ( !this.helper.parent().is( this.appendTo ) ) {
347
+ this.helper.detach().appendTo( this.appendTo );
337
348
 
338
- },
349
+ //Update position
350
+ this.offset.parent = this._getParentOffset();
351
+ }
339
352
 
340
- _mouseDrag: function( event ) {
341
- var i, item, itemElement, intersection,
342
- o = this.options,
343
- scrolled = false;
353
+ //Generate the original position
354
+ this.position = this.originalPosition = this._generatePosition( event );
355
+ this.originalPageX = event.pageX;
356
+ this.originalPageY = event.pageY;
357
+ this.lastPositionAbs = this.positionAbs = this._convertPositionTo( "absolute" );
344
358
 
345
- //Compute the helpers position
346
- this.position = this._generatePosition( event );
347
- this.positionAbs = this._convertPositionTo( "absolute" );
359
+ this._mouseDrag( event );
348
360
 
349
- if ( !this.lastPositionAbs ) {
350
- this.lastPositionAbs = this.positionAbs;
351
- }
361
+ return true;
352
362
 
353
- //Do scrolling
354
- if ( this.options.scroll ) {
355
- if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
356
- this.scrollParent[ 0 ].tagName !== "HTML" ) {
363
+ },
357
364
 
358
- if ( ( this.overflowOffset.top + this.scrollParent[ 0 ].offsetHeight ) -
359
- event.pageY < o.scrollSensitivity ) {
360
- this.scrollParent[ 0 ].scrollTop =
361
- scrolled = this.scrollParent[ 0 ].scrollTop + o.scrollSpeed;
362
- } else if ( event.pageY - this.overflowOffset.top < o.scrollSensitivity ) {
363
- this.scrollParent[ 0 ].scrollTop =
364
- scrolled = this.scrollParent[ 0 ].scrollTop - o.scrollSpeed;
365
- }
365
+ _scroll: function( event ) {
366
+ var o = this.options,
367
+ scrolled = false;
366
368
 
367
- if ( ( this.overflowOffset.left + this.scrollParent[ 0 ].offsetWidth ) -
368
- event.pageX < o.scrollSensitivity ) {
369
- this.scrollParent[ 0 ].scrollLeft = scrolled =
370
- this.scrollParent[ 0 ].scrollLeft + o.scrollSpeed;
371
- } else if ( event.pageX - this.overflowOffset.left < o.scrollSensitivity ) {
372
- this.scrollParent[ 0 ].scrollLeft = scrolled =
373
- this.scrollParent[ 0 ].scrollLeft - o.scrollSpeed;
374
- }
369
+ if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
370
+ this.scrollParent[ 0 ].tagName !== "HTML" ) {
375
371
 
376
- } else {
372
+ if ( ( this.overflowOffset.top + this.scrollParent[ 0 ].offsetHeight ) -
373
+ event.pageY < o.scrollSensitivity ) {
374
+ this.scrollParent[ 0 ].scrollTop =
375
+ scrolled = this.scrollParent[ 0 ].scrollTop + o.scrollSpeed;
376
+ } else if ( event.pageY - this.overflowOffset.top < o.scrollSensitivity ) {
377
+ this.scrollParent[ 0 ].scrollTop =
378
+ scrolled = this.scrollParent[ 0 ].scrollTop - o.scrollSpeed;
379
+ }
377
380
 
378
- if ( event.pageY - this.document.scrollTop() < o.scrollSensitivity ) {
379
- scrolled = this.document.scrollTop( this.document.scrollTop() - o.scrollSpeed );
380
- } else if ( this.window.height() - ( event.pageY - this.document.scrollTop() ) <
381
- o.scrollSensitivity ) {
382
- scrolled = this.document.scrollTop( this.document.scrollTop() + o.scrollSpeed );
383
- }
381
+ if ( ( this.overflowOffset.left + this.scrollParent[ 0 ].offsetWidth ) -
382
+ event.pageX < o.scrollSensitivity ) {
383
+ this.scrollParent[ 0 ].scrollLeft = scrolled =
384
+ this.scrollParent[ 0 ].scrollLeft + o.scrollSpeed;
385
+ } else if ( event.pageX - this.overflowOffset.left < o.scrollSensitivity ) {
386
+ this.scrollParent[ 0 ].scrollLeft = scrolled =
387
+ this.scrollParent[ 0 ].scrollLeft - o.scrollSpeed;
388
+ }
384
389
 
385
- if ( event.pageX - this.document.scrollLeft() < o.scrollSensitivity ) {
386
- scrolled = this.document.scrollLeft(
387
- this.document.scrollLeft() - o.scrollSpeed
388
- );
389
- } else if ( this.window.width() - ( event.pageX - this.document.scrollLeft() ) <
390
- o.scrollSensitivity ) {
391
- scrolled = this.document.scrollLeft(
392
- this.document.scrollLeft() + o.scrollSpeed
393
- );
394
- }
390
+ } else {
395
391
 
392
+ if ( event.pageY - this.document.scrollTop() < o.scrollSensitivity ) {
393
+ scrolled = this.document.scrollTop( this.document.scrollTop() - o.scrollSpeed );
394
+ } else if ( this.window.height() - ( event.pageY - this.document.scrollTop() ) <
395
+ o.scrollSensitivity ) {
396
+ scrolled = this.document.scrollTop( this.document.scrollTop() + o.scrollSpeed );
396
397
  }
397
398
 
398
- if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) {
399
- $.ui.ddmanager.prepareOffsets( this, event );
399
+ if ( event.pageX - this.document.scrollLeft() < o.scrollSensitivity ) {
400
+ scrolled = this.document.scrollLeft(
401
+ this.document.scrollLeft() - o.scrollSpeed
402
+ );
403
+ } else if ( this.window.width() - ( event.pageX - this.document.scrollLeft() ) <
404
+ o.scrollSensitivity ) {
405
+ scrolled = this.document.scrollLeft(
406
+ this.document.scrollLeft() + o.scrollSpeed
407
+ );
400
408
  }
409
+
401
410
  }
402
411
 
403
- //Regenerate the absolute position used for position checks
412
+ return scrolled;
413
+ },
414
+
415
+ _mouseDrag: function( event ) {
416
+ var i, item, itemElement, intersection,
417
+ o = this.options;
418
+
419
+ //Compute the helpers position
420
+ this.position = this._generatePosition( event );
404
421
  this.positionAbs = this._convertPositionTo( "absolute" );
405
422
 
406
423
  //Set the helper position
@@ -411,6 +428,24 @@ return $.widget( "ui.sortable", $.ui.mouse, {
411
428
  this.helper[ 0 ].style.top = this.position.top + "px";
412
429
  }
413
430
 
431
+ //Do scrolling
432
+ if ( o.scroll ) {
433
+ if ( this._scroll( event ) !== false ) {
434
+
435
+ //Update item positions used in position checks
436
+ this._refreshItemPositions( true );
437
+
438
+ if ( $.ui.ddmanager && !o.dropBehaviour ) {
439
+ $.ui.ddmanager.prepareOffsets( this, event );
440
+ }
441
+ }
442
+ }
443
+
444
+ this.dragDirection = {
445
+ vertical: this._getDragVerticalDirection(),
446
+ horizontal: this._getDragHorizontalDirection()
447
+ };
448
+
414
449
  //Rearrange
415
450
  for ( i = this.items.length - 1; i >= 0; i-- ) {
416
451
 
@@ -437,7 +472,8 @@ return $.widget( "ui.sortable", $.ui.mouse, {
437
472
  // no useless actions that have been done before
438
473
  // no action if the item moved is the parent of the item checked
439
474
  if ( itemElement !== this.currentItem[ 0 ] &&
440
- this.placeholder[ intersection === 1 ? "next" : "prev" ]()[ 0 ] !== itemElement &&
475
+ this.placeholder[ intersection === 1 ?
476
+ "next" : "prev" ]()[ 0 ] !== itemElement &&
441
477
  !$.contains( this.placeholder[ 0 ], itemElement ) &&
442
478
  ( this.options.type === "semi-dynamic" ?
443
479
  !$.contains( this.element[ 0 ], itemElement ) :
@@ -447,7 +483,8 @@ return $.widget( "ui.sortable", $.ui.mouse, {
447
483
 
448
484
  this.direction = intersection === 1 ? "down" : "up";
449
485
 
450
- if ( this.options.tolerance === "pointer" || this._intersectsWithSides( item ) ) {
486
+ if ( this.options.tolerance === "pointer" ||
487
+ this._intersectsWithSides( item ) ) {
451
488
  this._rearrange( event, item );
452
489
  } else {
453
490
  break;
@@ -663,12 +700,12 @@ return $.widget( "ui.sortable", $.ui.mouse, {
663
700
  return false;
664
701
  }
665
702
 
666
- verticalDirection = this._getDragVerticalDirection();
667
- horizontalDirection = this._getDragHorizontalDirection();
703
+ verticalDirection = this.dragDirection.vertical;
704
+ horizontalDirection = this.dragDirection.horizontal;
668
705
 
669
706
  return this.floating ?
670
- ( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 )
671
- : ( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) );
707
+ ( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 ) :
708
+ ( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) );
672
709
 
673
710
  },
674
711
 
@@ -678,8 +715,8 @@ return $.widget( "ui.sortable", $.ui.mouse, {
678
715
  this.offset.click.top, item.top + ( item.height / 2 ), item.height ),
679
716
  isOverRightHalf = this._isOverAxis( this.positionAbs.left +
680
717
  this.offset.click.left, item.left + ( item.width / 2 ), item.width ),
681
- verticalDirection = this._getDragVerticalDirection(),
682
- horizontalDirection = this._getDragHorizontalDirection();
718
+ verticalDirection = this.dragDirection.vertical,
719
+ horizontalDirection = this.dragDirection.horizontal;
683
720
 
684
721
  if ( this.floating && horizontalDirection ) {
685
722
  return ( ( horizontalDirection === "right" && isOverRightHalf ) ||
@@ -728,7 +765,7 @@ return $.widget( "ui.sortable", $.ui.mouse, {
728
765
  for ( j = cur.length - 1; j >= 0; j-- ) {
729
766
  inst = $.data( cur[ j ], this.widgetFullName );
730
767
  if ( inst && inst !== this && !inst.options.disabled ) {
731
- queries.push( [ $.isFunction( inst.options.items ) ?
768
+ queries.push( [ typeof inst.options.items === "function" ?
732
769
  inst.options.items.call( inst.element ) :
733
770
  $( inst.options.items, inst.element )
734
771
  .not( ".ui-sortable-helper" )
@@ -738,7 +775,7 @@ return $.widget( "ui.sortable", $.ui.mouse, {
738
775
  }
739
776
  }
740
777
 
741
- queries.push( [ $.isFunction( this.options.items ) ?
778
+ queries.push( [ typeof this.options.items === "function" ?
742
779
  this.options.items
743
780
  .call( this.element, null, { options: this.options, item: this.currentItem } ) :
744
781
  $( this.options.items, this.element )
@@ -778,7 +815,7 @@ return $.widget( "ui.sortable", $.ui.mouse, {
778
815
 
779
816
  var i, j, cur, inst, targetData, _queries, item, queriesLength,
780
817
  items = this.items,
781
- queries = [ [ $.isFunction( this.options.items ) ?
818
+ queries = [ [ typeof this.options.items === "function" ?
782
819
  this.options.items.call( this.element[ 0 ], event, { item: this.currentItem } ) :
783
820
  $( this.options.items, this.element ), this ] ],
784
821
  connectWith = this._connectWith();
@@ -790,7 +827,7 @@ return $.widget( "ui.sortable", $.ui.mouse, {
790
827
  for ( j = cur.length - 1; j >= 0; j-- ) {
791
828
  inst = $.data( cur[ j ], this.widgetFullName );
792
829
  if ( inst && inst !== this && !inst.options.disabled ) {
793
- queries.push( [ $.isFunction( inst.options.items ) ?
830
+ queries.push( [ typeof inst.options.items === "function" ?
794
831
  inst.options.items
795
832
  .call( inst.element[ 0 ], event, { item: this.currentItem } ) :
796
833
  $( inst.options.items, inst.element ), inst ] );
@@ -821,26 +858,14 @@ return $.widget( "ui.sortable", $.ui.mouse, {
821
858
 
822
859
  },
823
860
 
824
- refreshPositions: function( fast ) {
825
-
826
- // Determine whether items are being displayed horizontally
827
- this.floating = this.items.length ?
828
- this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) :
829
- false;
830
-
831
- //This has to be redone because due to the item being moved out/into the offsetParent,
832
- // the offsetParent's position will change
833
- if ( this.offsetParent && this.helper ) {
834
- this.offset.parent = this._getParentOffset();
835
- }
836
-
861
+ _refreshItemPositions: function( fast ) {
837
862
  var i, item, t, p;
838
863
 
839
864
  for ( i = this.items.length - 1; i >= 0; i-- ) {
840
865
  item = this.items[ i ];
841
866
 
842
867
  //We ignore calculating positions of all connected containers when we're not over them
843
- if ( item.instance !== this.currentContainer && this.currentContainer &&
868
+ if ( this.currentContainer && item.instance !== this.currentContainer &&
844
869
  item.item[ 0 ] !== this.currentItem[ 0 ] ) {
845
870
  continue;
846
871
  }
@@ -858,6 +883,24 @@ return $.widget( "ui.sortable", $.ui.mouse, {
858
883
  item.left = p.left;
859
884
  item.top = p.top;
860
885
  }
886
+ },
887
+
888
+ refreshPositions: function( fast ) {
889
+
890
+ // Determine whether items are being displayed horizontally
891
+ this.floating = this.items.length ?
892
+ this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) :
893
+ false;
894
+
895
+ // This has to be redone because due to the item being moved out/into the offsetParent,
896
+ // the offsetParent's position will change
897
+ if ( this.offsetParent && this.helper ) {
898
+ this.offset.parent = this._getParentOffset();
899
+ }
900
+
901
+ this._refreshItemPositions( fast );
902
+
903
+ var i, p;
861
904
 
862
905
  if ( this.options.custom && this.options.custom.refreshContainers ) {
863
906
  this.options.custom.refreshContainers.call( this );
@@ -878,20 +921,20 @@ return $.widget( "ui.sortable", $.ui.mouse, {
878
921
 
879
922
  _createPlaceholder: function( that ) {
880
923
  that = that || this;
881
- var className,
924
+ var className, nodeName,
882
925
  o = that.options;
883
926
 
884
927
  if ( !o.placeholder || o.placeholder.constructor === String ) {
885
928
  className = o.placeholder;
929
+ nodeName = that.currentItem[ 0 ].nodeName.toLowerCase();
886
930
  o.placeholder = {
887
931
  element: function() {
888
932
 
889
- var nodeName = that.currentItem[ 0 ].nodeName.toLowerCase(),
890
- element = $( "<" + nodeName + ">", that.document[ 0 ] );
933
+ var element = $( "<" + nodeName + ">", that.document[ 0 ] );
891
934
 
892
- that._addClass( element, "ui-sortable-placeholder",
893
- className || that.currentItem[ 0 ].className )
894
- ._removeClass( element, "ui-sortable-helper" );
935
+ that._addClass( element, "ui-sortable-placeholder",
936
+ className || that.currentItem[ 0 ].className )
937
+ ._removeClass( element, "ui-sortable-helper" );
895
938
 
896
939
  if ( nodeName === "tbody" ) {
897
940
  that._createTrPlaceholder(
@@ -920,9 +963,15 @@ return $.widget( "ui.sortable", $.ui.mouse, {
920
963
  return;
921
964
  }
922
965
 
923
- //If the element doesn't have a actual height by itself (without styles coming
924
- // from a stylesheet), it receives the inline height from the dragged item
925
- if ( !p.height() ) {
966
+ // If the element doesn't have a actual height or width by itself (without
967
+ // styles coming from a stylesheet), it receives the inline height and width
968
+ // from the dragged item. Or, if it's a tbody or tr, it's going to have a height
969
+ // anyway since we're populating them with <td>s above, but they're unlikely to
970
+ // be the correct height on their own if the row heights are dynamic, so we'll
971
+ // always assign the height of the dragged item given forcePlaceholderSize
972
+ // is true.
973
+ if ( !p.height() || ( o.forcePlaceholderSize &&
974
+ ( nodeName === "tbody" || nodeName === "tr" ) ) ) {
926
975
  p.height(
927
976
  that.currentItem.innerHeight() -
928
977
  parseInt( that.currentItem.css( "paddingTop" ) || 0, 10 ) -
@@ -1055,9 +1104,11 @@ return $.widget( "ui.sortable", $.ui.mouse, {
1055
1104
  return;
1056
1105
  }
1057
1106
 
1058
- itemWithLeastDistance ?
1059
- this._rearrange( event, itemWithLeastDistance, null, true ) :
1107
+ if ( itemWithLeastDistance ) {
1108
+ this._rearrange( event, itemWithLeastDistance, null, true );
1109
+ } else {
1060
1110
  this._rearrange( event, null, this.containers[ innermostIndex ].element, true );
1111
+ }
1061
1112
  this._trigger( "change", event, this._uiHash() );
1062
1113
  this.containers[ innermostIndex ]._trigger( "change", event, this._uiHash( this ) );
1063
1114
  this.currentContainer = this.containers[ innermostIndex ];
@@ -1065,6 +1116,15 @@ return $.widget( "ui.sortable", $.ui.mouse, {
1065
1116
  //Update the placeholder
1066
1117
  this.options.placeholder.update( this.currentContainer, this.placeholder );
1067
1118
 
1119
+ //Update scrollParent
1120
+ this.scrollParent = this.placeholder.scrollParent();
1121
+
1122
+ //Update overflowOffset
1123
+ if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
1124
+ this.scrollParent[ 0 ].tagName !== "HTML" ) {
1125
+ this.overflowOffset = this.scrollParent.offset();
1126
+ }
1127
+
1068
1128
  this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) );
1069
1129
  this.containers[ innermostIndex ].containerCache.over = 1;
1070
1130
  }
@@ -1074,15 +1134,13 @@ return $.widget( "ui.sortable", $.ui.mouse, {
1074
1134
  _createHelper: function( event ) {
1075
1135
 
1076
1136
  var o = this.options,
1077
- helper = $.isFunction( o.helper ) ?
1137
+ helper = typeof o.helper === "function" ?
1078
1138
  $( o.helper.apply( this.element[ 0 ], [ event, this.currentItem ] ) ) :
1079
1139
  ( o.helper === "clone" ? this.currentItem.clone() : this.currentItem );
1080
1140
 
1081
1141
  //Add the helper to the DOM if that didn't happen already
1082
1142
  if ( !helper.parents( "body" ).length ) {
1083
- $( o.appendTo !== "parent" ?
1084
- o.appendTo :
1085
- this.currentItem[ 0 ].parentNode )[ 0 ].appendChild( helper[ 0 ] );
1143
+ this.appendTo[ 0 ].appendChild( helper[ 0 ] );
1086
1144
  }
1087
1145
 
1088
1146
  if ( helper[ 0 ] === this.currentItem[ 0 ] ) {
@@ -1110,7 +1168,7 @@ return $.widget( "ui.sortable", $.ui.mouse, {
1110
1168
  if ( typeof obj === "string" ) {
1111
1169
  obj = obj.split( " " );
1112
1170
  }
1113
- if ( $.isArray( obj ) ) {
1171
+ if ( Array.isArray( obj ) ) {
1114
1172
  obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 };
1115
1173
  }
1116
1174
  if ( "left" in obj ) {
@@ -1390,9 +1448,12 @@ return $.widget( "ui.sortable", $.ui.mouse, {
1390
1448
 
1391
1449
  _rearrange: function( event, i, a, hardRefresh ) {
1392
1450
 
1393
- a ? a[ 0 ].appendChild( this.placeholder[ 0 ] ) :
1451
+ if ( a ) {
1452
+ a[ 0 ].appendChild( this.placeholder[ 0 ] );
1453
+ } else {
1394
1454
  i.item[ 0 ].parentNode.insertBefore( this.placeholder[ 0 ],
1395
1455
  ( this.direction === "down" ? i.item[ 0 ] : i.item[ 0 ].nextSibling ) );
1456
+ }
1396
1457
 
1397
1458
  //Various things done here to improve the performance:
1398
1459
  // 1. we create a setTimeout, that calls refreshPositions
@@ -1558,4 +1619,4 @@ return $.widget( "ui.sortable", $.ui.mouse, {
1558
1619
 
1559
1620
  } );
1560
1621
 
1561
- } ) );
1622
+ } );