activeadmin 3.4.0 → 4.0.0.beta18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (357) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -102
  3. data/CONTRIBUTING.md +32 -117
  4. data/README.md +17 -30
  5. data/UPGRADING.md +241 -0
  6. data/app/assets/config/active_admin_manifest.js +2 -0
  7. data/{lib → app/controllers}/active_admin/base_controller/authorization.rb +1 -1
  8. data/app/controllers/active_admin/base_controller/menu.rb +39 -0
  9. data/{lib → app/controllers}/active_admin/base_controller.rb +46 -18
  10. data/{lib → app/controllers}/active_admin/page_controller.rb +0 -4
  11. data/{lib → app/controllers}/active_admin/resource_controller/action_builder.rb +1 -1
  12. data/{lib → app/controllers}/active_admin/resource_controller/data_access.rb +11 -6
  13. data/{lib → app/controllers}/active_admin/resource_controller/scoping.rb +1 -1
  14. data/{lib → app/controllers}/active_admin/resource_controller/streaming.rb +4 -4
  15. data/app/controllers/active_admin/resource_controller.rb +102 -0
  16. data/app/helpers/active_admin/auto_link_helper.rb +66 -0
  17. data/app/helpers/active_admin/breadcrumb_helper.rb +41 -0
  18. data/app/helpers/active_admin/display_helper.rb +117 -0
  19. data/app/helpers/active_admin/form_helper.rb +95 -0
  20. data/app/helpers/active_admin/index_helper.rb +40 -0
  21. data/app/helpers/active_admin/layout_helper.rb +63 -0
  22. data/app/javascript/active_admin/features/batch_actions.js +95 -0
  23. data/app/javascript/active_admin/features/dark_mode_toggle.js +37 -0
  24. data/app/javascript/active_admin/features/filters.js +34 -0
  25. data/app/javascript/active_admin/features/has_many.js +28 -0
  26. data/app/javascript/active_admin/features/main_menu.js +12 -0
  27. data/app/javascript/active_admin/features/per_page.js +9 -0
  28. data/app/javascript/active_admin/utils/dom.js +17 -0
  29. data/app/javascript/active_admin.js +10 -0
  30. data/app/views/active_admin/_flash_messages.html.erb +22 -0
  31. data/app/views/active_admin/_html_head.html.erb +13 -0
  32. data/app/views/active_admin/_main_navigation.html.erb +28 -0
  33. data/app/views/active_admin/_page_header.html.erb +27 -0
  34. data/app/views/active_admin/_sidebar.html.erb +5 -0
  35. data/app/views/active_admin/_site_footer.html.erb +7 -0
  36. data/app/views/active_admin/_site_header.html.erb +30 -0
  37. data/app/views/active_admin/devise/confirmations/new.html.erb +5 -3
  38. data/app/views/active_admin/devise/passwords/edit.html.erb +5 -3
  39. data/app/views/active_admin/devise/passwords/new.html.erb +5 -4
  40. data/app/views/active_admin/devise/registrations/new.html.erb +6 -4
  41. data/app/views/active_admin/devise/sessions/new.html.erb +6 -4
  42. data/app/views/active_admin/devise/shared/_links.erb +3 -1
  43. data/app/views/active_admin/devise/unlocks/new.html.erb +6 -4
  44. data/app/views/{kaminari/active_admin_countless → active_admin/kaminari}/_gap.html.erb +3 -1
  45. data/app/views/active_admin/kaminari/_next_page.html.erb +16 -0
  46. data/app/views/active_admin/kaminari/_page.html.erb +14 -0
  47. data/app/views/{kaminari/active_admin_countless → active_admin/kaminari}/_paginator.html.erb +1 -2
  48. data/app/views/active_admin/kaminari/_prev_page.html.erb +16 -0
  49. data/app/views/active_admin/page/index.html.arb +5 -2
  50. data/app/views/active_admin/resource/_active_filters.html.erb +32 -0
  51. data/app/views/active_admin/resource/_batch_actions_dropdown.html.erb +19 -0
  52. data/app/views/active_admin/resource/_form.html.arb +15 -0
  53. data/app/views/active_admin/resource/_form_default.html.arb +11 -0
  54. data/app/views/active_admin/resource/_index_as_table_default.html.arb +8 -0
  55. data/app/views/active_admin/resource/_index_blank_slate.html.erb +14 -0
  56. data/app/views/active_admin/resource/_index_empty_results.html.erb +5 -0
  57. data/app/views/active_admin/resource/_index_table_actions_default.html.erb +9 -0
  58. data/app/views/active_admin/resource/_show_default.html.arb +2 -0
  59. data/app/views/active_admin/resource/edit.html.arb +1 -2
  60. data/app/views/active_admin/resource/index.html.arb +94 -2
  61. data/app/views/active_admin/resource/new.html.arb +1 -2
  62. data/app/views/active_admin/resource/show.html.arb +12 -2
  63. data/app/views/active_admin/shared/_action_items.html.erb +3 -0
  64. data/app/views/active_admin/shared/_download_format_links.html.erb +7 -0
  65. data/app/views/active_admin/shared/_resource_comments.html.erb +51 -0
  66. data/app/views/active_admin/shared/_sidebar_section.html.arb +6 -0
  67. data/app/views/active_admin/shared/_sidebar_sections.html.erb +5 -0
  68. data/app/views/layouts/active_admin.html.erb +20 -0
  69. data/app/views/layouts/active_admin_logged_out.html.erb +8 -45
  70. data/config/importmap.rb +5 -0
  71. data/config/locales/ar.yml +136 -116
  72. data/config/locales/az.yml +103 -118
  73. data/config/locales/bg.yml +91 -99
  74. data/config/locales/bs.yml +95 -101
  75. data/config/locales/ca.yml +131 -86
  76. data/config/locales/cs.yml +82 -90
  77. data/config/locales/da.yml +102 -117
  78. data/config/locales/de.yml +130 -141
  79. data/config/locales/el.yml +94 -106
  80. data/config/locales/en-CA.yml +104 -119
  81. data/config/locales/en-GB.yml +104 -119
  82. data/config/locales/en.yml +134 -140
  83. data/config/locales/eo.yml +107 -123
  84. data/config/locales/es-MX.yml +70 -78
  85. data/config/locales/es.yml +129 -138
  86. data/config/locales/fa.yml +91 -99
  87. data/config/locales/fi.yml +84 -92
  88. data/config/locales/fr.yml +135 -120
  89. data/config/locales/he.yml +103 -118
  90. data/config/locales/hr.yml +95 -103
  91. data/config/locales/hu.yml +76 -81
  92. data/config/locales/id.yml +97 -112
  93. data/config/locales/it.yml +134 -140
  94. data/config/locales/ja.yml +109 -120
  95. data/config/locales/ko.yml +136 -101
  96. data/config/locales/lt.yml +106 -121
  97. data/config/locales/lv.yml +70 -75
  98. data/config/locales/mk.yml +100 -114
  99. data/config/locales/nb.yml +98 -109
  100. data/config/locales/nl.yml +113 -122
  101. data/config/locales/pl.yml +137 -146
  102. data/config/locales/pt-BR.yml +134 -121
  103. data/config/locales/pt-PT.yml +71 -76
  104. data/config/locales/ro.yml +74 -79
  105. data/config/locales/ru.yml +142 -122
  106. data/config/locales/sk.yml +131 -146
  107. data/config/locales/sv-SE.yml +126 -141
  108. data/config/locales/tr.yml +105 -120
  109. data/config/locales/uk.yml +140 -119
  110. data/config/locales/vi.yml +125 -140
  111. data/config/locales/zh-CN.yml +135 -141
  112. data/config/locales/zh-TW.yml +136 -116
  113. data/lib/active_admin/application.rb +6 -14
  114. data/lib/active_admin/application_settings.rb +1 -1
  115. data/lib/active_admin/async_count.rb +23 -0
  116. data/lib/active_admin/batch_actions/controller.rb +1 -4
  117. data/lib/active_admin/batch_actions/resource_extension.rb +8 -15
  118. data/lib/active_admin/batch_actions/views/batch_action_form.rb +1 -7
  119. data/lib/active_admin/batch_actions/views/selection_cells.rb +3 -3
  120. data/lib/active_admin/batch_actions.rb +4 -9
  121. data/lib/active_admin/callbacks.rb +6 -4
  122. data/lib/active_admin/collection_decorator.rb +1 -1
  123. data/lib/active_admin/component.rb +0 -1
  124. data/lib/active_admin/csv_builder.rb +2 -2
  125. data/lib/active_admin/devise.rb +3 -3
  126. data/lib/active_admin/dsl.rb +3 -3
  127. data/lib/active_admin/dynamic_settings_node.rb +6 -6
  128. data/lib/active_admin/engine.rb +23 -7
  129. data/lib/active_admin/filters/active.rb +8 -6
  130. data/lib/active_admin/filters/active_filter.rb +2 -10
  131. data/lib/active_admin/filters/forms.rb +1 -45
  132. data/lib/active_admin/filters/resource_extension.rb +18 -10
  133. data/lib/active_admin/filters.rb +5 -7
  134. data/lib/active_admin/form_builder.rb +14 -17
  135. data/lib/active_admin/helpers/optional_display.rb +1 -1
  136. data/lib/active_admin/inputs/filters/base/search_method_select.rb +10 -12
  137. data/lib/active_admin/inputs/filters/base.rb +1 -1
  138. data/lib/active_admin/inputs/filters/check_boxes_input.rb +1 -6
  139. data/lib/active_admin/inputs/filters/date_range_input.rb +4 -2
  140. data/lib/active_admin/inputs.rb +0 -3
  141. data/lib/active_admin/localizers.rb +1 -1
  142. data/lib/active_admin/menu.rb +10 -7
  143. data/lib/active_admin/menu_collection.rb +1 -1
  144. data/lib/active_admin/menu_item.rb +24 -3
  145. data/lib/active_admin/namespace.rb +3 -45
  146. data/lib/active_admin/namespace_settings.rb +3 -36
  147. data/lib/active_admin/order_clause.rb +4 -1
  148. data/lib/active_admin/orm/active_record/comments/views/active_admin_comments.rb +4 -76
  149. data/lib/active_admin/orm/active_record/comments/views.rb +2 -2
  150. data/lib/active_admin/orm/active_record/comments.rb +13 -8
  151. data/lib/active_admin/orm/active_record.rb +1 -1
  152. data/lib/active_admin/pundit_adapter.rb +3 -3
  153. data/lib/active_admin/resource/action_items.rb +18 -23
  154. data/lib/active_admin/resource/naming.rb +2 -3
  155. data/lib/active_admin/resource/page_presenters.rb +2 -2
  156. data/lib/active_admin/resource/sidebars.rb +1 -1
  157. data/lib/active_admin/resource.rb +17 -16
  158. data/lib/active_admin/resource_collection.rb +1 -1
  159. data/lib/active_admin/resource_dsl.rb +3 -3
  160. data/lib/active_admin/scope.rb +11 -1
  161. data/lib/active_admin/settings_node.rb +1 -1
  162. data/lib/active_admin/sidebar_section.rb +0 -5
  163. data/lib/active_admin/version.rb +1 -1
  164. data/lib/active_admin/view_helpers/method_or_proc_helper.rb +1 -1
  165. data/lib/active_admin/view_helpers.rb +0 -12
  166. data/lib/active_admin/views/components/active_admin_form.rb +21 -29
  167. data/lib/active_admin/views/components/attributes_table.rb +14 -16
  168. data/lib/active_admin/views/components/index_list.rb +10 -23
  169. data/lib/active_admin/views/components/paginated_collection.rb +34 -39
  170. data/lib/active_admin/views/components/panel.rb +3 -11
  171. data/lib/active_admin/views/components/scopes.rb +39 -26
  172. data/lib/active_admin/views/components/status_tag.rb +22 -19
  173. data/lib/active_admin/views/components/table_for.rb +25 -25
  174. data/lib/active_admin/views/index_as_table.rb +39 -101
  175. data/lib/active_admin.rb +16 -15
  176. data/lib/activeadmin.rb +1 -1
  177. data/lib/generators/active_admin/assets/assets_generator.rb +4 -4
  178. data/lib/generators/active_admin/assets/templates/active_admin.css +3 -0
  179. data/lib/generators/active_admin/assets/templates/tailwind.config.js +21 -0
  180. data/lib/generators/active_admin/devise/devise_generator.rb +2 -2
  181. data/lib/generators/active_admin/install/install_generator.rb +2 -8
  182. data/lib/generators/active_admin/install/templates/active_admin.rb.erb +10 -87
  183. data/lib/generators/active_admin/install/templates/dashboard.rb +8 -25
  184. data/lib/generators/active_admin/page/page_generator.rb +0 -1
  185. data/lib/generators/active_admin/resource/resource_generator.rb +50 -7
  186. data/lib/generators/active_admin/resource/templates/resource.rb.erb +42 -0
  187. data/lib/generators/active_admin/views_generator.rb +18 -0
  188. data/plugin.js +414 -0
  189. data/vendor/bundle/offense.rb +1 -0
  190. data/vendor/javascript/flowbite.js +1 -0
  191. data/vendor/javascript/rails_ujs_esm.js +1 -0
  192. metadata +80 -207
  193. data/app/assets/javascripts/active_admin/base.js +0 -517
  194. data/app/assets/stylesheets/active_admin/_base.scss +0 -57
  195. data/app/assets/stylesheets/active_admin/_forms.scss +0 -315
  196. data/app/assets/stylesheets/active_admin/_header.scss +0 -188
  197. data/app/assets/stylesheets/active_admin/_mixins.scss +0 -1
  198. data/app/assets/stylesheets/active_admin/_normalize.scss +0 -349
  199. data/app/assets/stylesheets/active_admin/_print.scss +0 -287
  200. data/app/assets/stylesheets/active_admin/_typography.scss +0 -100
  201. data/app/assets/stylesheets/active_admin/components/_batch_actions.scss +0 -6
  202. data/app/assets/stylesheets/active_admin/components/_blank_slates.scss +0 -30
  203. data/app/assets/stylesheets/active_admin/components/_breadcrumbs.scss +0 -20
  204. data/app/assets/stylesheets/active_admin/components/_buttons.scss +0 -6
  205. data/app/assets/stylesheets/active_admin/components/_columns.scss +0 -3
  206. data/app/assets/stylesheets/active_admin/components/_comments.scss +0 -41
  207. data/app/assets/stylesheets/active_admin/components/_date_picker.scss +0 -148
  208. data/app/assets/stylesheets/active_admin/components/_dropdown_menu.scss +0 -154
  209. data/app/assets/stylesheets/active_admin/components/_flash_messages.scss +0 -37
  210. data/app/assets/stylesheets/active_admin/components/_grid.scss +0 -9
  211. data/app/assets/stylesheets/active_admin/components/_index_list.scss +0 -12
  212. data/app/assets/stylesheets/active_admin/components/_links.scss +0 -5
  213. data/app/assets/stylesheets/active_admin/components/_modal_dialog.scss +0 -34
  214. data/app/assets/stylesheets/active_admin/components/_pagination.scss +0 -58
  215. data/app/assets/stylesheets/active_admin/components/_panels.scss +0 -6
  216. data/app/assets/stylesheets/active_admin/components/_scopes.scss +0 -13
  217. data/app/assets/stylesheets/active_admin/components/_status_tags.scss +0 -12
  218. data/app/assets/stylesheets/active_admin/components/_table_tools.scss +0 -70
  219. data/app/assets/stylesheets/active_admin/components/_tables.scss +0 -112
  220. data/app/assets/stylesheets/active_admin/components/_tabs.scss +0 -68
  221. data/app/assets/stylesheets/active_admin/components/_unsupported_browser.scss +0 -16
  222. data/app/assets/stylesheets/active_admin/mixins/_all.scss +0 -8
  223. data/app/assets/stylesheets/active_admin/mixins/_buttons.scss +0 -65
  224. data/app/assets/stylesheets/active_admin/mixins/_gradients.scss +0 -28
  225. data/app/assets/stylesheets/active_admin/mixins/_rounded.scss +0 -22
  226. data/app/assets/stylesheets/active_admin/mixins/_sections.scss +0 -41
  227. data/app/assets/stylesheets/active_admin/mixins/_shadows.scss +0 -15
  228. data/app/assets/stylesheets/active_admin/mixins/_typography.scss +0 -3
  229. data/app/assets/stylesheets/active_admin/mixins/_utilities.scss +0 -17
  230. data/app/assets/stylesheets/active_admin/mixins/_variables.scss +0 -51
  231. data/app/assets/stylesheets/active_admin/pages/_logged_out.scss +0 -44
  232. data/app/assets/stylesheets/active_admin/structure/_footer.scss +0 -19
  233. data/app/assets/stylesheets/active_admin/structure/_main_structure.scss +0 -29
  234. data/app/assets/stylesheets/active_admin/structure/_title_bar.scss +0 -43
  235. data/app/javascript/active_admin/base.js +0 -28
  236. data/app/javascript/active_admin/ext/jquery-ui.js +0 -7
  237. data/app/javascript/active_admin/ext/jquery.js +0 -9
  238. data/app/javascript/active_admin/initializers/batch-actions.js +0 -61
  239. data/app/javascript/active_admin/initializers/checkbox-toggler.js +0 -3
  240. data/app/javascript/active_admin/initializers/datepicker.js +0 -16
  241. data/app/javascript/active_admin/initializers/dropdown-menu.js +0 -9
  242. data/app/javascript/active_admin/initializers/filters.js +0 -10
  243. data/app/javascript/active_admin/initializers/has-many.js +0 -98
  244. data/app/javascript/active_admin/initializers/per-page.js +0 -13
  245. data/app/javascript/active_admin/initializers/table-checkbox-toggler.js +0 -3
  246. data/app/javascript/active_admin/initializers/tabs.js +0 -6
  247. data/app/javascript/active_admin/lib/checkbox-toggler.js +0 -49
  248. data/app/javascript/active_admin/lib/dropdown-menu.js +0 -116
  249. data/app/javascript/active_admin/lib/filters.js +0 -39
  250. data/app/javascript/active_admin/lib/modal-dialog.js +0 -63
  251. data/app/javascript/active_admin/lib/per-page.js +0 -38
  252. data/app/javascript/active_admin/lib/table-checkbox-toggler.js +0 -38
  253. data/app/javascript/active_admin/lib/utils.js +0 -40
  254. data/app/views/kaminari/active_admin/_first_page.html.erb +0 -11
  255. data/app/views/kaminari/active_admin/_gap.html.erb +0 -8
  256. data/app/views/kaminari/active_admin/_last_page.html.erb +0 -11
  257. data/app/views/kaminari/active_admin/_next_page.html.erb +0 -11
  258. data/app/views/kaminari/active_admin/_page.html.erb +0 -12
  259. data/app/views/kaminari/active_admin/_paginator.html.erb +0 -25
  260. data/app/views/kaminari/active_admin/_prev_page.html.erb +0 -11
  261. data/app/views/kaminari/active_admin_countless/_first_page.html.erb +0 -11
  262. data/app/views/kaminari/active_admin_countless/_next_page.html.erb +0 -11
  263. data/app/views/kaminari/active_admin_countless/_page.html.erb +0 -12
  264. data/app/views/kaminari/active_admin_countless/_prev_page.html.erb +0 -11
  265. data/app/views/layouts/active_admin.html.arb +0 -2
  266. data/config/locales/de-CH.yml +0 -94
  267. data/lib/active_admin/abstract_view_factory.rb +0 -48
  268. data/lib/active_admin/asset_registration.rb +0 -30
  269. data/lib/active_admin/base_controller/menu.rb +0 -35
  270. data/lib/active_admin/batch_actions/views/batch_action_selector.rb +0 -59
  271. data/lib/active_admin/filters/active_sidebar.rb +0 -28
  272. data/lib/active_admin/generators/boilerplate.rb +0 -54
  273. data/lib/active_admin/helpers/collection.rb +0 -21
  274. data/lib/active_admin/helpers/i18n.rb +0 -8
  275. data/lib/active_admin/inputs/datepicker_input.rb +0 -28
  276. data/lib/active_admin/inputs/filters/date_picker_input.rb +0 -14
  277. data/lib/active_admin/orm/active_record/comments/show_page_helper.rb +0 -24
  278. data/lib/active_admin/orm/mongoid.rb +0 -2
  279. data/lib/active_admin/resource_controller/sidebars.rb +0 -19
  280. data/lib/active_admin/resource_controller.rb +0 -68
  281. data/lib/active_admin/view_factory.rb +0 -28
  282. data/lib/active_admin/view_helpers/active_admin_application_helper.rb +0 -13
  283. data/lib/active_admin/view_helpers/auto_link_helper.rb +0 -46
  284. data/lib/active_admin/view_helpers/breadcrumb_helper.rb +0 -34
  285. data/lib/active_admin/view_helpers/display_helper.rb +0 -119
  286. data/lib/active_admin/view_helpers/download_format_links_helper.rb +0 -60
  287. data/lib/active_admin/view_helpers/fields_for.rb +0 -51
  288. data/lib/active_admin/view_helpers/flash_helper.rb +0 -15
  289. data/lib/active_admin/view_helpers/form_helper.rb +0 -21
  290. data/lib/active_admin/view_helpers/scope_name_helper.rb +0 -17
  291. data/lib/active_admin/view_helpers/sidebar_helper.rb +0 -16
  292. data/lib/active_admin/view_helpers/title_helper.rb +0 -12
  293. data/lib/active_admin/view_helpers/view_factory_helper.rb +0 -12
  294. data/lib/active_admin/views/action_items.rb +0 -18
  295. data/lib/active_admin/views/components/active_filters_sidebar_content.rb +0 -59
  296. data/lib/active_admin/views/components/blank_slate.rb +0 -18
  297. data/lib/active_admin/views/components/columns.rb +0 -162
  298. data/lib/active_admin/views/components/dropdown_menu.rb +0 -69
  299. data/lib/active_admin/views/components/menu.rb +0 -33
  300. data/lib/active_admin/views/components/menu_item.rb +0 -59
  301. data/lib/active_admin/views/components/sidebar.rb +0 -14
  302. data/lib/active_admin/views/components/sidebar_section.rb +0 -35
  303. data/lib/active_admin/views/components/site_title.rb +0 -55
  304. data/lib/active_admin/views/components/tabs.rb +0 -41
  305. data/lib/active_admin/views/components/unsupported_browser.rb +0 -12
  306. data/lib/active_admin/views/footer.rb +0 -32
  307. data/lib/active_admin/views/header.rb +0 -20
  308. data/lib/active_admin/views/index_as_block.rb +0 -37
  309. data/lib/active_admin/views/index_as_blog.rb +0 -156
  310. data/lib/active_admin/views/index_as_grid.rb +0 -81
  311. data/lib/active_admin/views/pages/base.rb +0 -134
  312. data/lib/active_admin/views/pages/form.rb +0 -65
  313. data/lib/active_admin/views/pages/index.rb +0 -166
  314. data/lib/active_admin/views/pages/layout.rb +0 -27
  315. data/lib/active_admin/views/pages/page.rb +0 -31
  316. data/lib/active_admin/views/pages/show.rb +0 -60
  317. data/lib/active_admin/views/tabbed_navigation.rb +0 -12
  318. data/lib/active_admin/views/title_bar.rb +0 -56
  319. data/lib/generators/active_admin/assets/templates/active_admin.js +0 -1
  320. data/lib/generators/active_admin/assets/templates/active_admin.scss +0 -17
  321. data/lib/generators/active_admin/resource/templates/admin.rb.erb +0 -46
  322. data/lib/generators/active_admin/webpacker/plugins/jquery.js +0 -7
  323. data/lib/generators/active_admin/webpacker/templates/active_admin.js +0 -5
  324. data/lib/generators/active_admin/webpacker/templates/active_admin.scss +0 -17
  325. data/lib/generators/active_admin/webpacker/templates/print.scss +0 -2
  326. data/lib/generators/active_admin/webpacker/webpacker_generator.rb +0 -27
  327. data/vendor/assets/javascripts/jquery-ui/data.js +0 -45
  328. data/vendor/assets/javascripts/jquery-ui/disable-selection.js +0 -51
  329. data/vendor/assets/javascripts/jquery-ui/focusable.js +0 -89
  330. data/vendor/assets/javascripts/jquery-ui/form-reset-mixin.js +0 -83
  331. data/vendor/assets/javascripts/jquery-ui/form.js +0 -25
  332. data/vendor/assets/javascripts/jquery-ui/ie.js +0 -20
  333. data/vendor/assets/javascripts/jquery-ui/keycode.js +0 -51
  334. data/vendor/assets/javascripts/jquery-ui/labels.js +0 -71
  335. data/vendor/assets/javascripts/jquery-ui/plugin.js +0 -49
  336. data/vendor/assets/javascripts/jquery-ui/position.js +0 -513
  337. data/vendor/assets/javascripts/jquery-ui/safe-active-element.js +0 -46
  338. data/vendor/assets/javascripts/jquery-ui/safe-blur.js +0 -27
  339. data/vendor/assets/javascripts/jquery-ui/scroll-parent.js +0 -50
  340. data/vendor/assets/javascripts/jquery-ui/tabbable.js +0 -41
  341. data/vendor/assets/javascripts/jquery-ui/unique-id.js +0 -54
  342. data/vendor/assets/javascripts/jquery-ui/version.js +0 -20
  343. data/vendor/assets/javascripts/jquery-ui/widget.js +0 -758
  344. data/vendor/assets/javascripts/jquery-ui/widgets/button.js +0 -454
  345. data/vendor/assets/javascripts/jquery-ui/widgets/checkboxradio.js +0 -294
  346. data/vendor/assets/javascripts/jquery-ui/widgets/controlgroup.js +0 -304
  347. data/vendor/assets/javascripts/jquery-ui/widgets/datepicker.js +0 -2243
  348. data/vendor/assets/javascripts/jquery-ui/widgets/dialog.js +0 -971
  349. data/vendor/assets/javascripts/jquery-ui/widgets/draggable.js +0 -1268
  350. data/vendor/assets/javascripts/jquery-ui/widgets/mouse.js +0 -241
  351. data/vendor/assets/javascripts/jquery-ui/widgets/resizable.js +0 -1228
  352. data/vendor/assets/javascripts/jquery-ui/widgets/sortable.js +0 -1622
  353. data/vendor/assets/javascripts/jquery-ui/widgets/tabs.js +0 -931
  354. /data/{lib → app/controllers}/active_admin/resource_controller/decorators.rb +0 -0
  355. /data/{lib → app/controllers}/active_admin/resource_controller/polymorphic_routes.rb +0 -0
  356. /data/{lib → app/controllers}/active_admin/resource_controller/resource_class_methods.rb +0 -0
  357. /data/lib/{active_admin/orm/mongoid/.gitkeep → generators/active_admin/assets/templates/builds/.keep} +0 -0
@@ -1,1268 +0,0 @@
1
- //= require jquery-ui/widgets/mouse
2
- //= require jquery-ui/data
3
- //= require jquery-ui/plugin
4
- //= require jquery-ui/safe-active-element
5
- //= require jquery-ui/safe-blur
6
- //= require jquery-ui/scroll-parent
7
- //= require jquery-ui/version
8
- //= require jquery-ui/widget
9
-
10
- /*!
11
- * jQuery UI Draggable 1.13.3
12
- * https://jqueryui.com
13
- *
14
- * Copyright OpenJS Foundation and other contributors
15
- * Released under the MIT license.
16
- * https://jquery.org/license
17
- */
18
-
19
- //>>label: Draggable
20
- //>>group: Interactions
21
- //>>description: Enables dragging functionality for any element.
22
- //>>docs: https://api.jqueryui.com/draggable/
23
- //>>demos: https://jqueryui.com/draggable/
24
- //>>css.structure: ../../themes/base/draggable.css
25
-
26
- ( function( factory ) {
27
- "use strict";
28
-
29
- if ( typeof define === "function" && define.amd ) {
30
-
31
- // AMD. Register as an anonymous module.
32
- define( [
33
- "jquery",
34
- "./mouse",
35
- "../data",
36
- "../plugin",
37
- "../safe-active-element",
38
- "../safe-blur",
39
- "../scroll-parent",
40
- "../version",
41
- "../widget"
42
- ], factory );
43
- } else {
44
-
45
- // Browser globals
46
- factory( jQuery );
47
- }
48
- } )( function( $ ) {
49
- "use strict";
50
-
51
- $.widget( "ui.draggable", $.ui.mouse, {
52
- version: "1.13.3",
53
- widgetEventPrefix: "drag",
54
- options: {
55
- addClasses: true,
56
- appendTo: "parent",
57
- axis: false,
58
- connectToSortable: false,
59
- containment: false,
60
- cursor: "auto",
61
- cursorAt: false,
62
- grid: false,
63
- handle: false,
64
- helper: "original",
65
- iframeFix: false,
66
- opacity: false,
67
- refreshPositions: false,
68
- revert: false,
69
- revertDuration: 500,
70
- scope: "default",
71
- scroll: true,
72
- scrollSensitivity: 20,
73
- scrollSpeed: 20,
74
- snap: false,
75
- snapMode: "both",
76
- snapTolerance: 20,
77
- stack: false,
78
- zIndex: false,
79
-
80
- // Callbacks
81
- drag: null,
82
- start: null,
83
- stop: null
84
- },
85
- _create: function() {
86
-
87
- if ( this.options.helper === "original" ) {
88
- this._setPositionRelative();
89
- }
90
- if ( this.options.addClasses ) {
91
- this._addClass( "ui-draggable" );
92
- }
93
- this._setHandleClassName();
94
-
95
- this._mouseInit();
96
- },
97
-
98
- _setOption: function( key, value ) {
99
- this._super( key, value );
100
- if ( key === "handle" ) {
101
- this._removeHandleClassName();
102
- this._setHandleClassName();
103
- }
104
- },
105
-
106
- _destroy: function() {
107
- if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) {
108
- this.destroyOnClear = true;
109
- return;
110
- }
111
- this._removeHandleClassName();
112
- this._mouseDestroy();
113
- },
114
-
115
- _mouseCapture: function( event ) {
116
- var o = this.options;
117
-
118
- // Among others, prevent a drag on a resizable-handle
119
- if ( this.helper || o.disabled ||
120
- $( event.target ).closest( ".ui-resizable-handle" ).length > 0 ) {
121
- return false;
122
- }
123
-
124
- //Quit if we're not on a valid handle
125
- this.handle = this._getHandle( event );
126
- if ( !this.handle ) {
127
- return false;
128
- }
129
-
130
- this._blurActiveElement( event );
131
-
132
- this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix );
133
-
134
- return true;
135
-
136
- },
137
-
138
- _blockFrames: function( selector ) {
139
- this.iframeBlocks = this.document.find( selector ).map( function() {
140
- var iframe = $( this );
141
-
142
- return $( "<div>" )
143
- .css( "position", "absolute" )
144
- .appendTo( iframe.parent() )
145
- .outerWidth( iframe.outerWidth() )
146
- .outerHeight( iframe.outerHeight() )
147
- .offset( iframe.offset() )[ 0 ];
148
- } );
149
- },
150
-
151
- _unblockFrames: function() {
152
- if ( this.iframeBlocks ) {
153
- this.iframeBlocks.remove();
154
- delete this.iframeBlocks;
155
- }
156
- },
157
-
158
- _blurActiveElement: function( event ) {
159
- var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ),
160
- target = $( event.target );
161
-
162
- // Don't blur if the event occurred on an element that is within
163
- // the currently focused element
164
- // See #10527, #12472
165
- if ( target.closest( activeElement ).length ) {
166
- return;
167
- }
168
-
169
- // Blur any element that currently has focus, see #4261
170
- $.ui.safeBlur( activeElement );
171
- },
172
-
173
- _mouseStart: function( event ) {
174
-
175
- var o = this.options;
176
-
177
- //Create and append the visible helper
178
- this.helper = this._createHelper( event );
179
-
180
- this._addClass( this.helper, "ui-draggable-dragging" );
181
-
182
- //Cache the helper size
183
- this._cacheHelperProportions();
184
-
185
- //If ddmanager is used for droppables, set the global draggable
186
- if ( $.ui.ddmanager ) {
187
- $.ui.ddmanager.current = this;
188
- }
189
-
190
- /*
191
- * - Position generation -
192
- * This block generates everything position related - it's the core of draggables.
193
- */
194
-
195
- //Cache the margins of the original element
196
- this._cacheMargins();
197
-
198
- //Store the helper's css position
199
- this.cssPosition = this.helper.css( "position" );
200
- this.scrollParent = this.helper.scrollParent( true );
201
- this.offsetParent = this.helper.offsetParent();
202
- this.hasFixedAncestor = this.helper.parents().filter( function() {
203
- return $( this ).css( "position" ) === "fixed";
204
- } ).length > 0;
205
-
206
- //The element's absolute position on the page minus margins
207
- this.positionAbs = this.element.offset();
208
- this._refreshOffsets( event );
209
-
210
- //Generate the original position
211
- this.originalPosition = this.position = this._generatePosition( event, false );
212
- this.originalPageX = event.pageX;
213
- this.originalPageY = event.pageY;
214
-
215
- //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
216
- if ( o.cursorAt ) {
217
- this._adjustOffsetFromHelper( o.cursorAt );
218
- }
219
-
220
- //Set a containment if given in the options
221
- this._setContainment();
222
-
223
- //Trigger event + callbacks
224
- if ( this._trigger( "start", event ) === false ) {
225
- this._clear();
226
- return false;
227
- }
228
-
229
- //Recache the helper size
230
- this._cacheHelperProportions();
231
-
232
- //Prepare the droppable offsets
233
- if ( $.ui.ddmanager && !o.dropBehaviour ) {
234
- $.ui.ddmanager.prepareOffsets( this, event );
235
- }
236
-
237
- // Execute the drag once - this causes the helper not to be visible before getting its
238
- // correct position
239
- this._mouseDrag( event, true );
240
-
241
- // If the ddmanager is used for droppables, inform the manager that dragging has started
242
- // (see #5003)
243
- if ( $.ui.ddmanager ) {
244
- $.ui.ddmanager.dragStart( this, event );
245
- }
246
-
247
- return true;
248
- },
249
-
250
- _refreshOffsets: function( event ) {
251
- this.offset = {
252
- top: this.positionAbs.top - this.margins.top,
253
- left: this.positionAbs.left - this.margins.left,
254
- scroll: false,
255
- parent: this._getParentOffset(),
256
- relative: this._getRelativeOffset()
257
- };
258
-
259
- this.offset.click = {
260
- left: event.pageX - this.offset.left,
261
- top: event.pageY - this.offset.top
262
- };
263
- },
264
-
265
- _mouseDrag: function( event, noPropagation ) {
266
-
267
- // reset any necessary cached properties (see #5009)
268
- if ( this.hasFixedAncestor ) {
269
- this.offset.parent = this._getParentOffset();
270
- }
271
-
272
- //Compute the helpers position
273
- this.position = this._generatePosition( event, true );
274
- this.positionAbs = this._convertPositionTo( "absolute" );
275
-
276
- //Call plugins and callbacks and use the resulting position if something is returned
277
- if ( !noPropagation ) {
278
- var ui = this._uiHash();
279
- if ( this._trigger( "drag", event, ui ) === false ) {
280
- this._mouseUp( new $.Event( "mouseup", event ) );
281
- return false;
282
- }
283
- this.position = ui.position;
284
- }
285
-
286
- this.helper[ 0 ].style.left = this.position.left + "px";
287
- this.helper[ 0 ].style.top = this.position.top + "px";
288
-
289
- if ( $.ui.ddmanager ) {
290
- $.ui.ddmanager.drag( this, event );
291
- }
292
-
293
- return false;
294
- },
295
-
296
- _mouseStop: function( event ) {
297
-
298
- //If we are using droppables, inform the manager about the drop
299
- var that = this,
300
- dropped = false;
301
- if ( $.ui.ddmanager && !this.options.dropBehaviour ) {
302
- dropped = $.ui.ddmanager.drop( this, event );
303
- }
304
-
305
- //if a drop comes from outside (a sortable)
306
- if ( this.dropped ) {
307
- dropped = this.dropped;
308
- this.dropped = false;
309
- }
310
-
311
- if ( ( this.options.revert === "invalid" && !dropped ) ||
312
- ( this.options.revert === "valid" && dropped ) ||
313
- this.options.revert === true || ( typeof this.options.revert === "function" &&
314
- this.options.revert.call( this.element, dropped ) )
315
- ) {
316
- $( this.helper ).animate(
317
- this.originalPosition,
318
- parseInt( this.options.revertDuration, 10 ),
319
- function() {
320
- if ( that._trigger( "stop", event ) !== false ) {
321
- that._clear();
322
- }
323
- }
324
- );
325
- } else {
326
- if ( this._trigger( "stop", event ) !== false ) {
327
- this._clear();
328
- }
329
- }
330
-
331
- return false;
332
- },
333
-
334
- _mouseUp: function( event ) {
335
- this._unblockFrames();
336
-
337
- // If the ddmanager is used for droppables, inform the manager that dragging has stopped
338
- // (see #5003)
339
- if ( $.ui.ddmanager ) {
340
- $.ui.ddmanager.dragStop( this, event );
341
- }
342
-
343
- // Only need to focus if the event occurred on the draggable itself, see #10527
344
- if ( this.handleElement.is( event.target ) ) {
345
-
346
- // The interaction is over; whether or not the click resulted in a drag,
347
- // focus the element
348
- this.element.trigger( "focus" );
349
- }
350
-
351
- return $.ui.mouse.prototype._mouseUp.call( this, event );
352
- },
353
-
354
- cancel: function() {
355
-
356
- if ( this.helper.is( ".ui-draggable-dragging" ) ) {
357
- this._mouseUp( new $.Event( "mouseup", { target: this.element[ 0 ] } ) );
358
- } else {
359
- this._clear();
360
- }
361
-
362
- return this;
363
-
364
- },
365
-
366
- _getHandle: function( event ) {
367
- return this.options.handle ?
368
- !!$( event.target ).closest( this.element.find( this.options.handle ) ).length :
369
- true;
370
- },
371
-
372
- _setHandleClassName: function() {
373
- this.handleElement = this.options.handle ?
374
- this.element.find( this.options.handle ) : this.element;
375
- this._addClass( this.handleElement, "ui-draggable-handle" );
376
- },
377
-
378
- _removeHandleClassName: function() {
379
- this._removeClass( this.handleElement, "ui-draggable-handle" );
380
- },
381
-
382
- _createHelper: function( event ) {
383
-
384
- var o = this.options,
385
- helperIsFunction = typeof o.helper === "function",
386
- helper = helperIsFunction ?
387
- $( o.helper.apply( this.element[ 0 ], [ event ] ) ) :
388
- ( o.helper === "clone" ?
389
- this.element.clone().removeAttr( "id" ) :
390
- this.element );
391
-
392
- if ( !helper.parents( "body" ).length ) {
393
- helper.appendTo( ( o.appendTo === "parent" ?
394
- this.element[ 0 ].parentNode :
395
- o.appendTo ) );
396
- }
397
-
398
- // https://bugs.jqueryui.com/ticket/9446
399
- // a helper function can return the original element
400
- // which wouldn't have been set to relative in _create
401
- if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) {
402
- this._setPositionRelative();
403
- }
404
-
405
- if ( helper[ 0 ] !== this.element[ 0 ] &&
406
- !( /(fixed|absolute)/ ).test( helper.css( "position" ) ) ) {
407
- helper.css( "position", "absolute" );
408
- }
409
-
410
- return helper;
411
-
412
- },
413
-
414
- _setPositionRelative: function() {
415
- if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) {
416
- this.element[ 0 ].style.position = "relative";
417
- }
418
- },
419
-
420
- _adjustOffsetFromHelper: function( obj ) {
421
- if ( typeof obj === "string" ) {
422
- obj = obj.split( " " );
423
- }
424
- if ( Array.isArray( obj ) ) {
425
- obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 };
426
- }
427
- if ( "left" in obj ) {
428
- this.offset.click.left = obj.left + this.margins.left;
429
- }
430
- if ( "right" in obj ) {
431
- this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
432
- }
433
- if ( "top" in obj ) {
434
- this.offset.click.top = obj.top + this.margins.top;
435
- }
436
- if ( "bottom" in obj ) {
437
- this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
438
- }
439
- },
440
-
441
- _isRootNode: function( element ) {
442
- return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ];
443
- },
444
-
445
- _getParentOffset: function() {
446
-
447
- //Get the offsetParent and cache its position
448
- var po = this.offsetParent.offset(),
449
- document = this.document[ 0 ];
450
-
451
- // This is a special case where we need to modify a offset calculated on start, since the
452
- // following happened:
453
- // 1. The position of the helper is absolute, so it's position is calculated based on the
454
- // next positioned parent
455
- // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't
456
- // the document, which means that the scroll is included in the initial calculation of the
457
- // offset of the parent, and never recalculated upon drag
458
- if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== document &&
459
- $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) {
460
- po.left += this.scrollParent.scrollLeft();
461
- po.top += this.scrollParent.scrollTop();
462
- }
463
-
464
- if ( this._isRootNode( this.offsetParent[ 0 ] ) ) {
465
- po = { top: 0, left: 0 };
466
- }
467
-
468
- return {
469
- top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ),
470
- left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 )
471
- };
472
-
473
- },
474
-
475
- _getRelativeOffset: function() {
476
- if ( this.cssPosition !== "relative" ) {
477
- return { top: 0, left: 0 };
478
- }
479
-
480
- var p = this.element.position(),
481
- scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
482
-
483
- return {
484
- top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) +
485
- ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ),
486
- left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) +
487
- ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 )
488
- };
489
-
490
- },
491
-
492
- _cacheMargins: function() {
493
- this.margins = {
494
- left: ( parseInt( this.element.css( "marginLeft" ), 10 ) || 0 ),
495
- top: ( parseInt( this.element.css( "marginTop" ), 10 ) || 0 ),
496
- right: ( parseInt( this.element.css( "marginRight" ), 10 ) || 0 ),
497
- bottom: ( parseInt( this.element.css( "marginBottom" ), 10 ) || 0 )
498
- };
499
- },
500
-
501
- _cacheHelperProportions: function() {
502
- this.helperProportions = {
503
- width: this.helper.outerWidth(),
504
- height: this.helper.outerHeight()
505
- };
506
- },
507
-
508
- _setContainment: function() {
509
-
510
- var isUserScrollable, c, ce,
511
- o = this.options,
512
- document = this.document[ 0 ];
513
-
514
- this.relativeContainer = null;
515
-
516
- if ( !o.containment ) {
517
- this.containment = null;
518
- return;
519
- }
520
-
521
- if ( o.containment === "window" ) {
522
- this.containment = [
523
- $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
524
- $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top,
525
- $( window ).scrollLeft() + $( window ).width() -
526
- this.helperProportions.width - this.margins.left,
527
- $( window ).scrollTop() +
528
- ( $( window ).height() || document.body.parentNode.scrollHeight ) -
529
- this.helperProportions.height - this.margins.top
530
- ];
531
- return;
532
- }
533
-
534
- if ( o.containment === "document" ) {
535
- this.containment = [
536
- 0,
537
- 0,
538
- $( document ).width() - this.helperProportions.width - this.margins.left,
539
- ( $( document ).height() || document.body.parentNode.scrollHeight ) -
540
- this.helperProportions.height - this.margins.top
541
- ];
542
- return;
543
- }
544
-
545
- if ( o.containment.constructor === Array ) {
546
- this.containment = o.containment;
547
- return;
548
- }
549
-
550
- if ( o.containment === "parent" ) {
551
- o.containment = this.helper[ 0 ].parentNode;
552
- }
553
-
554
- c = $( o.containment );
555
- ce = c[ 0 ];
556
-
557
- if ( !ce ) {
558
- return;
559
- }
560
-
561
- isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) );
562
-
563
- this.containment = [
564
- ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) +
565
- ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ),
566
- ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) +
567
- ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ),
568
- ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
569
- ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) -
570
- ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) -
571
- this.helperProportions.width -
572
- this.margins.left -
573
- this.margins.right,
574
- ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
575
- ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) -
576
- ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) -
577
- this.helperProportions.height -
578
- this.margins.top -
579
- this.margins.bottom
580
- ];
581
- this.relativeContainer = c;
582
- },
583
-
584
- _convertPositionTo: function( d, pos ) {
585
-
586
- if ( !pos ) {
587
- pos = this.position;
588
- }
589
-
590
- var mod = d === "absolute" ? 1 : -1,
591
- scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
592
-
593
- return {
594
- top: (
595
-
596
- // The absolute mouse position
597
- pos.top +
598
-
599
- // Only for relative positioned nodes: Relative offset from element to offset parent
600
- this.offset.relative.top * mod +
601
-
602
- // The offsetParent's offset without borders (offset + border)
603
- this.offset.parent.top * mod -
604
- ( ( this.cssPosition === "fixed" ?
605
- -this.offset.scroll.top :
606
- ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod )
607
- ),
608
- left: (
609
-
610
- // The absolute mouse position
611
- pos.left +
612
-
613
- // Only for relative positioned nodes: Relative offset from element to offset parent
614
- this.offset.relative.left * mod +
615
-
616
- // The offsetParent's offset without borders (offset + border)
617
- this.offset.parent.left * mod -
618
- ( ( this.cssPosition === "fixed" ?
619
- -this.offset.scroll.left :
620
- ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod )
621
- )
622
- };
623
-
624
- },
625
-
626
- _generatePosition: function( event, constrainPosition ) {
627
-
628
- var containment, co, top, left,
629
- o = this.options,
630
- scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ),
631
- pageX = event.pageX,
632
- pageY = event.pageY;
633
-
634
- // Cache the scroll
635
- if ( !scrollIsRootNode || !this.offset.scroll ) {
636
- this.offset.scroll = {
637
- top: this.scrollParent.scrollTop(),
638
- left: this.scrollParent.scrollLeft()
639
- };
640
- }
641
-
642
- /*
643
- * - Position constraining -
644
- * Constrain the position to a mix of grid, containment.
645
- */
646
-
647
- // If we are not dragging yet, we won't check for options
648
- if ( constrainPosition ) {
649
- if ( this.containment ) {
650
- if ( this.relativeContainer ) {
651
- co = this.relativeContainer.offset();
652
- containment = [
653
- this.containment[ 0 ] + co.left,
654
- this.containment[ 1 ] + co.top,
655
- this.containment[ 2 ] + co.left,
656
- this.containment[ 3 ] + co.top
657
- ];
658
- } else {
659
- containment = this.containment;
660
- }
661
-
662
- if ( event.pageX - this.offset.click.left < containment[ 0 ] ) {
663
- pageX = containment[ 0 ] + this.offset.click.left;
664
- }
665
- if ( event.pageY - this.offset.click.top < containment[ 1 ] ) {
666
- pageY = containment[ 1 ] + this.offset.click.top;
667
- }
668
- if ( event.pageX - this.offset.click.left > containment[ 2 ] ) {
669
- pageX = containment[ 2 ] + this.offset.click.left;
670
- }
671
- if ( event.pageY - this.offset.click.top > containment[ 3 ] ) {
672
- pageY = containment[ 3 ] + this.offset.click.top;
673
- }
674
- }
675
-
676
- if ( o.grid ) {
677
-
678
- //Check for grid elements set to 0 to prevent divide by 0 error causing invalid
679
- // argument errors in IE (see ticket #6950)
680
- top = o.grid[ 1 ] ? this.originalPageY + Math.round( ( pageY -
681
- this.originalPageY ) / o.grid[ 1 ] ) * o.grid[ 1 ] : this.originalPageY;
682
- pageY = containment ? ( ( top - this.offset.click.top >= containment[ 1 ] ||
683
- top - this.offset.click.top > containment[ 3 ] ) ?
684
- top :
685
- ( ( top - this.offset.click.top >= containment[ 1 ] ) ?
686
- top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : top;
687
-
688
- left = o.grid[ 0 ] ? this.originalPageX +
689
- Math.round( ( pageX - this.originalPageX ) / o.grid[ 0 ] ) * o.grid[ 0 ] :
690
- this.originalPageX;
691
- pageX = containment ? ( ( left - this.offset.click.left >= containment[ 0 ] ||
692
- left - this.offset.click.left > containment[ 2 ] ) ?
693
- left :
694
- ( ( left - this.offset.click.left >= containment[ 0 ] ) ?
695
- left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : left;
696
- }
697
-
698
- if ( o.axis === "y" ) {
699
- pageX = this.originalPageX;
700
- }
701
-
702
- if ( o.axis === "x" ) {
703
- pageY = this.originalPageY;
704
- }
705
- }
706
-
707
- return {
708
- top: (
709
-
710
- // The absolute mouse position
711
- pageY -
712
-
713
- // Click offset (relative to the element)
714
- this.offset.click.top -
715
-
716
- // Only for relative positioned nodes: Relative offset from element to offset parent
717
- this.offset.relative.top -
718
-
719
- // The offsetParent's offset without borders (offset + border)
720
- this.offset.parent.top +
721
- ( this.cssPosition === "fixed" ?
722
- -this.offset.scroll.top :
723
- ( scrollIsRootNode ? 0 : this.offset.scroll.top ) )
724
- ),
725
- left: (
726
-
727
- // The absolute mouse position
728
- pageX -
729
-
730
- // Click offset (relative to the element)
731
- this.offset.click.left -
732
-
733
- // Only for relative positioned nodes: Relative offset from element to offset parent
734
- this.offset.relative.left -
735
-
736
- // The offsetParent's offset without borders (offset + border)
737
- this.offset.parent.left +
738
- ( this.cssPosition === "fixed" ?
739
- -this.offset.scroll.left :
740
- ( scrollIsRootNode ? 0 : this.offset.scroll.left ) )
741
- )
742
- };
743
-
744
- },
745
-
746
- _clear: function() {
747
- this._removeClass( this.helper, "ui-draggable-dragging" );
748
- if ( this.helper[ 0 ] !== this.element[ 0 ] && !this.cancelHelperRemoval ) {
749
- this.helper.remove();
750
- }
751
- this.helper = null;
752
- this.cancelHelperRemoval = false;
753
- if ( this.destroyOnClear ) {
754
- this.destroy();
755
- }
756
- },
757
-
758
- // From now on bulk stuff - mainly helpers
759
-
760
- _trigger: function( type, event, ui ) {
761
- ui = ui || this._uiHash();
762
- $.ui.plugin.call( this, type, [ event, ui, this ], true );
763
-
764
- // Absolute position and offset (see #6884 ) have to be recalculated after plugins
765
- if ( /^(drag|start|stop)/.test( type ) ) {
766
- this.positionAbs = this._convertPositionTo( "absolute" );
767
- ui.offset = this.positionAbs;
768
- }
769
- return $.Widget.prototype._trigger.call( this, type, event, ui );
770
- },
771
-
772
- plugins: {},
773
-
774
- _uiHash: function() {
775
- return {
776
- helper: this.helper,
777
- position: this.position,
778
- originalPosition: this.originalPosition,
779
- offset: this.positionAbs
780
- };
781
- }
782
-
783
- } );
784
-
785
- $.ui.plugin.add( "draggable", "connectToSortable", {
786
- start: function( event, ui, draggable ) {
787
- var uiSortable = $.extend( {}, ui, {
788
- item: draggable.element
789
- } );
790
-
791
- draggable.sortables = [];
792
- $( draggable.options.connectToSortable ).each( function() {
793
- var sortable = $( this ).sortable( "instance" );
794
-
795
- if ( sortable && !sortable.options.disabled ) {
796
- draggable.sortables.push( sortable );
797
-
798
- // RefreshPositions is called at drag start to refresh the containerCache
799
- // which is used in drag. This ensures it's initialized and synchronized
800
- // with any changes that might have happened on the page since initialization.
801
- sortable.refreshPositions();
802
- sortable._trigger( "activate", event, uiSortable );
803
- }
804
- } );
805
- },
806
- stop: function( event, ui, draggable ) {
807
- var uiSortable = $.extend( {}, ui, {
808
- item: draggable.element
809
- } );
810
-
811
- draggable.cancelHelperRemoval = false;
812
-
813
- $.each( draggable.sortables, function() {
814
- var sortable = this;
815
-
816
- if ( sortable.isOver ) {
817
- sortable.isOver = 0;
818
-
819
- // Allow this sortable to handle removing the helper
820
- draggable.cancelHelperRemoval = true;
821
- sortable.cancelHelperRemoval = false;
822
-
823
- // Use _storedCSS To restore properties in the sortable,
824
- // as this also handles revert (#9675) since the draggable
825
- // may have modified them in unexpected ways (#8809)
826
- sortable._storedCSS = {
827
- position: sortable.placeholder.css( "position" ),
828
- top: sortable.placeholder.css( "top" ),
829
- left: sortable.placeholder.css( "left" )
830
- };
831
-
832
- sortable._mouseStop( event );
833
-
834
- // Once drag has ended, the sortable should return to using
835
- // its original helper, not the shared helper from draggable
836
- sortable.options.helper = sortable.options._helper;
837
- } else {
838
-
839
- // Prevent this Sortable from removing the helper.
840
- // However, don't set the draggable to remove the helper
841
- // either as another connected Sortable may yet handle the removal.
842
- sortable.cancelHelperRemoval = true;
843
-
844
- sortable._trigger( "deactivate", event, uiSortable );
845
- }
846
- } );
847
- },
848
- drag: function( event, ui, draggable ) {
849
- $.each( draggable.sortables, function() {
850
- var innermostIntersecting = false,
851
- sortable = this;
852
-
853
- // Copy over variables that sortable's _intersectsWith uses
854
- sortable.positionAbs = draggable.positionAbs;
855
- sortable.helperProportions = draggable.helperProportions;
856
- sortable.offset.click = draggable.offset.click;
857
-
858
- if ( sortable._intersectsWith( sortable.containerCache ) ) {
859
- innermostIntersecting = true;
860
-
861
- $.each( draggable.sortables, function() {
862
-
863
- // Copy over variables that sortable's _intersectsWith uses
864
- this.positionAbs = draggable.positionAbs;
865
- this.helperProportions = draggable.helperProportions;
866
- this.offset.click = draggable.offset.click;
867
-
868
- if ( this !== sortable &&
869
- this._intersectsWith( this.containerCache ) &&
870
- $.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) {
871
- innermostIntersecting = false;
872
- }
873
-
874
- return innermostIntersecting;
875
- } );
876
- }
877
-
878
- if ( innermostIntersecting ) {
879
-
880
- // If it intersects, we use a little isOver variable and set it once,
881
- // so that the move-in stuff gets fired only once.
882
- if ( !sortable.isOver ) {
883
- sortable.isOver = 1;
884
-
885
- // Store draggable's parent in case we need to reappend to it later.
886
- draggable._parent = ui.helper.parent();
887
-
888
- sortable.currentItem = ui.helper
889
- .appendTo( sortable.element )
890
- .data( "ui-sortable-item", true );
891
-
892
- // Store helper option to later restore it
893
- sortable.options._helper = sortable.options.helper;
894
-
895
- sortable.options.helper = function() {
896
- return ui.helper[ 0 ];
897
- };
898
-
899
- // Fire the start events of the sortable with our passed browser event,
900
- // and our own helper (so it doesn't create a new one)
901
- event.target = sortable.currentItem[ 0 ];
902
- sortable._mouseCapture( event, true );
903
- sortable._mouseStart( event, true, true );
904
-
905
- // Because the browser event is way off the new appended portlet,
906
- // modify necessary variables to reflect the changes
907
- sortable.offset.click.top = draggable.offset.click.top;
908
- sortable.offset.click.left = draggable.offset.click.left;
909
- sortable.offset.parent.left -= draggable.offset.parent.left -
910
- sortable.offset.parent.left;
911
- sortable.offset.parent.top -= draggable.offset.parent.top -
912
- sortable.offset.parent.top;
913
-
914
- draggable._trigger( "toSortable", event );
915
-
916
- // Inform draggable that the helper is in a valid drop zone,
917
- // used solely in the revert option to handle "valid/invalid".
918
- draggable.dropped = sortable.element;
919
-
920
- // Need to refreshPositions of all sortables in the case that
921
- // adding to one sortable changes the location of the other sortables (#9675)
922
- $.each( draggable.sortables, function() {
923
- this.refreshPositions();
924
- } );
925
-
926
- // Hack so receive/update callbacks work (mostly)
927
- draggable.currentItem = draggable.element;
928
- sortable.fromOutside = draggable;
929
- }
930
-
931
- if ( sortable.currentItem ) {
932
- sortable._mouseDrag( event );
933
-
934
- // Copy the sortable's position because the draggable's can potentially reflect
935
- // a relative position, while sortable is always absolute, which the dragged
936
- // element has now become. (#8809)
937
- ui.position = sortable.position;
938
- }
939
- } else {
940
-
941
- // If it doesn't intersect with the sortable, and it intersected before,
942
- // we fake the drag stop of the sortable, but make sure it doesn't remove
943
- // the helper by using cancelHelperRemoval.
944
- if ( sortable.isOver ) {
945
-
946
- sortable.isOver = 0;
947
- sortable.cancelHelperRemoval = true;
948
-
949
- // Calling sortable's mouseStop would trigger a revert,
950
- // so revert must be temporarily false until after mouseStop is called.
951
- sortable.options._revert = sortable.options.revert;
952
- sortable.options.revert = false;
953
-
954
- sortable._trigger( "out", event, sortable._uiHash( sortable ) );
955
- sortable._mouseStop( event, true );
956
-
957
- // Restore sortable behaviors that were modfied
958
- // when the draggable entered the sortable area (#9481)
959
- sortable.options.revert = sortable.options._revert;
960
- sortable.options.helper = sortable.options._helper;
961
-
962
- if ( sortable.placeholder ) {
963
- sortable.placeholder.remove();
964
- }
965
-
966
- // Restore and recalculate the draggable's offset considering the sortable
967
- // may have modified them in unexpected ways. (#8809, #10669)
968
- ui.helper.appendTo( draggable._parent );
969
- draggable._refreshOffsets( event );
970
- ui.position = draggable._generatePosition( event, true );
971
-
972
- draggable._trigger( "fromSortable", event );
973
-
974
- // Inform draggable that the helper is no longer in a valid drop zone
975
- draggable.dropped = false;
976
-
977
- // Need to refreshPositions of all sortables just in case removing
978
- // from one sortable changes the location of other sortables (#9675)
979
- $.each( draggable.sortables, function() {
980
- this.refreshPositions();
981
- } );
982
- }
983
- }
984
- } );
985
- }
986
- } );
987
-
988
- $.ui.plugin.add( "draggable", "cursor", {
989
- start: function( event, ui, instance ) {
990
- var t = $( "body" ),
991
- o = instance.options;
992
-
993
- if ( t.css( "cursor" ) ) {
994
- o._cursor = t.css( "cursor" );
995
- }
996
- t.css( "cursor", o.cursor );
997
- },
998
- stop: function( event, ui, instance ) {
999
- var o = instance.options;
1000
- if ( o._cursor ) {
1001
- $( "body" ).css( "cursor", o._cursor );
1002
- }
1003
- }
1004
- } );
1005
-
1006
- $.ui.plugin.add( "draggable", "opacity", {
1007
- start: function( event, ui, instance ) {
1008
- var t = $( ui.helper ),
1009
- o = instance.options;
1010
- if ( t.css( "opacity" ) ) {
1011
- o._opacity = t.css( "opacity" );
1012
- }
1013
- t.css( "opacity", o.opacity );
1014
- },
1015
- stop: function( event, ui, instance ) {
1016
- var o = instance.options;
1017
- if ( o._opacity ) {
1018
- $( ui.helper ).css( "opacity", o._opacity );
1019
- }
1020
- }
1021
- } );
1022
-
1023
- $.ui.plugin.add( "draggable", "scroll", {
1024
- start: function( event, ui, i ) {
1025
- if ( !i.scrollParentNotHidden ) {
1026
- i.scrollParentNotHidden = i.helper.scrollParent( false );
1027
- }
1028
-
1029
- if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] &&
1030
- i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) {
1031
- i.overflowOffset = i.scrollParentNotHidden.offset();
1032
- }
1033
- },
1034
- drag: function( event, ui, i ) {
1035
-
1036
- var o = i.options,
1037
- scrolled = false,
1038
- scrollParent = i.scrollParentNotHidden[ 0 ],
1039
- document = i.document[ 0 ];
1040
-
1041
- if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) {
1042
- if ( !o.axis || o.axis !== "x" ) {
1043
- if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY <
1044
- o.scrollSensitivity ) {
1045
- scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed;
1046
- } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) {
1047
- scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed;
1048
- }
1049
- }
1050
-
1051
- if ( !o.axis || o.axis !== "y" ) {
1052
- if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX <
1053
- o.scrollSensitivity ) {
1054
- scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed;
1055
- } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) {
1056
- scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed;
1057
- }
1058
- }
1059
-
1060
- } else {
1061
-
1062
- if ( !o.axis || o.axis !== "x" ) {
1063
- if ( event.pageY - $( document ).scrollTop() < o.scrollSensitivity ) {
1064
- scrolled = $( document ).scrollTop( $( document ).scrollTop() - o.scrollSpeed );
1065
- } else if ( $( window ).height() - ( event.pageY - $( document ).scrollTop() ) <
1066
- o.scrollSensitivity ) {
1067
- scrolled = $( document ).scrollTop( $( document ).scrollTop() + o.scrollSpeed );
1068
- }
1069
- }
1070
-
1071
- if ( !o.axis || o.axis !== "y" ) {
1072
- if ( event.pageX - $( document ).scrollLeft() < o.scrollSensitivity ) {
1073
- scrolled = $( document ).scrollLeft(
1074
- $( document ).scrollLeft() - o.scrollSpeed
1075
- );
1076
- } else if ( $( window ).width() - ( event.pageX - $( document ).scrollLeft() ) <
1077
- o.scrollSensitivity ) {
1078
- scrolled = $( document ).scrollLeft(
1079
- $( document ).scrollLeft() + o.scrollSpeed
1080
- );
1081
- }
1082
- }
1083
-
1084
- }
1085
-
1086
- if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) {
1087
- $.ui.ddmanager.prepareOffsets( i, event );
1088
- }
1089
-
1090
- }
1091
- } );
1092
-
1093
- $.ui.plugin.add( "draggable", "snap", {
1094
- start: function( event, ui, i ) {
1095
-
1096
- var o = i.options;
1097
-
1098
- i.snapElements = [];
1099
-
1100
- $( o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap )
1101
- .each( function() {
1102
- var $t = $( this ),
1103
- $o = $t.offset();
1104
- if ( this !== i.element[ 0 ] ) {
1105
- i.snapElements.push( {
1106
- item: this,
1107
- width: $t.outerWidth(), height: $t.outerHeight(),
1108
- top: $o.top, left: $o.left
1109
- } );
1110
- }
1111
- } );
1112
-
1113
- },
1114
- drag: function( event, ui, inst ) {
1115
-
1116
- var ts, bs, ls, rs, l, r, t, b, i, first,
1117
- o = inst.options,
1118
- d = o.snapTolerance,
1119
- x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
1120
- y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
1121
-
1122
- for ( i = inst.snapElements.length - 1; i >= 0; i-- ) {
1123
-
1124
- l = inst.snapElements[ i ].left - inst.margins.left;
1125
- r = l + inst.snapElements[ i ].width;
1126
- t = inst.snapElements[ i ].top - inst.margins.top;
1127
- b = t + inst.snapElements[ i ].height;
1128
-
1129
- if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d ||
1130
- !$.contains( inst.snapElements[ i ].item.ownerDocument,
1131
- inst.snapElements[ i ].item ) ) {
1132
- if ( inst.snapElements[ i ].snapping ) {
1133
- if ( inst.options.snap.release ) {
1134
- inst.options.snap.release.call(
1135
- inst.element,
1136
- event,
1137
- $.extend( inst._uiHash(), { snapItem: inst.snapElements[ i ].item } )
1138
- );
1139
- }
1140
- }
1141
- inst.snapElements[ i ].snapping = false;
1142
- continue;
1143
- }
1144
-
1145
- if ( o.snapMode !== "inner" ) {
1146
- ts = Math.abs( t - y2 ) <= d;
1147
- bs = Math.abs( b - y1 ) <= d;
1148
- ls = Math.abs( l - x2 ) <= d;
1149
- rs = Math.abs( r - x1 ) <= d;
1150
- if ( ts ) {
1151
- ui.position.top = inst._convertPositionTo( "relative", {
1152
- top: t - inst.helperProportions.height,
1153
- left: 0
1154
- } ).top;
1155
- }
1156
- if ( bs ) {
1157
- ui.position.top = inst._convertPositionTo( "relative", {
1158
- top: b,
1159
- left: 0
1160
- } ).top;
1161
- }
1162
- if ( ls ) {
1163
- ui.position.left = inst._convertPositionTo( "relative", {
1164
- top: 0,
1165
- left: l - inst.helperProportions.width
1166
- } ).left;
1167
- }
1168
- if ( rs ) {
1169
- ui.position.left = inst._convertPositionTo( "relative", {
1170
- top: 0,
1171
- left: r
1172
- } ).left;
1173
- }
1174
- }
1175
-
1176
- first = ( ts || bs || ls || rs );
1177
-
1178
- if ( o.snapMode !== "outer" ) {
1179
- ts = Math.abs( t - y1 ) <= d;
1180
- bs = Math.abs( b - y2 ) <= d;
1181
- ls = Math.abs( l - x1 ) <= d;
1182
- rs = Math.abs( r - x2 ) <= d;
1183
- if ( ts ) {
1184
- ui.position.top = inst._convertPositionTo( "relative", {
1185
- top: t,
1186
- left: 0
1187
- } ).top;
1188
- }
1189
- if ( bs ) {
1190
- ui.position.top = inst._convertPositionTo( "relative", {
1191
- top: b - inst.helperProportions.height,
1192
- left: 0
1193
- } ).top;
1194
- }
1195
- if ( ls ) {
1196
- ui.position.left = inst._convertPositionTo( "relative", {
1197
- top: 0,
1198
- left: l
1199
- } ).left;
1200
- }
1201
- if ( rs ) {
1202
- ui.position.left = inst._convertPositionTo( "relative", {
1203
- top: 0,
1204
- left: r - inst.helperProportions.width
1205
- } ).left;
1206
- }
1207
- }
1208
-
1209
- if ( !inst.snapElements[ i ].snapping && ( ts || bs || ls || rs || first ) ) {
1210
- if ( inst.options.snap.snap ) {
1211
- inst.options.snap.snap.call(
1212
- inst.element,
1213
- event,
1214
- $.extend( inst._uiHash(), {
1215
- snapItem: inst.snapElements[ i ].item
1216
- } ) );
1217
- }
1218
- }
1219
- inst.snapElements[ i ].snapping = ( ts || bs || ls || rs || first );
1220
-
1221
- }
1222
-
1223
- }
1224
- } );
1225
-
1226
- $.ui.plugin.add( "draggable", "stack", {
1227
- start: function( event, ui, instance ) {
1228
- var min,
1229
- o = instance.options,
1230
- group = $.makeArray( $( o.stack ) ).sort( function( a, b ) {
1231
- return ( parseInt( $( a ).css( "zIndex" ), 10 ) || 0 ) -
1232
- ( parseInt( $( b ).css( "zIndex" ), 10 ) || 0 );
1233
- } );
1234
-
1235
- if ( !group.length ) {
1236
- return;
1237
- }
1238
-
1239
- min = parseInt( $( group[ 0 ] ).css( "zIndex" ), 10 ) || 0;
1240
- $( group ).each( function( i ) {
1241
- $( this ).css( "zIndex", min + i );
1242
- } );
1243
- this.css( "zIndex", ( min + group.length ) );
1244
- }
1245
- } );
1246
-
1247
- $.ui.plugin.add( "draggable", "zIndex", {
1248
- start: function( event, ui, instance ) {
1249
- var t = $( ui.helper ),
1250
- o = instance.options;
1251
-
1252
- if ( t.css( "zIndex" ) ) {
1253
- o._zIndex = t.css( "zIndex" );
1254
- }
1255
- t.css( "zIndex", o.zIndex );
1256
- },
1257
- stop: function( event, ui, instance ) {
1258
- var o = instance.options;
1259
-
1260
- if ( o._zIndex ) {
1261
- $( ui.helper ).css( "zIndex", o._zIndex );
1262
- }
1263
- }
1264
- } );
1265
-
1266
- return $.ui.draggable;
1267
-
1268
- } );