activeadmin 3.5.0 → 4.0.0.beta1

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 (339) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +2 -131
  3. data/CONTRIBUTING.md +25 -108
  4. data/README.md +19 -32
  5. data/app/assets/config/active_admin_manifest.js +2 -0
  6. data/app/controllers/active_admin/base_controller/menu.rb +39 -0
  7. data/{lib → app/controllers}/active_admin/base_controller.rb +46 -18
  8. data/{lib → app/controllers}/active_admin/page_controller.rb +0 -4
  9. data/{lib → app/controllers}/active_admin/resource_controller/action_builder.rb +1 -1
  10. data/{lib → app/controllers}/active_admin/resource_controller/data_access.rb +2 -2
  11. data/{lib → app/controllers}/active_admin/resource_controller/decorators.rb +1 -1
  12. data/{lib → app/controllers}/active_admin/resource_controller/scoping.rb +1 -1
  13. data/{lib → app/controllers}/active_admin/resource_controller/streaming.rb +2 -2
  14. data/app/controllers/active_admin/resource_controller.rb +102 -0
  15. data/app/helpers/active_admin/auto_link_helper.rb +66 -0
  16. data/app/helpers/active_admin/breadcrumb_helper.rb +41 -0
  17. data/app/helpers/active_admin/display_helper.rb +117 -0
  18. data/app/helpers/active_admin/form_helper.rb +95 -0
  19. data/app/helpers/active_admin/index_helper.rb +40 -0
  20. data/app/helpers/active_admin/layout_helper.rb +63 -0
  21. data/app/javascript/active_admin/features/batch_actions.js +89 -0
  22. data/app/javascript/active_admin/features/dark_mode_toggle.js +37 -0
  23. data/app/javascript/active_admin/features/filters.js +34 -0
  24. data/app/javascript/active_admin/features/has_many.js +28 -0
  25. data/app/javascript/active_admin/features/main_menu.js +12 -0
  26. data/app/javascript/active_admin/features/per_page.js +9 -0
  27. data/app/javascript/active_admin/utils/dom.js +17 -0
  28. data/app/javascript/active_admin.js +10 -0
  29. data/app/views/active_admin/_flash_messages.html.erb +22 -0
  30. data/app/views/active_admin/_html_head.html.erb +13 -0
  31. data/app/views/active_admin/_main_navigation.html.erb +28 -0
  32. data/app/views/active_admin/_page_header.html.erb +27 -0
  33. data/app/views/active_admin/_sidebar.html.erb +5 -0
  34. data/app/views/active_admin/_site_footer.html.erb +7 -0
  35. data/app/views/active_admin/_site_header.html.erb +30 -0
  36. data/app/views/active_admin/devise/confirmations/new.html.erb +5 -3
  37. data/app/views/active_admin/devise/passwords/edit.html.erb +5 -3
  38. data/app/views/active_admin/devise/passwords/new.html.erb +5 -4
  39. data/app/views/active_admin/devise/registrations/new.html.erb +6 -4
  40. data/app/views/active_admin/devise/sessions/new.html.erb +6 -4
  41. data/app/views/active_admin/devise/shared/_links.erb +3 -1
  42. data/app/views/active_admin/devise/unlocks/new.html.erb +6 -4
  43. data/app/views/{kaminari/active_admin_countless → active_admin/kaminari}/_gap.html.erb +3 -1
  44. data/app/views/active_admin/kaminari/_next_page.html.erb +16 -0
  45. data/app/views/active_admin/kaminari/_page.html.erb +14 -0
  46. data/app/views/{kaminari/active_admin_countless → active_admin/kaminari}/_paginator.html.erb +1 -2
  47. data/app/views/active_admin/kaminari/_prev_page.html.erb +16 -0
  48. data/app/views/active_admin/page/index.html.arb +5 -1
  49. data/app/views/active_admin/resource/_active_filters.html.erb +32 -0
  50. data/app/views/active_admin/resource/_batch_actions_dropdown.html.erb +19 -0
  51. data/app/views/active_admin/resource/_form.html.arb +16 -0
  52. data/app/views/active_admin/resource/_form_default.html.arb +12 -0
  53. data/app/views/active_admin/resource/_index_as_table_default.html.arb +9 -0
  54. data/app/views/active_admin/resource/_index_blank_slate.html.erb +14 -0
  55. data/app/views/active_admin/resource/_index_empty_results.html.erb +5 -0
  56. data/app/views/active_admin/resource/_index_table_actions_default.html.erb +9 -0
  57. data/app/views/active_admin/resource/_show_default.html.arb +3 -0
  58. data/app/views/active_admin/resource/edit.html.arb +1 -1
  59. data/app/views/active_admin/resource/index.html.arb +94 -1
  60. data/app/views/active_admin/resource/new.html.arb +1 -1
  61. data/app/views/active_admin/resource/show.html.arb +12 -1
  62. data/app/views/active_admin/shared/_action_items.html.erb +3 -0
  63. data/app/views/active_admin/shared/_download_format_links.html.erb +7 -0
  64. data/app/views/active_admin/shared/_resource_comments.html.erb +51 -0
  65. data/app/views/active_admin/shared/_sidebar_section.html.arb +7 -0
  66. data/app/views/active_admin/shared/_sidebar_sections.html.erb +5 -0
  67. data/app/views/layouts/active_admin.html.erb +20 -0
  68. data/app/views/layouts/active_admin_logged_out.html.erb +8 -45
  69. data/config/locales/ar.yml +0 -16
  70. data/config/locales/az.yml +0 -16
  71. data/config/locales/bg.yml +0 -9
  72. data/config/locales/bs.yml +0 -7
  73. data/config/locales/ca.yml +0 -9
  74. data/config/locales/cs.yml +0 -9
  75. data/config/locales/da.yml +0 -16
  76. data/config/locales/de-CH.yml +0 -10
  77. data/config/locales/de.yml +0 -16
  78. data/config/locales/el.yml +0 -13
  79. data/config/locales/en-CA.yml +0 -16
  80. data/config/locales/en-GB.yml +0 -16
  81. data/config/locales/en.yml +18 -28
  82. data/config/locales/eo.yml +0 -17
  83. data/config/locales/es-MX.yml +0 -9
  84. data/config/locales/es.yml +0 -16
  85. data/config/locales/fa.yml +0 -9
  86. data/config/locales/fi.yml +0 -9
  87. data/config/locales/fr.yml +32 -26
  88. data/config/locales/he.yml +0 -16
  89. data/config/locales/hr.yml +0 -9
  90. data/config/locales/hu.yml +0 -6
  91. data/config/locales/id.yml +0 -16
  92. data/config/locales/it.yml +0 -16
  93. data/config/locales/ja.yml +0 -16
  94. data/config/locales/ko.yml +0 -9
  95. data/config/locales/lt.yml +0 -16
  96. data/config/locales/lv.yml +0 -6
  97. data/config/locales/mk.yml +0 -15
  98. data/config/locales/nb.yml +0 -12
  99. data/config/locales/nl.yml +21 -29
  100. data/config/locales/pl.yml +0 -16
  101. data/config/locales/pt-BR.yml +0 -16
  102. data/config/locales/pt-PT.yml +0 -6
  103. data/config/locales/ro.yml +0 -6
  104. data/config/locales/ru.yml +0 -16
  105. data/config/locales/sk.yml +0 -16
  106. data/config/locales/sv-SE.yml +0 -16
  107. data/config/locales/tr.yml +0 -16
  108. data/config/locales/uk.yml +0 -16
  109. data/config/locales/vi.yml +0 -16
  110. data/config/locales/zh-CN.yml +0 -16
  111. data/config/locales/zh-TW.yml +0 -16
  112. data/lib/active_admin/application.rb +1 -9
  113. data/lib/active_admin/batch_actions/controller.rb +1 -4
  114. data/lib/active_admin/batch_actions/resource_extension.rb +6 -13
  115. data/lib/active_admin/batch_actions/views/batch_action_form.rb +0 -6
  116. data/lib/active_admin/batch_actions/views/selection_cells.rb +2 -2
  117. data/lib/active_admin/batch_actions.rb +0 -5
  118. data/lib/active_admin/callbacks.rb +6 -4
  119. data/lib/active_admin/component.rb +0 -1
  120. data/lib/active_admin/csv_builder.rb +1 -1
  121. data/lib/active_admin/dependency.rb +1 -1
  122. data/lib/active_admin/devise.rb +3 -3
  123. data/lib/active_admin/dsl.rb +2 -2
  124. data/lib/active_admin/dynamic_settings_node.rb +4 -4
  125. data/lib/active_admin/engine.rb +19 -6
  126. data/lib/active_admin/filters/active.rb +6 -4
  127. data/lib/active_admin/filters/active_filter.rb +1 -3
  128. data/lib/active_admin/filters/forms.rb +1 -42
  129. data/lib/active_admin/filters/resource_extension.rb +17 -9
  130. data/lib/active_admin/filters.rb +0 -2
  131. data/lib/active_admin/form_builder.rb +19 -17
  132. data/lib/active_admin/inputs/filters/base/search_method_select.rb +8 -10
  133. data/lib/active_admin/inputs/filters/base.rb +1 -1
  134. data/lib/active_admin/inputs/filters/check_boxes_input.rb +1 -6
  135. data/lib/active_admin/inputs/filters/date_range_input.rb +4 -2
  136. data/lib/active_admin/inputs/filters/select_input.rb +3 -1
  137. data/lib/active_admin/inputs.rb +0 -3
  138. data/lib/active_admin/menu.rb +10 -7
  139. data/lib/active_admin/menu_collection.rb +1 -1
  140. data/lib/active_admin/menu_item.rb +24 -3
  141. data/lib/active_admin/namespace.rb +2 -44
  142. data/lib/active_admin/namespace_settings.rb +2 -35
  143. data/lib/active_admin/order_clause.rb +4 -1
  144. data/lib/active_admin/orm/active_record/comments/views/active_admin_comments.rb +3 -75
  145. data/lib/active_admin/orm/active_record/comments.rb +10 -5
  146. data/lib/active_admin/pundit_adapter.rb +1 -1
  147. data/lib/active_admin/resource/action_items.rb +15 -20
  148. data/lib/active_admin/resource/attributes.rb +1 -8
  149. data/lib/active_admin/resource/belongs_to.rb +1 -0
  150. data/lib/active_admin/resource/naming.rb +1 -2
  151. data/lib/active_admin/resource.rb +3 -8
  152. data/lib/active_admin/resource_dsl.rb +1 -1
  153. data/lib/active_admin/router.rb +5 -5
  154. data/lib/active_admin/scope.rb +1 -1
  155. data/lib/active_admin/settings_node.rb +1 -1
  156. data/lib/active_admin/sidebar_section.rb +0 -5
  157. data/lib/active_admin/version.rb +1 -1
  158. data/lib/active_admin/view_helpers.rb +0 -12
  159. data/lib/active_admin/views/components/active_admin_form.rb +21 -29
  160. data/lib/active_admin/views/components/attributes_table.rb +4 -12
  161. data/lib/active_admin/views/components/index_list.rb +10 -23
  162. data/lib/active_admin/views/components/paginated_collection.rb +34 -42
  163. data/lib/active_admin/views/components/panel.rb +2 -10
  164. data/lib/active_admin/views/components/scopes.rb +12 -21
  165. data/lib/active_admin/views/components/status_tag.rb +22 -19
  166. data/lib/active_admin/views/components/table_for.rb +19 -24
  167. data/lib/active_admin/views/components/tabs.rb +10 -11
  168. data/lib/active_admin/views/index_as_table.rb +26 -104
  169. data/lib/active_admin.rb +7 -11
  170. data/lib/generators/active_admin/assets/assets_generator.rb +4 -4
  171. data/lib/generators/active_admin/assets/templates/active_admin.css +3 -0
  172. data/lib/generators/active_admin/assets/templates/tailwind.config.js +18 -0
  173. data/lib/generators/active_admin/install/install_generator.rb +2 -8
  174. data/lib/generators/active_admin/install/templates/active_admin.rb.erb +10 -87
  175. data/lib/generators/active_admin/install/templates/dashboard.rb +8 -25
  176. data/lib/generators/active_admin/page/page_generator.rb +0 -1
  177. data/lib/generators/active_admin/resource/resource_generator.rb +46 -7
  178. data/lib/generators/active_admin/resource/templates/resource.rb.erb +42 -0
  179. data/lib/generators/active_admin/views_generator.rb +18 -0
  180. metadata +70 -210
  181. data/app/assets/javascripts/active_admin/base.js +0 -518
  182. data/app/assets/stylesheets/active_admin/_base.scss +0 -57
  183. data/app/assets/stylesheets/active_admin/_forms.scss +0 -315
  184. data/app/assets/stylesheets/active_admin/_header.scss +0 -188
  185. data/app/assets/stylesheets/active_admin/_mixins.scss +0 -1
  186. data/app/assets/stylesheets/active_admin/_normalize.scss +0 -349
  187. data/app/assets/stylesheets/active_admin/_print.scss +0 -287
  188. data/app/assets/stylesheets/active_admin/_typography.scss +0 -100
  189. data/app/assets/stylesheets/active_admin/components/_batch_actions.scss +0 -6
  190. data/app/assets/stylesheets/active_admin/components/_blank_slates.scss +0 -30
  191. data/app/assets/stylesheets/active_admin/components/_breadcrumbs.scss +0 -20
  192. data/app/assets/stylesheets/active_admin/components/_buttons.scss +0 -6
  193. data/app/assets/stylesheets/active_admin/components/_columns.scss +0 -3
  194. data/app/assets/stylesheets/active_admin/components/_comments.scss +0 -41
  195. data/app/assets/stylesheets/active_admin/components/_date_picker.scss +0 -148
  196. data/app/assets/stylesheets/active_admin/components/_dropdown_menu.scss +0 -154
  197. data/app/assets/stylesheets/active_admin/components/_flash_messages.scss +0 -37
  198. data/app/assets/stylesheets/active_admin/components/_grid.scss +0 -9
  199. data/app/assets/stylesheets/active_admin/components/_index_list.scss +0 -12
  200. data/app/assets/stylesheets/active_admin/components/_links.scss +0 -5
  201. data/app/assets/stylesheets/active_admin/components/_modal_dialog.scss +0 -34
  202. data/app/assets/stylesheets/active_admin/components/_pagination.scss +0 -58
  203. data/app/assets/stylesheets/active_admin/components/_panels.scss +0 -6
  204. data/app/assets/stylesheets/active_admin/components/_scopes.scss +0 -13
  205. data/app/assets/stylesheets/active_admin/components/_status_tags.scss +0 -12
  206. data/app/assets/stylesheets/active_admin/components/_table_tools.scss +0 -70
  207. data/app/assets/stylesheets/active_admin/components/_tables.scss +0 -112
  208. data/app/assets/stylesheets/active_admin/components/_tabs.scss +0 -68
  209. data/app/assets/stylesheets/active_admin/components/_unsupported_browser.scss +0 -16
  210. data/app/assets/stylesheets/active_admin/mixins/_all.scss +0 -8
  211. data/app/assets/stylesheets/active_admin/mixins/_buttons.scss +0 -65
  212. data/app/assets/stylesheets/active_admin/mixins/_gradients.scss +0 -28
  213. data/app/assets/stylesheets/active_admin/mixins/_rounded.scss +0 -22
  214. data/app/assets/stylesheets/active_admin/mixins/_sections.scss +0 -41
  215. data/app/assets/stylesheets/active_admin/mixins/_shadows.scss +0 -15
  216. data/app/assets/stylesheets/active_admin/mixins/_typography.scss +0 -3
  217. data/app/assets/stylesheets/active_admin/mixins/_utilities.scss +0 -17
  218. data/app/assets/stylesheets/active_admin/mixins/_variables.scss +0 -51
  219. data/app/assets/stylesheets/active_admin/pages/_logged_out.scss +0 -44
  220. data/app/assets/stylesheets/active_admin/structure/_footer.scss +0 -19
  221. data/app/assets/stylesheets/active_admin/structure/_main_structure.scss +0 -29
  222. data/app/assets/stylesheets/active_admin/structure/_title_bar.scss +0 -43
  223. data/app/javascript/active_admin/base.js +0 -28
  224. data/app/javascript/active_admin/ext/jquery-ui.js +0 -7
  225. data/app/javascript/active_admin/ext/jquery.js +0 -9
  226. data/app/javascript/active_admin/initializers/batch-actions.js +0 -61
  227. data/app/javascript/active_admin/initializers/checkbox-toggler.js +0 -3
  228. data/app/javascript/active_admin/initializers/datepicker.js +0 -19
  229. data/app/javascript/active_admin/initializers/dropdown-menu.js +0 -9
  230. data/app/javascript/active_admin/initializers/filters.js +0 -10
  231. data/app/javascript/active_admin/initializers/has-many.js +0 -98
  232. data/app/javascript/active_admin/initializers/per-page.js +0 -13
  233. data/app/javascript/active_admin/initializers/table-checkbox-toggler.js +0 -3
  234. data/app/javascript/active_admin/initializers/tabs.js +0 -6
  235. data/app/javascript/active_admin/lib/checkbox-toggler.js +0 -49
  236. data/app/javascript/active_admin/lib/dropdown-menu.js +0 -116
  237. data/app/javascript/active_admin/lib/filters.js +0 -39
  238. data/app/javascript/active_admin/lib/modal-dialog.js +0 -63
  239. data/app/javascript/active_admin/lib/per-page.js +0 -38
  240. data/app/javascript/active_admin/lib/table-checkbox-toggler.js +0 -38
  241. data/app/javascript/active_admin/lib/utils.js +0 -40
  242. data/app/views/kaminari/active_admin/_first_page.html.erb +0 -11
  243. data/app/views/kaminari/active_admin/_gap.html.erb +0 -8
  244. data/app/views/kaminari/active_admin/_last_page.html.erb +0 -11
  245. data/app/views/kaminari/active_admin/_next_page.html.erb +0 -11
  246. data/app/views/kaminari/active_admin/_page.html.erb +0 -12
  247. data/app/views/kaminari/active_admin/_paginator.html.erb +0 -25
  248. data/app/views/kaminari/active_admin/_prev_page.html.erb +0 -11
  249. data/app/views/kaminari/active_admin_countless/_first_page.html.erb +0 -11
  250. data/app/views/kaminari/active_admin_countless/_next_page.html.erb +0 -11
  251. data/app/views/kaminari/active_admin_countless/_page.html.erb +0 -12
  252. data/app/views/kaminari/active_admin_countless/_prev_page.html.erb +0 -11
  253. data/app/views/layouts/active_admin.html.arb +0 -2
  254. data/lib/active_admin/abstract_view_factory.rb +0 -48
  255. data/lib/active_admin/asset_registration.rb +0 -30
  256. data/lib/active_admin/base_controller/menu.rb +0 -35
  257. data/lib/active_admin/batch_actions/views/batch_action_selector.rb +0 -59
  258. data/lib/active_admin/filters/active_sidebar.rb +0 -28
  259. data/lib/active_admin/generators/boilerplate.rb +0 -54
  260. data/lib/active_admin/helpers/collection.rb +0 -21
  261. data/lib/active_admin/helpers/i18n.rb +0 -8
  262. data/lib/active_admin/inputs/datepicker_input.rb +0 -28
  263. data/lib/active_admin/inputs/filters/date_picker_input.rb +0 -14
  264. data/lib/active_admin/orm/active_record/comments/show_page_helper.rb +0 -24
  265. data/lib/active_admin/orm/mongoid.rb +0 -2
  266. data/lib/active_admin/resource_controller/sidebars.rb +0 -19
  267. data/lib/active_admin/resource_controller.rb +0 -68
  268. data/lib/active_admin/view_factory.rb +0 -28
  269. data/lib/active_admin/view_helpers/active_admin_application_helper.rb +0 -13
  270. data/lib/active_admin/view_helpers/auto_link_helper.rb +0 -46
  271. data/lib/active_admin/view_helpers/breadcrumb_helper.rb +0 -34
  272. data/lib/active_admin/view_helpers/display_helper.rb +0 -119
  273. data/lib/active_admin/view_helpers/download_format_links_helper.rb +0 -60
  274. data/lib/active_admin/view_helpers/fields_for.rb +0 -51
  275. data/lib/active_admin/view_helpers/flash_helper.rb +0 -15
  276. data/lib/active_admin/view_helpers/form_helper.rb +0 -21
  277. data/lib/active_admin/view_helpers/scope_name_helper.rb +0 -17
  278. data/lib/active_admin/view_helpers/sidebar_helper.rb +0 -16
  279. data/lib/active_admin/view_helpers/title_helper.rb +0 -12
  280. data/lib/active_admin/view_helpers/view_factory_helper.rb +0 -12
  281. data/lib/active_admin/views/action_items.rb +0 -18
  282. data/lib/active_admin/views/components/active_filters_sidebar_content.rb +0 -59
  283. data/lib/active_admin/views/components/blank_slate.rb +0 -18
  284. data/lib/active_admin/views/components/columns.rb +0 -162
  285. data/lib/active_admin/views/components/dropdown_menu.rb +0 -69
  286. data/lib/active_admin/views/components/menu.rb +0 -33
  287. data/lib/active_admin/views/components/menu_item.rb +0 -59
  288. data/lib/active_admin/views/components/sidebar.rb +0 -14
  289. data/lib/active_admin/views/components/sidebar_section.rb +0 -35
  290. data/lib/active_admin/views/components/site_title.rb +0 -55
  291. data/lib/active_admin/views/components/unsupported_browser.rb +0 -12
  292. data/lib/active_admin/views/footer.rb +0 -32
  293. data/lib/active_admin/views/header.rb +0 -20
  294. data/lib/active_admin/views/index_as_block.rb +0 -37
  295. data/lib/active_admin/views/index_as_blog.rb +0 -156
  296. data/lib/active_admin/views/index_as_grid.rb +0 -81
  297. data/lib/active_admin/views/pages/base.rb +0 -134
  298. data/lib/active_admin/views/pages/form.rb +0 -65
  299. data/lib/active_admin/views/pages/index.rb +0 -166
  300. data/lib/active_admin/views/pages/layout.rb +0 -27
  301. data/lib/active_admin/views/pages/page.rb +0 -31
  302. data/lib/active_admin/views/pages/show.rb +0 -60
  303. data/lib/active_admin/views/tabbed_navigation.rb +0 -12
  304. data/lib/active_admin/views/title_bar.rb +0 -56
  305. data/lib/generators/active_admin/assets/templates/active_admin.js +0 -1
  306. data/lib/generators/active_admin/assets/templates/active_admin.scss +0 -17
  307. data/lib/generators/active_admin/resource/templates/admin.rb.erb +0 -46
  308. data/lib/generators/active_admin/webpacker/plugins/jquery.js +0 -7
  309. data/lib/generators/active_admin/webpacker/templates/active_admin.js +0 -5
  310. data/lib/generators/active_admin/webpacker/templates/active_admin.scss +0 -17
  311. data/lib/generators/active_admin/webpacker/templates/print.scss +0 -2
  312. data/lib/generators/active_admin/webpacker/webpacker_generator.rb +0 -27
  313. data/vendor/assets/javascripts/jquery-ui/data.js +0 -39
  314. data/vendor/assets/javascripts/jquery-ui/disable-selection.js +0 -51
  315. data/vendor/assets/javascripts/jquery-ui/focusable.js +0 -79
  316. data/vendor/assets/javascripts/jquery-ui/form-reset-mixin.js +0 -81
  317. data/vendor/assets/javascripts/jquery-ui/keycode.js +0 -51
  318. data/vendor/assets/javascripts/jquery-ui/labels.js +0 -70
  319. data/vendor/assets/javascripts/jquery-ui/plugin.js +0 -49
  320. data/vendor/assets/javascripts/jquery-ui/position.js +0 -513
  321. data/vendor/assets/javascripts/jquery-ui/scroll-parent.js +0 -50
  322. data/vendor/assets/javascripts/jquery-ui/tabbable.js +0 -41
  323. data/vendor/assets/javascripts/jquery-ui/unique-id.js +0 -54
  324. data/vendor/assets/javascripts/jquery-ui/version.js +0 -20
  325. data/vendor/assets/javascripts/jquery-ui/widget.js +0 -761
  326. data/vendor/assets/javascripts/jquery-ui/widgets/button.js +0 -454
  327. data/vendor/assets/javascripts/jquery-ui/widgets/checkboxradio.js +0 -294
  328. data/vendor/assets/javascripts/jquery-ui/widgets/controlgroup.js +0 -304
  329. data/vendor/assets/javascripts/jquery-ui/widgets/datepicker.js +0 -2240
  330. data/vendor/assets/javascripts/jquery-ui/widgets/dialog.js +0 -957
  331. data/vendor/assets/javascripts/jquery-ui/widgets/draggable.js +0 -1264
  332. data/vendor/assets/javascripts/jquery-ui/widgets/mouse.js +0 -226
  333. data/vendor/assets/javascripts/jquery-ui/widgets/resizable.js +0 -1281
  334. data/vendor/assets/javascripts/jquery-ui/widgets/sortable.js +0 -1614
  335. data/vendor/assets/javascripts/jquery-ui/widgets/tabs.js +0 -918
  336. /data/{lib → app/controllers}/active_admin/base_controller/authorization.rb +0 -0
  337. /data/{lib → app/controllers}/active_admin/resource_controller/polymorphic_routes.rb +0 -0
  338. /data/{lib → app/controllers}/active_admin/resource_controller/resource_class_methods.rb +0 -0
  339. /data/lib/{active_admin/orm/mongoid/.gitkeep → generators/active_admin/assets/templates/builds/.keep} +0 -0
@@ -1,1281 +0,0 @@
1
- //= require jquery-ui/widgets/mouse
2
- //= require jquery-ui/disable-selection
3
- //= require jquery-ui/plugin
4
- //= require jquery-ui/version
5
- //= require jquery-ui/widget
6
-
7
- /*!
8
- * jQuery UI Resizable 1.14.2
9
- * https://jqueryui.com
10
- *
11
- * Copyright OpenJS Foundation and other contributors
12
- * Released under the MIT license.
13
- * https://jquery.org/license
14
- */
15
-
16
- //>>label: Resizable
17
- //>>group: Interactions
18
- //>>description: Enables resize functionality for any element.
19
- //>>docs: https://api.jqueryui.com/resizable/
20
- //>>demos: https://jqueryui.com/resizable/
21
- //>>css.structure: ../../themes/base/core.css
22
- //>>css.structure: ../../themes/base/resizable.css
23
- //>>css.theme: ../../themes/base/theme.css
24
-
25
- ( function( factory ) {
26
- "use strict";
27
-
28
- if ( typeof define === "function" && define.amd ) {
29
-
30
- // AMD. Register as an anonymous module.
31
- define( [
32
- "jquery",
33
- "./mouse",
34
- "../disable-selection",
35
- "../plugin",
36
- "../version",
37
- "../widget"
38
- ], factory );
39
- } else {
40
-
41
- // Browser globals
42
- factory( jQuery );
43
- }
44
- } )( function( $ ) {
45
- "use strict";
46
-
47
- $.widget( "ui.resizable", $.ui.mouse, {
48
- version: "1.14.2",
49
- widgetEventPrefix: "resize",
50
- options: {
51
- alsoResize: false,
52
- animate: false,
53
- animateDuration: "slow",
54
- animateEasing: "swing",
55
- aspectRatio: false,
56
- autoHide: false,
57
- classes: {
58
- "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se"
59
- },
60
- containment: false,
61
- ghost: false,
62
- grid: false,
63
- handles: "e,s,se",
64
- helper: false,
65
- maxHeight: null,
66
- maxWidth: null,
67
- minHeight: 10,
68
- minWidth: 10,
69
-
70
- // See #7960
71
- zIndex: 90,
72
-
73
- // Callbacks
74
- resize: null,
75
- start: null,
76
- stop: null
77
- },
78
-
79
- _num: function( value ) {
80
- return parseFloat( value ) || 0;
81
- },
82
-
83
- _isNumber: function( value ) {
84
- return !isNaN( parseFloat( value ) );
85
- },
86
-
87
- _hasScroll: function( el, a ) {
88
-
89
- var scroll,
90
- has = false,
91
- overflow = $( el ).css( "overflow" );
92
-
93
- if ( overflow === "hidden" ) {
94
- return false;
95
- }
96
- if ( overflow === "scroll" ) {
97
- return true;
98
- }
99
-
100
- scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop";
101
-
102
- if ( el[ scroll ] > 0 ) {
103
- return true;
104
- }
105
-
106
- // TODO: determine which cases actually cause this to happen
107
- // if the element doesn't have the scroll set, see if it's possible to
108
- // set the scroll
109
- try {
110
- el[ scroll ] = 1;
111
- has = ( el[ scroll ] > 0 );
112
- el[ scroll ] = 0;
113
- } catch ( _e ) {
114
-
115
- // `el` might be a string, then setting `scroll` will throw
116
- // an error in strict mode; ignore it.
117
- }
118
- return has;
119
- },
120
-
121
- _create: function() {
122
-
123
- var margins,
124
- o = this.options,
125
- that = this;
126
- this._addClass( "ui-resizable" );
127
-
128
- $.extend( this, {
129
- _aspectRatio: !!( o.aspectRatio ),
130
- aspectRatio: o.aspectRatio,
131
- originalElement: this.element,
132
- _proportionallyResizeElements: [],
133
- _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null
134
- } );
135
-
136
- // Wrap the element if it cannot hold child nodes
137
- if ( this.element[ 0 ].nodeName.match( /^(canvas|textarea|input|select|button|img)$/i ) ) {
138
-
139
- this.element.wrap(
140
- $( "<div class='ui-wrapper'></div>" ).css( {
141
- overflow: "hidden",
142
- position: this.element.css( "position" ),
143
- width: this.element.outerWidth(),
144
- height: this.element.outerHeight(),
145
- top: this.element.css( "top" ),
146
- left: this.element.css( "left" )
147
- } )
148
- );
149
-
150
- this.element = this.element.parent().data(
151
- "ui-resizable", this.element.resizable( "instance" )
152
- );
153
-
154
- this.elementIsWrapper = true;
155
-
156
- margins = {
157
- marginTop: this.originalElement.css( "marginTop" ),
158
- marginRight: this.originalElement.css( "marginRight" ),
159
- marginBottom: this.originalElement.css( "marginBottom" ),
160
- marginLeft: this.originalElement.css( "marginLeft" )
161
- };
162
-
163
- this.element.css( margins );
164
-
165
- // Support: Safari
166
- // Prevent Safari textarea resize
167
- this.originalResizeStyle = this.originalElement.css( "resize" );
168
- this.originalElement.css( "resize", "none" );
169
-
170
- this._proportionallyResizeElements.push( this.originalElement.css( {
171
- position: "static",
172
- zoom: 1,
173
- display: "block"
174
- } ) );
175
-
176
- this._proportionallyResize();
177
- }
178
-
179
- this._setupHandles();
180
-
181
- if ( o.autoHide ) {
182
- $( this.element )
183
- .on( "mouseenter", function() {
184
- if ( o.disabled ) {
185
- return;
186
- }
187
- that._removeClass( "ui-resizable-autohide" );
188
- that._handles.show();
189
- } )
190
- .on( "mouseleave", function() {
191
- if ( o.disabled ) {
192
- return;
193
- }
194
- if ( !that.resizing ) {
195
- that._addClass( "ui-resizable-autohide" );
196
- that._handles.hide();
197
- }
198
- } );
199
- }
200
-
201
- this._mouseInit();
202
- },
203
-
204
- _destroy: function() {
205
-
206
- this._mouseDestroy();
207
- this._addedHandles.remove();
208
-
209
- var wrapper,
210
- _destroy = function( exp ) {
211
- $( exp )
212
- .removeData( "resizable" )
213
- .removeData( "ui-resizable" )
214
- .off( ".resizable" );
215
- };
216
-
217
- // TODO: Unwrap at same DOM position
218
- if ( this.elementIsWrapper ) {
219
- _destroy( this.element );
220
- wrapper = this.element;
221
- this.originalElement.css( {
222
- position: wrapper.css( "position" ),
223
- width: wrapper.outerWidth(),
224
- height: wrapper.outerHeight(),
225
- top: wrapper.css( "top" ),
226
- left: wrapper.css( "left" )
227
- } ).insertAfter( wrapper );
228
- wrapper.remove();
229
- }
230
-
231
- this.originalElement.css( "resize", this.originalResizeStyle );
232
- _destroy( this.originalElement );
233
-
234
- return this;
235
- },
236
-
237
- _setOption: function( key, value ) {
238
- this._super( key, value );
239
-
240
- switch ( key ) {
241
- case "handles":
242
- this._removeHandles();
243
- this._setupHandles();
244
- break;
245
- case "aspectRatio":
246
- this._aspectRatio = !!value;
247
- break;
248
- default:
249
- break;
250
- }
251
- },
252
-
253
- _setupHandles: function() {
254
- var o = this.options, handle, i, n, hname, axis, that = this;
255
- this.handles = o.handles ||
256
- ( !$( ".ui-resizable-handle", this.element ).length ?
257
- "e,s,se" : {
258
- n: ".ui-resizable-n",
259
- e: ".ui-resizable-e",
260
- s: ".ui-resizable-s",
261
- w: ".ui-resizable-w",
262
- se: ".ui-resizable-se",
263
- sw: ".ui-resizable-sw",
264
- ne: ".ui-resizable-ne",
265
- nw: ".ui-resizable-nw"
266
- } );
267
-
268
- this._handles = $();
269
- this._addedHandles = $();
270
- if ( this.handles.constructor === String ) {
271
-
272
- if ( this.handles === "all" ) {
273
- this.handles = "n,e,s,w,se,sw,ne,nw";
274
- }
275
-
276
- n = this.handles.split( "," );
277
- this.handles = {};
278
-
279
- for ( i = 0; i < n.length; i++ ) {
280
-
281
- handle = String.prototype.trim.call( n[ i ] );
282
- hname = "ui-resizable-" + handle;
283
- axis = $( "<div>" );
284
- this._addClass( axis, "ui-resizable-handle " + hname );
285
-
286
- axis.css( { zIndex: o.zIndex } );
287
-
288
- this.handles[ handle ] = ".ui-resizable-" + handle;
289
- if ( !this.element.children( this.handles[ handle ] ).length ) {
290
- this.element.append( axis );
291
- this._addedHandles = this._addedHandles.add( axis );
292
- }
293
- }
294
-
295
- }
296
-
297
- this._renderAxis = function( target ) {
298
-
299
- var i, axis, padPos, padWrapper;
300
-
301
- target = target || this.element;
302
-
303
- for ( i in this.handles ) {
304
-
305
- if ( this.handles[ i ].constructor === String ) {
306
- this.handles[ i ] = this.element.children( this.handles[ i ] ).first().show();
307
- } else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) {
308
- this.handles[ i ] = $( this.handles[ i ] );
309
- this._on( this.handles[ i ], { "mousedown": that._mouseDown } );
310
- }
311
-
312
- if ( this.elementIsWrapper &&
313
- this.originalElement[ 0 ]
314
- .nodeName
315
- .match( /^(textarea|input|select|button)$/i ) ) {
316
- axis = $( this.handles[ i ], this.element );
317
-
318
- padWrapper = /sw|ne|nw|se|n|s/.test( i ) ?
319
- axis.outerHeight() :
320
- axis.outerWidth();
321
-
322
- padPos = [ "padding",
323
- /ne|nw|n/.test( i ) ? "Top" :
324
- /se|sw|s/.test( i ) ? "Bottom" :
325
- /^e$/.test( i ) ? "Right" : "Left" ].join( "" );
326
-
327
- target.css( padPos, padWrapper );
328
-
329
- this._proportionallyResize();
330
- }
331
-
332
- this._handles = this._handles.add( this.handles[ i ] );
333
- }
334
- };
335
-
336
- // TODO: make renderAxis a prototype function
337
- this._renderAxis( this.element );
338
-
339
- this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) );
340
- this._handles.disableSelection();
341
-
342
- this._handles.on( "mouseover", function() {
343
- if ( !that.resizing ) {
344
- if ( this.className ) {
345
- axis = this.className.match( /ui-resizable-(se|sw|ne|nw|n|e|s|w)/i );
346
- }
347
- that.axis = axis && axis[ 1 ] ? axis[ 1 ] : "se";
348
- }
349
- } );
350
-
351
- if ( o.autoHide ) {
352
- this._handles.hide();
353
- this._addClass( "ui-resizable-autohide" );
354
- }
355
- },
356
-
357
- _removeHandles: function() {
358
- this._addedHandles.remove();
359
- },
360
-
361
- _mouseCapture: function( event ) {
362
- var i, handle,
363
- capture = false;
364
-
365
- for ( i in this.handles ) {
366
- handle = $( this.handles[ i ] )[ 0 ];
367
- if ( handle === event.target || $.contains( handle, event.target ) ) {
368
- capture = true;
369
- }
370
- }
371
-
372
- return !this.options.disabled && capture;
373
- },
374
-
375
- _mouseStart: function( event ) {
376
-
377
- var curleft, curtop, cursor, calculatedSize,
378
- o = this.options,
379
- el = this.element;
380
-
381
- this.resizing = true;
382
-
383
- this._renderProxy();
384
-
385
- curleft = this._num( this.helper.css( "left" ) );
386
- curtop = this._num( this.helper.css( "top" ) );
387
-
388
- if ( o.containment ) {
389
- curleft += $( o.containment ).scrollLeft() || 0;
390
- curtop += $( o.containment ).scrollTop() || 0;
391
- }
392
-
393
- this.offset = this.helper.offset();
394
- this.position = { left: curleft, top: curtop };
395
-
396
- if ( !this._helper ) {
397
- calculatedSize = this._calculateAdjustedElementDimensions( el );
398
- }
399
-
400
- this.size = this._helper ? {
401
- width: this.helper.width(),
402
- height: this.helper.height()
403
- } : {
404
- width: calculatedSize.width,
405
- height: calculatedSize.height
406
- };
407
-
408
- this.originalSize = this._helper ? {
409
- width: el.outerWidth(),
410
- height: el.outerHeight()
411
- } : {
412
- width: calculatedSize.width,
413
- height: calculatedSize.height
414
- };
415
-
416
- this.sizeDiff = {
417
- width: el.outerWidth() - el.width(),
418
- height: el.outerHeight() - el.height()
419
- };
420
-
421
- this.originalPosition = { left: curleft, top: curtop };
422
- this.originalMousePosition = { left: event.pageX, top: event.pageY };
423
-
424
- this.aspectRatio = ( typeof o.aspectRatio === "number" ) ?
425
- o.aspectRatio :
426
- ( ( this.originalSize.width / this.originalSize.height ) || 1 );
427
-
428
- cursor = $( ".ui-resizable-" + this.axis ).css( "cursor" );
429
- $( "body" ).css( "cursor", cursor === "auto" ? this.axis + "-resize" : cursor );
430
-
431
- this._addClass( "ui-resizable-resizing" );
432
- this._propagate( "start", event );
433
- return true;
434
- },
435
-
436
- _mouseDrag: function( event ) {
437
-
438
- var data, props,
439
- smp = this.originalMousePosition,
440
- a = this.axis,
441
- dx = ( event.pageX - smp.left ) || 0,
442
- dy = ( event.pageY - smp.top ) || 0,
443
- trigger = this._change[ a ];
444
-
445
- this._updatePrevProperties();
446
-
447
- if ( !trigger ) {
448
- return false;
449
- }
450
-
451
- data = trigger.apply( this, [ event, dx, dy ] );
452
-
453
- this._updateVirtualBoundaries( event.shiftKey );
454
- if ( this._aspectRatio || event.shiftKey ) {
455
- data = this._updateRatio( data, event );
456
- }
457
-
458
- data = this._respectSize( data, event );
459
-
460
- this._updateCache( data );
461
-
462
- this._propagate( "resize", event );
463
-
464
- props = this._applyChanges();
465
-
466
- if ( !this._helper && this._proportionallyResizeElements.length ) {
467
- this._proportionallyResize();
468
- }
469
-
470
- if ( !$.isEmptyObject( props ) ) {
471
- this._updatePrevProperties();
472
- this._trigger( "resize", event, this.ui() );
473
- this._applyChanges();
474
- }
475
-
476
- return false;
477
- },
478
-
479
- _mouseStop: function( event ) {
480
-
481
- this.resizing = false;
482
- var pr, ista, soffseth, soffsetw, s, left, top,
483
- o = this.options, that = this;
484
-
485
- if ( this._helper ) {
486
-
487
- pr = this._proportionallyResizeElements;
488
- ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName );
489
- soffseth = ista && this._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height;
490
- soffsetw = ista ? 0 : that.sizeDiff.width;
491
-
492
- s = {
493
- width: ( that.helper.width() - soffsetw ),
494
- height: ( that.helper.height() - soffseth )
495
- };
496
- left = ( parseFloat( that.element.css( "left" ) ) +
497
- ( that.position.left - that.originalPosition.left ) ) || null;
498
- top = ( parseFloat( that.element.css( "top" ) ) +
499
- ( that.position.top - that.originalPosition.top ) ) || null;
500
-
501
- if ( !o.animate ) {
502
- this.element.css( $.extend( s, { top: top, left: left } ) );
503
- }
504
-
505
- that.helper.height( that.size.height );
506
- that.helper.width( that.size.width );
507
-
508
- if ( this._helper && !o.animate ) {
509
- this._proportionallyResize();
510
- }
511
- }
512
-
513
- $( "body" ).css( "cursor", "auto" );
514
-
515
- this._removeClass( "ui-resizable-resizing" );
516
-
517
- this._propagate( "stop", event );
518
-
519
- if ( this._helper ) {
520
- this.helper.remove();
521
- }
522
-
523
- return false;
524
-
525
- },
526
-
527
- _updatePrevProperties: function() {
528
- this.prevPosition = {
529
- top: this.position.top,
530
- left: this.position.left
531
- };
532
- this.prevSize = {
533
- width: this.size.width,
534
- height: this.size.height
535
- };
536
- },
537
-
538
- _applyChanges: function() {
539
- var props = {};
540
-
541
- if ( this.position.top !== this.prevPosition.top ) {
542
- props.top = this.position.top + "px";
543
- }
544
- if ( this.position.left !== this.prevPosition.left ) {
545
- props.left = this.position.left + "px";
546
- }
547
-
548
- this.helper.css( props );
549
-
550
- if ( this.size.width !== this.prevSize.width ) {
551
- props.width = this.size.width + "px";
552
- this.helper.width( props.width );
553
- }
554
- if ( this.size.height !== this.prevSize.height ) {
555
- props.height = this.size.height + "px";
556
- this.helper.height( props.height );
557
- }
558
-
559
- return props;
560
- },
561
-
562
- _updateVirtualBoundaries: function( forceAspectRatio ) {
563
- var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
564
- o = this.options;
565
-
566
- b = {
567
- minWidth: this._isNumber( o.minWidth ) ? o.minWidth : 0,
568
- maxWidth: this._isNumber( o.maxWidth ) ? o.maxWidth : Infinity,
569
- minHeight: this._isNumber( o.minHeight ) ? o.minHeight : 0,
570
- maxHeight: this._isNumber( o.maxHeight ) ? o.maxHeight : Infinity
571
- };
572
-
573
- if ( this._aspectRatio || forceAspectRatio ) {
574
- pMinWidth = b.minHeight * this.aspectRatio;
575
- pMinHeight = b.minWidth / this.aspectRatio;
576
- pMaxWidth = b.maxHeight * this.aspectRatio;
577
- pMaxHeight = b.maxWidth / this.aspectRatio;
578
-
579
- if ( pMinWidth > b.minWidth ) {
580
- b.minWidth = pMinWidth;
581
- }
582
- if ( pMinHeight > b.minHeight ) {
583
- b.minHeight = pMinHeight;
584
- }
585
- if ( pMaxWidth < b.maxWidth ) {
586
- b.maxWidth = pMaxWidth;
587
- }
588
- if ( pMaxHeight < b.maxHeight ) {
589
- b.maxHeight = pMaxHeight;
590
- }
591
- }
592
- this._vBoundaries = b;
593
- },
594
-
595
- _updateCache: function( data ) {
596
- this.offset = this.helper.offset();
597
- if ( this._isNumber( data.left ) ) {
598
- this.position.left = data.left;
599
- }
600
- if ( this._isNumber( data.top ) ) {
601
- this.position.top = data.top;
602
- }
603
- if ( this._isNumber( data.height ) ) {
604
- this.size.height = data.height;
605
- }
606
- if ( this._isNumber( data.width ) ) {
607
- this.size.width = data.width;
608
- }
609
- },
610
-
611
- _updateRatio: function( data ) {
612
-
613
- var cpos = this.position,
614
- csize = this.size,
615
- a = this.axis;
616
-
617
- if ( this._isNumber( data.height ) ) {
618
- data.width = ( data.height * this.aspectRatio );
619
- } else if ( this._isNumber( data.width ) ) {
620
- data.height = ( data.width / this.aspectRatio );
621
- }
622
-
623
- if ( a === "sw" ) {
624
- data.left = cpos.left + ( csize.width - data.width );
625
- data.top = null;
626
- }
627
- if ( a === "nw" ) {
628
- data.top = cpos.top + ( csize.height - data.height );
629
- data.left = cpos.left + ( csize.width - data.width );
630
- }
631
-
632
- return data;
633
- },
634
-
635
- _respectSize: function( data ) {
636
-
637
- var o = this._vBoundaries,
638
- a = this.axis,
639
- ismaxw = this._isNumber( data.width ) && o.maxWidth && ( o.maxWidth < data.width ),
640
- ismaxh = this._isNumber( data.height ) && o.maxHeight && ( o.maxHeight < data.height ),
641
- isminw = this._isNumber( data.width ) && o.minWidth && ( o.minWidth > data.width ),
642
- isminh = this._isNumber( data.height ) && o.minHeight && ( o.minHeight > data.height ),
643
- dw = this.originalPosition.left + this.originalSize.width,
644
- dh = this.originalPosition.top + this.originalSize.height,
645
- cw = /sw|nw|w/.test( a ), ch = /nw|ne|n/.test( a );
646
- if ( isminw ) {
647
- data.width = o.minWidth;
648
- }
649
- if ( isminh ) {
650
- data.height = o.minHeight;
651
- }
652
- if ( ismaxw ) {
653
- data.width = o.maxWidth;
654
- }
655
- if ( ismaxh ) {
656
- data.height = o.maxHeight;
657
- }
658
-
659
- if ( isminw && cw ) {
660
- data.left = dw - o.minWidth;
661
- }
662
- if ( ismaxw && cw ) {
663
- data.left = dw - o.maxWidth;
664
- }
665
- if ( isminh && ch ) {
666
- data.top = dh - o.minHeight;
667
- }
668
- if ( ismaxh && ch ) {
669
- data.top = dh - o.maxHeight;
670
- }
671
-
672
- // Fixing jump error on top/left - bug #2330
673
- if ( !data.width && !data.height && !data.left && data.top ) {
674
- data.top = null;
675
- } else if ( !data.width && !data.height && !data.top && data.left ) {
676
- data.left = null;
677
- }
678
-
679
- return data;
680
- },
681
-
682
- _getPaddingPlusBorderDimensions: function( element ) {
683
- var i = 0,
684
- widths = [],
685
- borders = [
686
- element.css( "borderTopWidth" ),
687
- element.css( "borderRightWidth" ),
688
- element.css( "borderBottomWidth" ),
689
- element.css( "borderLeftWidth" )
690
- ],
691
- paddings = [
692
- element.css( "paddingTop" ),
693
- element.css( "paddingRight" ),
694
- element.css( "paddingBottom" ),
695
- element.css( "paddingLeft" )
696
- ];
697
-
698
- for ( ; i < 4; i++ ) {
699
- widths[ i ] = ( parseFloat( borders[ i ] ) || 0 );
700
- widths[ i ] += ( parseFloat( paddings[ i ] ) || 0 );
701
- }
702
-
703
- return {
704
- height: widths[ 0 ] + widths[ 2 ],
705
- width: widths[ 1 ] + widths[ 3 ]
706
- };
707
- },
708
-
709
- _calculateAdjustedElementDimensions: function( element ) {
710
- var elWidth, elHeight, paddingBorder,
711
- ce = element.get( 0 );
712
-
713
- if ( element.css( "box-sizing" ) !== "content-box" ||
714
- ( !this._hasScroll( ce ) && !this._hasScroll( ce, "left" ) ) ) {
715
- return {
716
- height: parseFloat( element.css( "height" ) ),
717
- width: parseFloat( element.css( "width" ) )
718
- };
719
- }
720
-
721
- // Check if CSS inline styles are set and use those (usually from previous resizes)
722
- elWidth = parseFloat( ce.style.width );
723
- elHeight = parseFloat( ce.style.height );
724
-
725
- paddingBorder = this._getPaddingPlusBorderDimensions( element );
726
- elWidth = isNaN( elWidth ) ?
727
- this._getElementTheoreticalSize( element, paddingBorder, "width" ) :
728
- elWidth;
729
- elHeight = isNaN( elHeight ) ?
730
- this._getElementTheoreticalSize( element, paddingBorder, "height" ) :
731
- elHeight;
732
-
733
- return {
734
- height: elHeight,
735
- width: elWidth
736
- };
737
- },
738
-
739
- _getElementTheoreticalSize: function( element, extraSize, dimension ) {
740
-
741
- // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
742
- var size = Math.max( 0, Math.ceil(
743
- element.get( 0 )[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
744
- extraSize[ dimension ] -
745
- 0.5
746
-
747
- // If offsetWidth/offsetHeight is unknown, then we can't determine theoretical size.
748
- // Use an explicit zero to avoid NaN.
749
- // See https://github.com/jquery/jquery/issues/3964
750
- ) ) || 0;
751
-
752
- return size;
753
- },
754
-
755
- _proportionallyResize: function() {
756
-
757
- if ( !this._proportionallyResizeElements.length ) {
758
- return;
759
- }
760
-
761
- var prel,
762
- i = 0,
763
- element = this.helper || this.element;
764
-
765
- for ( ; i < this._proportionallyResizeElements.length; i++ ) {
766
-
767
- prel = this._proportionallyResizeElements[ i ];
768
-
769
- // TODO: Seems like a bug to cache this.outerDimensions
770
- // considering that we are in a loop.
771
- if ( !this.outerDimensions ) {
772
- this.outerDimensions = this._getPaddingPlusBorderDimensions( prel );
773
- }
774
-
775
- prel.css( {
776
- height: ( element.height() - this.outerDimensions.height ) || 0,
777
- width: ( element.width() - this.outerDimensions.width ) || 0
778
- } );
779
-
780
- }
781
-
782
- },
783
-
784
- _renderProxy: function() {
785
-
786
- var el = this.element, o = this.options;
787
- this.elementOffset = el.offset();
788
-
789
- if ( this._helper ) {
790
-
791
- this.helper = this.helper || $( "<div></div>" ).css( { overflow: "hidden" } );
792
-
793
- this._addClass( this.helper, this._helper );
794
- this.helper.css( {
795
- width: this.element.outerWidth(),
796
- height: this.element.outerHeight(),
797
- position: "absolute",
798
- left: this.elementOffset.left + "px",
799
- top: this.elementOffset.top + "px",
800
- zIndex: ++o.zIndex //TODO: Don't modify option
801
- } );
802
-
803
- this.helper
804
- .appendTo( "body" )
805
- .disableSelection();
806
-
807
- } else {
808
- this.helper = this.element;
809
- }
810
-
811
- },
812
-
813
- _change: {
814
- e: function( event, dx ) {
815
- return { width: this.originalSize.width + dx };
816
- },
817
- w: function( event, dx ) {
818
- var cs = this.originalSize, sp = this.originalPosition;
819
- return { left: sp.left + dx, width: cs.width - dx };
820
- },
821
- n: function( event, dx, dy ) {
822
- var cs = this.originalSize, sp = this.originalPosition;
823
- return { top: sp.top + dy, height: cs.height - dy };
824
- },
825
- s: function( event, dx, dy ) {
826
- return { height: this.originalSize.height + dy };
827
- },
828
- se: function( event, dx, dy ) {
829
- return $.extend( this._change.s.apply( this, arguments ),
830
- this._change.e.apply( this, [ event, dx, dy ] ) );
831
- },
832
- sw: function( event, dx, dy ) {
833
- return $.extend( this._change.s.apply( this, arguments ),
834
- this._change.w.apply( this, [ event, dx, dy ] ) );
835
- },
836
- ne: function( event, dx, dy ) {
837
- return $.extend( this._change.n.apply( this, arguments ),
838
- this._change.e.apply( this, [ event, dx, dy ] ) );
839
- },
840
- nw: function( event, dx, dy ) {
841
- return $.extend( this._change.n.apply( this, arguments ),
842
- this._change.w.apply( this, [ event, dx, dy ] ) );
843
- }
844
- },
845
-
846
- _propagate: function( n, event ) {
847
- $.ui.plugin.call( this, n, [ event, this.ui() ] );
848
- if ( n !== "resize" ) {
849
- this._trigger( n, event, this.ui() );
850
- }
851
- },
852
-
853
- plugins: {},
854
-
855
- ui: function() {
856
- return {
857
- originalElement: this.originalElement,
858
- element: this.element,
859
- helper: this.helper,
860
- position: this.position,
861
- size: this.size,
862
- originalSize: this.originalSize,
863
- originalPosition: this.originalPosition
864
- };
865
- }
866
-
867
- } );
868
-
869
- /*
870
- * Resizable Extensions
871
- */
872
-
873
- $.ui.plugin.add( "resizable", "animate", {
874
-
875
- stop: function( event ) {
876
- var that = $( this ).resizable( "instance" ),
877
- o = that.options,
878
- pr = that._proportionallyResizeElements,
879
- ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ),
880
- soffseth = ista && that._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height,
881
- soffsetw = ista ? 0 : that.sizeDiff.width,
882
- style = {
883
- width: ( that.size.width - soffsetw ),
884
- height: ( that.size.height - soffseth )
885
- },
886
- left = ( parseFloat( that.element.css( "left" ) ) +
887
- ( that.position.left - that.originalPosition.left ) ) || null,
888
- top = ( parseFloat( that.element.css( "top" ) ) +
889
- ( that.position.top - that.originalPosition.top ) ) || null;
890
-
891
- that.element.animate(
892
- $.extend( style, top && left ? { top: top, left: left } : {} ), {
893
- duration: o.animateDuration,
894
- easing: o.animateEasing,
895
- step: function() {
896
-
897
- var data = {
898
- width: parseFloat( that.element.css( "width" ) ),
899
- height: parseFloat( that.element.css( "height" ) ),
900
- top: parseFloat( that.element.css( "top" ) ),
901
- left: parseFloat( that.element.css( "left" ) )
902
- };
903
-
904
- if ( pr && pr.length ) {
905
- $( pr[ 0 ] ).css( { width: data.width, height: data.height } );
906
- }
907
-
908
- // Propagating resize, and updating values for each animation step
909
- that._updateCache( data );
910
- that._propagate( "resize", event );
911
-
912
- }
913
- }
914
- );
915
- }
916
-
917
- } );
918
-
919
- $.ui.plugin.add( "resizable", "containment", {
920
-
921
- start: function() {
922
- var element, p, co, ch, cw, width, height,
923
- that = $( this ).resizable( "instance" ),
924
- o = that.options,
925
- el = that.element,
926
- oc = o.containment,
927
- ce = ( oc instanceof $ ) ?
928
- oc.get( 0 ) :
929
- ( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc;
930
-
931
- if ( !ce ) {
932
- return;
933
- }
934
-
935
- that.containerElement = $( ce );
936
-
937
- if ( /document/.test( oc ) || oc === document ) {
938
- that.containerOffset = {
939
- left: 0,
940
- top: 0
941
- };
942
- that.containerPosition = {
943
- left: 0,
944
- top: 0
945
- };
946
-
947
- that.parentData = {
948
- element: $( document ),
949
- left: 0,
950
- top: 0,
951
- width: $( document ).width(),
952
- height: $( document ).height() || document.body.parentNode.scrollHeight
953
- };
954
- } else {
955
- element = $( ce );
956
- p = [];
957
- $( [ "Top", "Right", "Left", "Bottom" ] ).each( function( i, name ) {
958
- p[ i ] = that._num( element.css( "padding" + name ) );
959
- } );
960
-
961
- that.containerOffset = element.offset();
962
- that.containerPosition = element.position();
963
- that.containerSize = {
964
- height: ( element.innerHeight() - p[ 3 ] ),
965
- width: ( element.innerWidth() - p[ 1 ] )
966
- };
967
-
968
- co = that.containerOffset;
969
- ch = that.containerSize.height;
970
- cw = that.containerSize.width;
971
- width = ( that._hasScroll( ce, "left" ) ? ce.scrollWidth : cw );
972
- height = ( that._hasScroll( ce ) ? ce.scrollHeight : ch );
973
-
974
- that.parentData = {
975
- element: ce,
976
- left: co.left,
977
- top: co.top,
978
- width: width,
979
- height: height
980
- };
981
- }
982
- },
983
-
984
- resize: function( event ) {
985
- var woset, hoset, isParent, isOffsetRelative,
986
- that = $( this ).resizable( "instance" ),
987
- o = that.options,
988
- co = that.containerOffset,
989
- cp = that.position,
990
- pRatio = that._aspectRatio || event.shiftKey,
991
- cop = {
992
- top: 0,
993
- left: 0
994
- },
995
- ce = that.containerElement,
996
- continueResize = true;
997
-
998
- if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) {
999
- cop = co;
1000
- }
1001
-
1002
- if ( cp.left < ( that._helper ? co.left : 0 ) ) {
1003
- that.size.width = that.size.width +
1004
- ( that._helper ?
1005
- ( that.position.left - co.left ) :
1006
- ( that.position.left - cop.left ) );
1007
-
1008
- if ( pRatio ) {
1009
- that.size.height = that.size.width / that.aspectRatio;
1010
- continueResize = false;
1011
- }
1012
- that.position.left = o.helper ? co.left : 0;
1013
- }
1014
-
1015
- if ( cp.top < ( that._helper ? co.top : 0 ) ) {
1016
- that.size.height = that.size.height +
1017
- ( that._helper ?
1018
- ( that.position.top - co.top ) :
1019
- that.position.top );
1020
-
1021
- if ( pRatio ) {
1022
- that.size.width = that.size.height * that.aspectRatio;
1023
- continueResize = false;
1024
- }
1025
- that.position.top = that._helper ? co.top : 0;
1026
- }
1027
-
1028
- isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 );
1029
- isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) );
1030
-
1031
- if ( isParent && isOffsetRelative ) {
1032
- that.offset.left = that.parentData.left + that.position.left;
1033
- that.offset.top = that.parentData.top + that.position.top;
1034
- } else {
1035
- that.offset.left = that.element.offset().left;
1036
- that.offset.top = that.element.offset().top;
1037
- }
1038
-
1039
- woset = Math.abs( that.sizeDiff.width +
1040
- ( that._helper ?
1041
- that.offset.left - cop.left :
1042
- ( that.offset.left - co.left ) ) );
1043
-
1044
- hoset = Math.abs( that.sizeDiff.height +
1045
- ( that._helper ?
1046
- that.offset.top - cop.top :
1047
- ( that.offset.top - co.top ) ) );
1048
-
1049
- if ( woset + that.size.width >= that.parentData.width ) {
1050
- that.size.width = that.parentData.width - woset;
1051
- if ( pRatio ) {
1052
- that.size.height = that.size.width / that.aspectRatio;
1053
- continueResize = false;
1054
- }
1055
- }
1056
-
1057
- if ( hoset + that.size.height >= that.parentData.height ) {
1058
- that.size.height = that.parentData.height - hoset;
1059
- if ( pRatio ) {
1060
- that.size.width = that.size.height * that.aspectRatio;
1061
- continueResize = false;
1062
- }
1063
- }
1064
-
1065
- if ( !continueResize ) {
1066
- that.position.left = that.prevPosition.left;
1067
- that.position.top = that.prevPosition.top;
1068
- that.size.width = that.prevSize.width;
1069
- that.size.height = that.prevSize.height;
1070
- }
1071
- },
1072
-
1073
- stop: function() {
1074
- var that = $( this ).resizable( "instance" ),
1075
- o = that.options,
1076
- co = that.containerOffset,
1077
- cop = that.containerPosition,
1078
- ce = that.containerElement,
1079
- helper = $( that.helper ),
1080
- ho = helper.offset(),
1081
- w = helper.outerWidth() - that.sizeDiff.width,
1082
- h = helper.outerHeight() - that.sizeDiff.height;
1083
-
1084
- if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) {
1085
- $( this ).css( {
1086
- left: ho.left - cop.left - co.left,
1087
- width: w,
1088
- height: h
1089
- } );
1090
- }
1091
-
1092
- if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) {
1093
- $( this ).css( {
1094
- left: ho.left - cop.left - co.left,
1095
- width: w,
1096
- height: h
1097
- } );
1098
- }
1099
- }
1100
- } );
1101
-
1102
- $.ui.plugin.add( "resizable", "alsoResize", {
1103
-
1104
- start: function() {
1105
- var that = $( this ).resizable( "instance" ),
1106
- o = that.options;
1107
-
1108
- $( o.alsoResize ).each( function() {
1109
- var el = $( this ),
1110
- elSize = that._calculateAdjustedElementDimensions( el );
1111
-
1112
- el.data( "ui-resizable-alsoresize", {
1113
- width: elSize.width, height: elSize.height,
1114
- left: parseFloat( el.css( "left" ) ), top: parseFloat( el.css( "top" ) )
1115
- } );
1116
- } );
1117
- },
1118
-
1119
- resize: function( event, ui ) {
1120
- var that = $( this ).resizable( "instance" ),
1121
- o = that.options,
1122
- os = that.originalSize,
1123
- op = that.originalPosition,
1124
- delta = {
1125
- height: ( that.size.height - os.height ) || 0,
1126
- width: ( that.size.width - os.width ) || 0,
1127
- top: ( that.position.top - op.top ) || 0,
1128
- left: ( that.position.left - op.left ) || 0
1129
- };
1130
-
1131
- $( o.alsoResize ).each( function() {
1132
- var el = $( this ), start = $( this ).data( "ui-resizable-alsoresize" ), style = {},
1133
- css = el.parents( ui.originalElement[ 0 ] ).length ?
1134
- [ "width", "height" ] :
1135
- [ "width", "height", "top", "left" ];
1136
-
1137
- $.each( css, function( i, prop ) {
1138
- var sum = ( start[ prop ] || 0 ) + ( delta[ prop ] || 0 );
1139
- if ( sum && sum >= 0 ) {
1140
- style[ prop ] = sum || null;
1141
- }
1142
- } );
1143
-
1144
- el.css( style );
1145
- } );
1146
- },
1147
-
1148
- stop: function() {
1149
- $( this ).removeData( "ui-resizable-alsoresize" );
1150
- }
1151
- } );
1152
-
1153
- $.ui.plugin.add( "resizable", "ghost", {
1154
-
1155
- start: function() {
1156
-
1157
- var that = $( this ).resizable( "instance" ), cs = that.size;
1158
-
1159
- that.ghost = that.originalElement.clone();
1160
- that.ghost.css( {
1161
- opacity: 0.25,
1162
- display: "block",
1163
- position: "relative",
1164
- height: cs.height,
1165
- width: cs.width,
1166
- margin: 0,
1167
- left: 0,
1168
- top: 0
1169
- } );
1170
-
1171
- that._addClass( that.ghost, "ui-resizable-ghost" );
1172
-
1173
- // DEPRECATED
1174
- // TODO: remove after 1.12
1175
- if ( $.uiBackCompat === true && typeof that.options.ghost === "string" ) {
1176
-
1177
- // Ghost option
1178
- that.ghost.addClass( this.options.ghost );
1179
- }
1180
-
1181
- that.ghost.appendTo( that.helper );
1182
-
1183
- },
1184
-
1185
- resize: function() {
1186
- var that = $( this ).resizable( "instance" );
1187
- if ( that.ghost ) {
1188
- that.ghost.css( {
1189
- position: "relative",
1190
- height: that.size.height,
1191
- width: that.size.width
1192
- } );
1193
- }
1194
- },
1195
-
1196
- stop: function() {
1197
- var that = $( this ).resizable( "instance" );
1198
- if ( that.ghost && that.helper ) {
1199
- that.helper.get( 0 ).removeChild( that.ghost.get( 0 ) );
1200
- }
1201
- }
1202
-
1203
- } );
1204
-
1205
- $.ui.plugin.add( "resizable", "grid", {
1206
-
1207
- resize: function() {
1208
- var outerDimensions,
1209
- that = $( this ).resizable( "instance" ),
1210
- o = that.options,
1211
- cs = that.size,
1212
- os = that.originalSize,
1213
- op = that.originalPosition,
1214
- a = that.axis,
1215
- grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid,
1216
- gridX = ( grid[ 0 ] || 1 ),
1217
- gridY = ( grid[ 1 ] || 1 ),
1218
- ox = Math.round( ( cs.width - os.width ) / gridX ) * gridX,
1219
- oy = Math.round( ( cs.height - os.height ) / gridY ) * gridY,
1220
- newWidth = os.width + ox,
1221
- newHeight = os.height + oy,
1222
- isMaxWidth = o.maxWidth && ( o.maxWidth < newWidth ),
1223
- isMaxHeight = o.maxHeight && ( o.maxHeight < newHeight ),
1224
- isMinWidth = o.minWidth && ( o.minWidth > newWidth ),
1225
- isMinHeight = o.minHeight && ( o.minHeight > newHeight );
1226
-
1227
- o.grid = grid;
1228
-
1229
- if ( isMinWidth ) {
1230
- newWidth += gridX;
1231
- }
1232
- if ( isMinHeight ) {
1233
- newHeight += gridY;
1234
- }
1235
- if ( isMaxWidth ) {
1236
- newWidth -= gridX;
1237
- }
1238
- if ( isMaxHeight ) {
1239
- newHeight -= gridY;
1240
- }
1241
-
1242
- if ( /^(se|s|e)$/.test( a ) ) {
1243
- that.size.width = newWidth;
1244
- that.size.height = newHeight;
1245
- } else if ( /^(ne)$/.test( a ) ) {
1246
- that.size.width = newWidth;
1247
- that.size.height = newHeight;
1248
- that.position.top = op.top - oy;
1249
- } else if ( /^(sw)$/.test( a ) ) {
1250
- that.size.width = newWidth;
1251
- that.size.height = newHeight;
1252
- that.position.left = op.left - ox;
1253
- } else {
1254
- if ( newHeight - gridY <= 0 || newWidth - gridX <= 0 ) {
1255
- outerDimensions = that._getPaddingPlusBorderDimensions( this );
1256
- }
1257
-
1258
- if ( newHeight - gridY > 0 ) {
1259
- that.size.height = newHeight;
1260
- that.position.top = op.top - oy;
1261
- } else {
1262
- newHeight = gridY - outerDimensions.height;
1263
- that.size.height = newHeight;
1264
- that.position.top = op.top + os.height - newHeight;
1265
- }
1266
- if ( newWidth - gridX > 0 ) {
1267
- that.size.width = newWidth;
1268
- that.position.left = op.left - ox;
1269
- } else {
1270
- newWidth = gridX - outerDimensions.width;
1271
- that.size.width = newWidth;
1272
- that.position.left = op.left + os.width - newWidth;
1273
- }
1274
- }
1275
- }
1276
-
1277
- } );
1278
-
1279
- return $.ui.resizable;
1280
-
1281
- } );