rails_admin 2.3.1 → 3.0.0.beta

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rails_admin might be problematic. Click here for more details.

Files changed (329) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +9 -11
  3. data/README.md +37 -31
  4. data/Rakefile +2 -2
  5. data/app/assets/javascripts/rails_admin.js +21 -0
  6. data/app/assets/stylesheets/rails_admin/custom/mixins.scss +1 -1
  7. data/app/assets/stylesheets/rails_admin/custom/variables.scss +1 -1
  8. data/app/assets/stylesheets/rails_admin.scss.erb +76 -0
  9. data/app/controllers/rails_admin/application_controller.rb +4 -3
  10. data/app/controllers/rails_admin/main_controller.rb +43 -24
  11. data/app/helpers/rails_admin/application_helper.rb +69 -52
  12. data/app/helpers/rails_admin/form_builder.rb +5 -4
  13. data/app/helpers/rails_admin/main_helper.rb +27 -43
  14. data/app/views/kaminari/ra-twitter-bootstrap/_gap.html.erb +5 -0
  15. data/app/views/kaminari/ra-twitter-bootstrap/_next_page.html.erb +9 -0
  16. data/app/views/kaminari/ra-twitter-bootstrap/_page.html.erb +9 -0
  17. data/app/views/kaminari/ra-twitter-bootstrap/_paginator.html.erb +13 -0
  18. data/app/views/kaminari/ra-twitter-bootstrap/_prev_page.html.erb +9 -0
  19. data/app/views/kaminari/ra-twitter-bootstrap/without_count/_next_page.html.erb +9 -0
  20. data/app/views/kaminari/ra-twitter-bootstrap/without_count/_paginator.html.erb +6 -0
  21. data/app/views/kaminari/ra-twitter-bootstrap/without_count/_prev_page.html.erb +9 -0
  22. data/app/views/layouts/rails_admin/_head.html.erb +17 -0
  23. data/app/views/layouts/rails_admin/_navigation.html.erb +21 -0
  24. data/app/views/layouts/rails_admin/_secondary_navigation.html.erb +24 -0
  25. data/app/views/layouts/rails_admin/_sidebar_navigation.html.erb +9 -0
  26. data/app/views/layouts/rails_admin/application.html.erb +27 -0
  27. data/app/views/layouts/rails_admin/modal.js.erb +7 -0
  28. data/app/views/layouts/rails_admin/pjax.html.erb +20 -0
  29. data/app/views/rails_admin/main/_dashboard_history.html.erb +45 -0
  30. data/app/views/rails_admin/main/_delete_notice.html.erb +35 -0
  31. data/app/views/rails_admin/main/_form_action_text.html.erb +7 -0
  32. data/app/views/rails_admin/main/_form_boolean.html.erb +16 -0
  33. data/app/views/rails_admin/main/{_form_ck_editor.html.haml → _form_ck_editor.html.erb} +3 -3
  34. data/app/views/rails_admin/main/_form_code_mirror.html.erb +9 -0
  35. data/app/views/rails_admin/main/_form_colorpicker.html.erb +1 -0
  36. data/app/views/rails_admin/main/_form_datetime.html.erb +9 -0
  37. data/app/views/rails_admin/main/_form_enumeration.html.erb +21 -0
  38. data/app/views/rails_admin/main/_form_field.html.erb +1 -0
  39. data/app/views/rails_admin/main/_form_file_upload.html.erb +17 -0
  40. data/app/views/rails_admin/main/{_form_filtering_multiselect.html.haml → _form_filtering_multiselect.html.erb} +11 -11
  41. data/app/views/rails_admin/main/{_form_filtering_select.html.haml → _form_filtering_select.html.erb} +13 -12
  42. data/app/views/rails_admin/main/_form_froala.html.erb +8 -0
  43. data/app/views/rails_admin/main/_form_multiple_file_upload.html.erb +20 -0
  44. data/app/views/rails_admin/main/_form_nested_many.html.erb +21 -0
  45. data/app/views/rails_admin/main/_form_nested_one.html.erb +21 -0
  46. data/app/views/rails_admin/main/_form_polymorphic_association.html.erb +27 -0
  47. data/app/views/rails_admin/main/_form_simple_mde.html.erb +8 -0
  48. data/app/views/rails_admin/main/_form_text.html.erb +1 -0
  49. data/app/views/rails_admin/main/_form_wysihtml5.html.erb +8 -0
  50. data/app/views/rails_admin/main/_submit_buttons.html.erb +25 -0
  51. data/app/views/rails_admin/main/bulk_delete.html.erb +19 -0
  52. data/app/views/rails_admin/main/dashboard.html.erb +64 -0
  53. data/app/views/rails_admin/main/delete.html.erb +21 -0
  54. data/app/views/rails_admin/main/edit.html.erb +3 -0
  55. data/app/views/rails_admin/main/export.html.erb +146 -0
  56. data/app/views/rails_admin/main/history.html.erb +78 -0
  57. data/app/views/rails_admin/main/index.html.erb +193 -0
  58. data/app/views/rails_admin/main/new.html.erb +3 -0
  59. data/app/views/rails_admin/main/show.html.erb +28 -0
  60. data/config/initializers/active_record_extensions.rb +3 -1
  61. data/config/initializers/mongoid_extensions.rb +1 -1
  62. data/config/locales/rails_admin.en.yml +5 -1
  63. data/lib/generators/rails_admin/install_generator.rb +51 -3
  64. data/lib/generators/rails_admin/templates/environment.js +6 -0
  65. data/lib/generators/rails_admin/templates/initializer.erb +2 -1
  66. data/lib/generators/rails_admin/templates/rails_admin.js.erb +2 -0
  67. data/lib/generators/rails_admin/templates/rails_admin.scss +1 -0
  68. data/lib/generators/rails_admin/templates/webpack.config.js +32 -0
  69. data/lib/rails_admin/abstract_model.rb +24 -10
  70. data/lib/rails_admin/adapters/active_record/association.rb +20 -1
  71. data/lib/rails_admin/adapters/active_record/object_extension.rb +29 -0
  72. data/lib/rails_admin/adapters/active_record/property.rb +1 -1
  73. data/lib/rails_admin/adapters/active_record.rb +19 -21
  74. data/lib/rails_admin/adapters/mongoid/association.rb +38 -9
  75. data/lib/rails_admin/adapters/mongoid/bson.rb +4 -5
  76. data/lib/rails_admin/adapters/mongoid/extension.rb +3 -1
  77. data/lib/rails_admin/adapters/mongoid/object_extension.rb +32 -0
  78. data/lib/rails_admin/adapters/mongoid/property.rb +2 -2
  79. data/lib/rails_admin/adapters/mongoid.rb +25 -19
  80. data/lib/rails_admin/config/actions/base.rb +7 -2
  81. data/lib/rails_admin/config/actions/bulk_delete.rb +2 -2
  82. data/lib/rails_admin/config/actions/dashboard.rb +4 -3
  83. data/lib/rails_admin/config/actions/delete.rb +5 -9
  84. data/lib/rails_admin/config/actions/edit.rb +7 -7
  85. data/lib/rails_admin/config/actions/export.rb +2 -2
  86. data/lib/rails_admin/config/actions/history_index.rb +2 -2
  87. data/lib/rails_admin/config/actions/history_show.rb +2 -2
  88. data/lib/rails_admin/config/actions/index.rb +5 -7
  89. data/lib/rails_admin/config/actions/new.rb +9 -9
  90. data/lib/rails_admin/config/actions/show.rb +1 -1
  91. data/lib/rails_admin/config/actions/show_in_app.rb +6 -2
  92. data/lib/rails_admin/config/actions.rb +4 -4
  93. data/lib/rails_admin/config/configurable.rb +2 -2
  94. data/lib/rails_admin/config/fields/association.rb +15 -12
  95. data/lib/rails_admin/config/fields/base.rb +44 -24
  96. data/lib/rails_admin/config/fields/factories/active_storage.rb +1 -0
  97. data/lib/rails_admin/config/fields/factories/association.rb +6 -8
  98. data/lib/rails_admin/config/fields/factories/carrierwave.rb +2 -1
  99. data/lib/rails_admin/config/fields/factories/devise.rb +2 -1
  100. data/lib/rails_admin/config/fields/factories/dragonfly.rb +2 -1
  101. data/lib/rails_admin/config/fields/factories/paperclip.rb +2 -1
  102. data/lib/rails_admin/config/fields/factories/shrine.rb +1 -1
  103. data/lib/rails_admin/config/fields/group.rb +1 -2
  104. data/lib/rails_admin/config/fields/types/active_record_enum.rb +2 -0
  105. data/lib/rails_admin/config/fields/types/active_storage.rb +9 -7
  106. data/lib/rails_admin/config/fields/types/all.rb +1 -0
  107. data/lib/rails_admin/config/fields/types/belongs_to_association.rb +4 -12
  108. data/lib/rails_admin/config/fields/types/boolean.rb +32 -8
  109. data/lib/rails_admin/config/fields/types/carrierwave.rb +1 -0
  110. data/lib/rails_admin/config/fields/types/citext.rb +13 -0
  111. data/lib/rails_admin/config/fields/types/color.rb +6 -2
  112. data/lib/rails_admin/config/fields/types/date.rb +5 -8
  113. data/lib/rails_admin/config/fields/types/datetime.rb +18 -21
  114. data/lib/rails_admin/config/fields/types/decimal.rb +9 -2
  115. data/lib/rails_admin/config/fields/types/dragonfly.rb +3 -1
  116. data/lib/rails_admin/config/fields/types/enum.rb +1 -1
  117. data/lib/rails_admin/config/fields/types/file_upload.rb +4 -3
  118. data/lib/rails_admin/config/fields/types/float.rb +9 -2
  119. data/lib/rails_admin/config/fields/types/has_many_association.rb +1 -5
  120. data/lib/rails_admin/config/fields/types/has_one_association.rb +1 -13
  121. data/lib/rails_admin/config/fields/types/integer.rb +2 -6
  122. data/lib/rails_admin/config/fields/types/multiple_active_storage.rb +8 -6
  123. data/lib/rails_admin/config/fields/types/multiple_carrierwave.rb +1 -0
  124. data/lib/rails_admin/config/fields/types/multiple_file_upload.rb +4 -3
  125. data/lib/rails_admin/config/fields/types/numeric.rb +18 -0
  126. data/lib/rails_admin/config/fields/types/polymorphic_association.rb +3 -2
  127. data/lib/rails_admin/config/fields/types/string.rb +1 -1
  128. data/lib/rails_admin/config/fields/types/time.rb +1 -4
  129. data/lib/rails_admin/config/fields/types/timestamp.rb +0 -4
  130. data/lib/rails_admin/config/fields/types.rb +1 -1
  131. data/lib/rails_admin/config/fields.rb +3 -1
  132. data/lib/rails_admin/config/has_fields.rb +5 -6
  133. data/lib/rails_admin/config/hideable.rb +1 -1
  134. data/lib/rails_admin/config/inspectable.rb +1 -3
  135. data/lib/rails_admin/config/model.rb +10 -10
  136. data/lib/rails_admin/config/sections/base.rb +2 -3
  137. data/lib/rails_admin/config/sections/list.rb +4 -15
  138. data/lib/rails_admin/config/sections.rb +1 -1
  139. data/lib/rails_admin/config.rb +73 -38
  140. data/lib/rails_admin/engine.rb +36 -23
  141. data/lib/rails_admin/extension.rb +6 -14
  142. data/lib/rails_admin/extensions/cancancan/authorization_adapter.rb +4 -2
  143. data/lib/rails_admin/extensions/paper_trail/auditing_adapter.rb +12 -7
  144. data/lib/rails_admin/extensions/pundit/authorization_adapter.rb +6 -7
  145. data/lib/rails_admin/support/csv_converter.rb +12 -13
  146. data/lib/rails_admin/support/datetime.rb +40 -74
  147. data/lib/rails_admin/support/esmodule_preprocessor.rb +32 -0
  148. data/lib/rails_admin/support/hash_helper.rb +6 -5
  149. data/lib/rails_admin/version.rb +8 -4
  150. data/lib/rails_admin.rb +1 -4
  151. data/lib/tasks/rails_admin.rake +3 -3
  152. data/package.json +28 -0
  153. data/src/rails_admin/base.js +21 -0
  154. data/src/rails_admin/filter-box.js +405 -0
  155. data/src/rails_admin/filtering-multiselect.js +394 -0
  156. data/src/rails_admin/filtering-select.js +302 -0
  157. data/src/rails_admin/i18n.js +19 -0
  158. data/src/rails_admin/nested-form-hooks.js +100 -0
  159. data/src/rails_admin/remote-form.js +190 -0
  160. data/src/rails_admin/sidescroll.js +20 -0
  161. data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/base/theming.scss +93 -34
  162. data/src/rails_admin/styles/base.scss +64 -0
  163. data/src/rails_admin/styles/filtering-multiselect.scss +53 -0
  164. data/src/rails_admin/styles/filtering-select.scss +70 -0
  165. data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/cerulean/theming.scss +23 -21
  166. data/src/rails_admin/styles/themes/cerulean/variables.scss +830 -0
  167. data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/default/mixins.scss +1 -1
  168. data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/default/variables.scss +1 -1
  169. data/src/rails_admin/styles/widgets.scss +35 -0
  170. data/src/rails_admin/ui.js +172 -0
  171. data/src/rails_admin/vendor/jquery.pjax.js +899 -0
  172. data/src/rails_admin/vendor/jquery_nested_form.js +122 -0
  173. data/src/rails_admin/widgets.js +512 -0
  174. data/vendor/assets/fonts/rails_admin/fa-solid-900.eot +0 -0
  175. data/vendor/assets/fonts/rails_admin/fa-solid-900.svg +5034 -0
  176. data/vendor/assets/fonts/rails_admin/fa-solid-900.ttf +0 -0
  177. data/vendor/assets/fonts/rails_admin/fa-solid-900.woff +0 -0
  178. data/vendor/assets/fonts/rails_admin/fa-solid-900.woff2 +0 -0
  179. data/vendor/assets/javascripts/rails_admin/jquery-ui/data.js +41 -0
  180. data/vendor/assets/javascripts/rails_admin/jquery-ui/effect.js +1637 -0
  181. data/vendor/assets/javascripts/rails_admin/jquery-ui/ie.js +17 -0
  182. data/vendor/assets/javascripts/rails_admin/jquery-ui/keycode.js +47 -0
  183. data/vendor/assets/javascripts/rails_admin/jquery-ui/position.js +500 -0
  184. data/vendor/assets/javascripts/rails_admin/jquery-ui/safe-active-element.js +42 -0
  185. data/vendor/assets/javascripts/rails_admin/jquery-ui/scroll-parent.js +47 -0
  186. data/vendor/assets/javascripts/rails_admin/jquery-ui/unique-id.js +51 -0
  187. data/vendor/assets/javascripts/rails_admin/jquery-ui/version.js +17 -0
  188. data/vendor/assets/javascripts/rails_admin/jquery-ui/widget.js +735 -0
  189. data/vendor/assets/javascripts/rails_admin/jquery-ui/widgets/autocomplete.js +689 -0
  190. data/vendor/assets/javascripts/rails_admin/jquery-ui/widgets/menu.js +680 -0
  191. data/vendor/assets/javascripts/rails_admin/jquery-ui/widgets/mouse.js +230 -0
  192. data/vendor/assets/javascripts/rails_admin/jquery-ui/widgets/sortable.js +1561 -0
  193. data/vendor/assets/javascripts/rails_admin/jquery3.js +10872 -0
  194. data/vendor/assets/stylesheets/rails_admin/font-awesome.scss +4476 -2216
  195. metadata +118 -263
  196. data/app/assets/images/rails_admin/aristo/images/bg_fallback.png +0 -0
  197. data/app/assets/images/rails_admin/aristo/images/icon_sprite.png +0 -0
  198. data/app/assets/images/rails_admin/aristo/images/progress_bar.gif +0 -0
  199. data/app/assets/images/rails_admin/aristo/images/slider_handles.png +0 -0
  200. data/app/assets/images/rails_admin/aristo/images/ui-icons_222222_256x240.png +0 -0
  201. data/app/assets/images/rails_admin/aristo/images/ui-icons_454545_256x240.png +0 -0
  202. data/app/assets/images/rails_admin/bullet_black.png +0 -0
  203. data/app/assets/images/rails_admin/bullet_white.png +0 -0
  204. data/app/assets/images/rails_admin/calendar.png +0 -0
  205. data/app/assets/images/rails_admin/clock.png +0 -0
  206. data/app/assets/images/rails_admin/logo.png +0 -0
  207. data/app/assets/images/rails_admin/magnifier.png +0 -0
  208. data/app/assets/images/rails_admin/multiselect/icon_sprite.png +0 -0
  209. data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-n-dark.png +0 -0
  210. data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-n-light.png +0 -0
  211. data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-s-dark.png +0 -0
  212. data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-s-light.png +0 -0
  213. data/app/assets/javascripts/rails_admin/jquery-ui.js.erb +0 -8
  214. data/app/assets/javascripts/rails_admin/jquery.migrate.js +0 -3
  215. data/app/assets/javascripts/rails_admin/ra.filter-box.js +0 -253
  216. data/app/assets/javascripts/rails_admin/ra.filtering-multiselect.js +0 -331
  217. data/app/assets/javascripts/rails_admin/ra.filtering-select.js +0 -294
  218. data/app/assets/javascripts/rails_admin/ra.i18n.js +0 -28
  219. data/app/assets/javascripts/rails_admin/ra.nested-form-hooks.js +0 -59
  220. data/app/assets/javascripts/rails_admin/ra.remote-form.js +0 -155
  221. data/app/assets/javascripts/rails_admin/ra.sidescroll.js +0 -31
  222. data/app/assets/javascripts/rails_admin/ra.widgets.js +0 -379
  223. data/app/assets/javascripts/rails_admin/rails_admin.js +0 -21
  224. data/app/assets/javascripts/rails_admin/ui.js +0 -135
  225. data/app/assets/stylesheets/rails_admin/aristo/images/bg_fallback.png +0 -0
  226. data/app/assets/stylesheets/rails_admin/aristo/images/icon_sprite.png +0 -0
  227. data/app/assets/stylesheets/rails_admin/aristo/images/progress_bar.gif +0 -0
  228. data/app/assets/stylesheets/rails_admin/aristo/images/slider_handles.png +0 -0
  229. data/app/assets/stylesheets/rails_admin/aristo/images/ui-icons_222222_256x240.png +0 -0
  230. data/app/assets/stylesheets/rails_admin/aristo/images/ui-icons_454545_256x240.png +0 -0
  231. data/app/assets/stylesheets/rails_admin/aristo/jquery-ui-1.8.7.custom.scss +0 -733
  232. data/app/assets/stylesheets/rails_admin/base/font-awesome-4-compability.scss +0 -153
  233. data/app/assets/stylesheets/rails_admin/ra.filtering-multiselect.scss +0 -88
  234. data/app/assets/stylesheets/rails_admin/ra.sidescroll.scss +0 -29
  235. data/app/assets/stylesheets/rails_admin/ra.widgets.scss +0 -17
  236. data/app/assets/stylesheets/rails_admin/rails_admin.scss.erb +0 -110
  237. data/app/assets/stylesheets/rails_admin/themes/cerulean/variables.scss +0 -857
  238. data/app/views/kaminari/ra-twitter-bootstrap/_gap.html.haml +0 -2
  239. data/app/views/kaminari/ra-twitter-bootstrap/_next_page.html.haml +0 -4
  240. data/app/views/kaminari/ra-twitter-bootstrap/_page.html.haml +0 -4
  241. data/app/views/kaminari/ra-twitter-bootstrap/_paginator.html.haml +0 -9
  242. data/app/views/kaminari/ra-twitter-bootstrap/_prev_page.html.haml +0 -4
  243. data/app/views/kaminari/ra-twitter-bootstrap/without_count/_next_page.html.haml +0 -4
  244. data/app/views/kaminari/ra-twitter-bootstrap/without_count/_paginator.html.haml +0 -4
  245. data/app/views/kaminari/ra-twitter-bootstrap/without_count/_prev_page.html.haml +0 -4
  246. data/app/views/layouts/rails_admin/_head.html.haml +0 -7
  247. data/app/views/layouts/rails_admin/_navigation.html.haml +0 -12
  248. data/app/views/layouts/rails_admin/_secondary_navigation.html.haml +0 -10
  249. data/app/views/layouts/rails_admin/_sidebar_navigation.html.haml +0 -3
  250. data/app/views/layouts/rails_admin/application.html.haml +0 -16
  251. data/app/views/layouts/rails_admin/pjax.html.haml +0 -12
  252. data/app/views/rails_admin/main/_dashboard_history.html.haml +0 -21
  253. data/app/views/rails_admin/main/_delete_notice.html.haml +0 -24
  254. data/app/views/rails_admin/main/_form_action_text.html.haml +0 -7
  255. data/app/views/rails_admin/main/_form_boolean.html.haml +0 -3
  256. data/app/views/rails_admin/main/_form_code_mirror.html.haml +0 -9
  257. data/app/views/rails_admin/main/_form_colorpicker.html.haml +0 -1
  258. data/app/views/rails_admin/main/_form_datetime.html.haml +0 -5
  259. data/app/views/rails_admin/main/_form_enumeration.html.haml +0 -19
  260. data/app/views/rails_admin/main/_form_field.html.haml +0 -1
  261. data/app/views/rails_admin/main/_form_file_upload.html.haml +0 -17
  262. data/app/views/rails_admin/main/_form_froala.html.haml +0 -8
  263. data/app/views/rails_admin/main/_form_multiple_file_upload.html.haml +0 -16
  264. data/app/views/rails_admin/main/_form_nested_many.html.haml +0 -15
  265. data/app/views/rails_admin/main/_form_nested_one.html.haml +0 -17
  266. data/app/views/rails_admin/main/_form_polymorphic_association.html.haml +0 -26
  267. data/app/views/rails_admin/main/_form_simple_mde.haml +0 -8
  268. data/app/views/rails_admin/main/_form_text.html.haml +0 -1
  269. data/app/views/rails_admin/main/_form_wysihtml5.html.haml +0 -8
  270. data/app/views/rails_admin/main/_submit_buttons.html.haml +0 -16
  271. data/app/views/rails_admin/main/bulk_delete.html.haml +0 -11
  272. data/app/views/rails_admin/main/dashboard.html.haml +0 -34
  273. data/app/views/rails_admin/main/delete.html.haml +0 -18
  274. data/app/views/rails_admin/main/edit.html.haml +0 -2
  275. data/app/views/rails_admin/main/export.html.haml +0 -92
  276. data/app/views/rails_admin/main/history.html.haml +0 -51
  277. data/app/views/rails_admin/main/index.html.haml +0 -126
  278. data/app/views/rails_admin/main/new.html.haml +0 -2
  279. data/app/views/rails_admin/main/show.html.haml +0 -15
  280. data/config/initializers/haml.rb +0 -5
  281. data/lib/rails_admin/adapters/active_record/abstract_object.rb +0 -38
  282. data/lib/rails_admin/adapters/active_record.rb.bak +0 -348
  283. data/lib/rails_admin/adapters/mongoid/abstract_object.rb +0 -42
  284. data/lib/rails_admin/bootstrap-sass/compass_functions.rb +0 -28
  285. data/lib/rails_admin/bootstrap-sass/sass_functions.rb +0 -16
  286. data/lib/rails_admin/bootstrap-sass.rb +0 -49
  287. data/lib/rails_admin/config/lazy_model.rb +0 -68
  288. data/lib/rails_admin/extensions/history/auditing_adapter.rb +0 -37
  289. data/lib/rails_admin/extensions/history/history.rb +0 -44
  290. data/lib/rails_admin/extensions/history.rb +0 -3
  291. data/lib/rails_admin/support/i18n.rb +0 -43
  292. data/vendor/assets/fonts/rails_admin/FontAwesome.otf +0 -0
  293. data/vendor/assets/fonts/rails_admin/fontawesome-webfont.eot +0 -0
  294. data/vendor/assets/fonts/rails_admin/fontawesome-webfont.svg +0 -2671
  295. data/vendor/assets/fonts/rails_admin/fontawesome-webfont.ttf +0 -0
  296. data/vendor/assets/fonts/rails_admin/fontawesome-webfont.woff +0 -0
  297. data/vendor/assets/fonts/rails_admin/fontawesome-webfont.woff2 +0 -0
  298. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_background.png +0 -0
  299. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_hex.png +0 -0
  300. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_hsb_b.png +0 -0
  301. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_hsb_h.png +0 -0
  302. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_hsb_s.png +0 -0
  303. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_indic.gif +0 -0
  304. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_overlay.png +0 -0
  305. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_rgb_b.png +0 -0
  306. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_rgb_g.png +0 -0
  307. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_rgb_r.png +0 -0
  308. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_select.gif +0 -0
  309. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_submit.png +0 -0
  310. data/vendor/assets/images/rails_admin/colorpicker/custom_background.png +0 -0
  311. data/vendor/assets/images/rails_admin/colorpicker/custom_hex.png +0 -0
  312. data/vendor/assets/images/rails_admin/colorpicker/custom_hsb_b.png +0 -0
  313. data/vendor/assets/images/rails_admin/colorpicker/custom_hsb_h.png +0 -0
  314. data/vendor/assets/images/rails_admin/colorpicker/custom_hsb_s.png +0 -0
  315. data/vendor/assets/images/rails_admin/colorpicker/custom_indic.gif +0 -0
  316. data/vendor/assets/images/rails_admin/colorpicker/custom_rgb_b.png +0 -0
  317. data/vendor/assets/images/rails_admin/colorpicker/custom_rgb_g.png +0 -0
  318. data/vendor/assets/images/rails_admin/colorpicker/custom_rgb_r.png +0 -0
  319. data/vendor/assets/images/rails_admin/colorpicker/custom_submit.png +0 -0
  320. data/vendor/assets/images/rails_admin/colorpicker/select.png +0 -0
  321. data/vendor/assets/images/rails_admin/colorpicker/select2.png +0 -0
  322. data/vendor/assets/images/rails_admin/colorpicker/slider.png +0 -0
  323. data/vendor/assets/javascripts/rails_admin/jquery.colorpicker.js +0 -484
  324. data/vendor/assets/stylesheets/rails_admin/jquery.colorpicker.scss +0 -182
  325. /data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/base/README.txt +0 -0
  326. /data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/base/mixins.scss +0 -0
  327. /data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/base/variables.scss +0 -0
  328. /data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/cerulean/mixins.scss +0 -0
  329. /data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/default/theming.scss +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0465f1c31fbae7244974dfd8bb89945accc7928d638eee8501580afd51072ebe
4
- data.tar.gz: d6eb857035abd299385edc88ba6ea29c5036745669c7ebf8030b4d2061f8edfc
3
+ metadata.gz: a6a3860d340dafc631d3b97b72508bf26782d7f2732daddeba6aa629b72ac60b
4
+ data.tar.gz: 7d7cd7eac8ca04528958f760d2bd59acd68f72f9a24878775c8893ba40c7cf05
5
5
  SHA512:
6
- metadata.gz: 5ca333f75add572dff64cb2700bbfe959a3abc294372fee7b2fa5a749e7f72aa437131dcda46682faca2dbee03549e2270ca4fec6a1927dd5f795780b1dddedb
7
- data.tar.gz: 524af51a0ba9df0aefe38141bb977f1ddddd14aca688665ea54e0f81dae31b076063c29975e3067de30f56fda9101cc4fd1f65ec9894edc86f60907c69c77326
6
+ metadata.gz: 6351ecf1eb04ab4d5602de37ebb0befb45da0a718002090ea9d8934add568b8d1dba427e4c2cfeb5b55ee6312949a572a0877a8314b082433d2be43a12512286
7
+ data.tar.gz: fb0d398eee9cc4ba0b5580ad382d7ef10c33c45a5b4ea2b644f15dc4c7375fbc0d5a12592d28e75c74f8eb0f9090f120aad0d001da5708a27e16cf6e6596b819
data/Gemfile CHANGED
@@ -1,9 +1,10 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'appraisal', '>= 2.0'
4
- gem 'rails'
5
- gem 'haml'
6
4
  gem 'devise'
5
+ gem 'rails'
6
+ gem 'webpacker', require: false
7
+ gem 'webrick', '~> 1.7'
7
8
 
8
9
  group :active_record do
9
10
  gem 'paper_trail'
@@ -21,30 +22,27 @@ end
21
22
  group :test do
22
23
  gem 'cancancan', '~> 3.0'
23
24
  gem 'carrierwave', ['>= 2.0.0.rc', '< 3']
24
- gem 'database_cleaner', ['>= 1.2', '!= 1.4.0', '!= 1.5.0', '< 2.0']
25
+ gem 'cuprite'
26
+ gem 'database_cleaner-active_record', '>= 2.0', require: false
27
+ gem 'database_cleaner-mongoid', '>= 2.0', require: false
25
28
  gem 'dragonfly', '~> 1.0'
26
29
  gem 'factory_bot', '>= 4.2'
27
30
  gem 'generator_spec', '>= 0.8'
28
31
  gem 'launchy', '>= 2.2'
29
32
  gem 'mini_magick', '>= 3.4'
30
- gem 'poltergeist', '~> 1.5'
31
33
  gem 'pundit'
32
34
  gem 'rack-cache', require: 'rack/cache'
33
- gem 'rspec-rails', '>= 2.14'
34
35
  gem 'rspec-expectations', '!= 3.8.3'
36
+ gem 'rspec-rails', '>= 2.14'
35
37
  gem 'rspec-retry'
36
- gem 'rubocop', '~> 0.68.1', require: false
38
+ gem 'rubocop', ['~> 1.20', '!= 1.22.2'], require: false
37
39
  gem 'rubocop-performance', require: false
38
40
  gem 'simplecov', '>= 0.9', require: false
39
41
  gem 'simplecov-lcov', require: false
40
42
  gem 'timecop', '>= 0.5'
41
43
 
42
- platforms :ruby_19 do
43
- gem 'tins', '~> 1.6.0', require: false
44
- end
45
-
46
44
  # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
47
- gem 'tzinfo-data', platforms: %i(mingw mswin x64_mingw jruby)
45
+ gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
48
46
  end
49
47
 
50
48
  gemspec
data/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
  [![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=rails_admin&package-manager=bundler&version-scheme=semver)][semver]
9
9
 
10
10
  [gem]: https://rubygems.org/gems/rails_admin
11
- [ghactions]: https://github.com/sferik/rails_admin/actions
11
+ [ghactions]: https://github.com/railsadminteam/rails_admin/actions
12
12
  [coveralls]: https://coveralls.io/r/sferik/rails_admin
13
13
  [inch]: http://inch-ci.org/github/sferik/rails_admin
14
14
  [codeclimate]: https://codeclimate.com/github/sferik/rails_admin
@@ -20,49 +20,56 @@ RailsAdmin is a Rails engine that provides an easy-to-use interface for managing
20
20
 
21
21
  ### [Action required] Security issue
22
22
 
23
- **RailsAdmin 2.0.1, 2.0.0 and up to 1.4.2 have been reported to have XSS vulnerability.** We strongly recommend that you upgrade RailsAdmin to 2.0.2 (and higher) or 1.4.3 as soon as possible, if you are on those versions. See [d72090ec](https://github.com/sferik/rails_admin/commit/d72090ec6a07c3b9b7b48ab50f3d405f91ff4375) for the detail.
23
+ **RailsAdmin 2.0.1, 2.0.0 and up to 1.4.2 have been reported to have XSS vulnerability.** We strongly recommend that you upgrade RailsAdmin to 2.0.2 (and higher) or 1.4.3 as soon as possible, if you are on those versions. See [d72090ec](https://github.com/railsadminteam/rails_admin/commit/d72090ec6a07c3b9b7b48ab50f3d405f91ff4375) for the detail.
24
24
 
25
25
  ## Getting started
26
26
 
27
- * Check out [the docs][docs].
28
- * Try the [live demo][demo]. ([Source code][dummy_app])
27
+ - Check out [the docs][docs].
28
+ - Try the [live demo][demo]. ([Source code][dummy_app])
29
29
 
30
30
  [demo]: http://rails-admin-tb.herokuapp.com/
31
31
  [dummy_app]: https://github.com/bbenezech/dummy_app
32
- [docs]: https://github.com/sferik/rails_admin/wiki
32
+ [docs]: https://github.com/railsadminteam/rails_admin/wiki
33
33
 
34
34
  ## Features
35
- * CRUD any data with ease
36
- * Custom actions
37
- * Automatic form validation
38
- * Search and filtering
39
- * Export data to CSV/JSON/XML
40
- * Authentication (via [Devise](https://github.com/plataformatec/devise) or other)
41
- * Authorization (via [CanCanCan](https://github.com/CanCanCommunity/cancancan) or [Pundit](https://github.com/elabs/pundit))
42
- * User action history (via [PaperTrail](https://github.com/airblade/paper_trail))
43
- * Supported ORMs
44
- * ActiveRecord
45
- * Mongoid
46
-
47
35
 
36
+ - CRUD any data with ease
37
+ - Custom actions
38
+ - Automatic form validation
39
+ - Search and filtering
40
+ - Export data to CSV/JSON/XML
41
+ - Authentication (via [Devise](https://github.com/plataformatec/devise) or other)
42
+ - Authorization (via [CanCanCan](https://github.com/CanCanCommunity/cancancan) or [Pundit](https://github.com/elabs/pundit))
43
+ - User action history (via [PaperTrail](https://github.com/airblade/paper_trail))
44
+ - Supported ORMs
45
+ - ActiveRecord
46
+ - Mongoid
48
47
 
49
48
  ## Installation
50
49
 
51
- 1. On your gemfile: `gem 'rails_admin', '~> 2.0'`
50
+ 1. On your gemfile: `gem 'rails_admin', ['>= 3.0.0.beta', '< 4']`
52
51
  2. Run `bundle install`
53
52
  3. Run `rails g rails_admin:install`
54
53
  4. Provide a namespace for the routes when asked
55
54
  5. Start a server `rails s` and administer your data at [/admin](http://localhost:3000/admin). (if you chose default namespace: /admin)
56
55
 
56
+ ## Upgrading from 2.x
57
+
58
+ Due to introduction of Webpack/Webpacker support, some additional dependency and configuration will be needed.
59
+ Running `rails g rails_admin:install` will suggest you some required changes, based on current setup of your app.
60
+
57
61
  ## Configuration
62
+
58
63
  ### Global
64
+
59
65
  In `config/initializers/rails_admin.rb`:
60
66
 
61
- [Details](https://github.com/sferik/rails_admin/wiki/Base-configuration)
67
+ [Details](https://github.com/railsadminteam/rails_admin/wiki/Base-configuration)
62
68
 
63
- To begin with, you may be interested in setting up [Devise](https://github.com/sferik/rails_admin/wiki/Devise), [CanCanCan](https://github.com/sferik/rails_admin/wiki/Cancancan) or [Papertrail](https://github.com/sferik/rails_admin/wiki/Papertrail)!
69
+ To begin with, you may be interested in setting up [Devise](https://github.com/railsadminteam/rails_admin/wiki/Devise), [CanCanCan](https://github.com/railsadminteam/rails_admin/wiki/Cancancan) or [Papertrail](https://github.com/railsadminteam/rails_admin/wiki/Papertrail)!
64
70
 
65
71
  ### Per model
72
+
66
73
  ```ruby
67
74
  class Ball < ActiveRecord::Base
68
75
  validates :name, presence: true
@@ -76,31 +83,30 @@ class Ball < ActiveRecord::Base
76
83
  end
77
84
  ```
78
85
 
79
- Details: [Models](https://github.com/sferik/rails_admin/wiki/Models), [Groups](https://github.com/sferik/rails_admin/wiki/Groups), [Fields](https://github.com/sferik/rails_admin/wiki/Fields)
86
+ Details: [Models](https://github.com/railsadminteam/rails_admin/wiki/Models), [Groups](https://github.com/railsadminteam/rails_admin/wiki/Groups), [Fields](https://github.com/railsadminteam/rails_admin/wiki/Fields)
80
87
 
81
88
  ## Support
89
+
82
90
  If you have a question, please check this README, the wiki, and the [list of
83
91
  known issues][troubleshoot].
84
92
 
85
- [troubleshoot]: https://github.com/sferik/rails_admin/wiki/Troubleshoot
93
+ [troubleshoot]: https://github.com/railsadminteam/rails_admin/wiki/Troubleshoot
86
94
 
87
95
  If you still have a question, you can ask the [official RailsAdmin mailing
88
96
  list][list].
89
97
 
90
98
  [list]: http://groups.google.com/group/rails_admin
91
99
 
92
- If you think you found a bug in RailsAdmin, you can [submit an issue](https://github.com/sferik/rails_admin/issues/new).
100
+ If you think you found a bug in RailsAdmin, you can [submit an issue](https://github.com/railsadminteam/rails_admin/issues/new).
93
101
 
94
102
  ## Supported Ruby Versions
103
+
95
104
  This library aims to support and is [tested against][ghactions] the following Ruby implementations:
96
105
 
97
- * Ruby 2.2
98
- * Ruby 2.3
99
- * Ruby 2.4
100
- * Ruby 2.5
101
- * Ruby 2.6
102
- * Ruby 2.7
103
- * Ruby 3.0
104
- * [JRuby][]
106
+ - Ruby 2.5
107
+ - Ruby 2.6
108
+ - Ruby 2.7
109
+ - Ruby 3.0
110
+ - [JRuby][]
105
111
 
106
112
  [jruby]: http://jruby.org/
data/Rakefile CHANGED
@@ -17,8 +17,8 @@ begin
17
17
  rescue LoadError
18
18
  desc 'Run RuboCop'
19
19
  task :rubocop do
20
- $stderr.puts 'Rubocop is disabled'
20
+ warn 'Rubocop is disabled'
21
21
  end
22
22
  end
23
23
 
24
- task default: [:spec, :rubocop]
24
+ task default: %i[spec rubocop]
@@ -0,0 +1,21 @@
1
+ //= require 'rails-ujs'
2
+ //= require 'rails_admin/jquery3'
3
+ //= require 'rails_admin/jquery.pjax'
4
+ //= require 'jquery_nested_form'
5
+ //= require 'rails_admin/jquery-ui/effect'
6
+ //= require 'rails_admin/jquery-ui/widgets/sortable'
7
+ //= require 'rails_admin/jquery-ui/widgets/autocomplete'
8
+ //= require 'rails_admin/moment-with-locales'
9
+ //= require 'rails_admin/bootstrap-datetimepicker'
10
+ //= require 'rails_admin/bootstrap/bootstrap'
11
+
12
+ //= require 'rails_admin/filter-box'
13
+ //= require 'rails_admin/filtering-multiselect'
14
+ //= require 'rails_admin/filtering-select'
15
+ //= require 'rails_admin/remote-form'
16
+ //= require 'rails_admin/nested-form-hooks'
17
+ //= require 'rails_admin/i18n'
18
+ //= require 'rails_admin/widgets'
19
+ //= require 'rails_admin/sidescroll'
20
+ //= require 'rails_admin/ui'
21
+ //= require 'rails_admin/custom/ui'
@@ -6,6 +6,6 @@
6
6
  Available mixins to use/override:
7
7
 
8
8
  https://github.com/twbs/bootstrap-sass/tree/master/assets/stylesheets/bootstrap/mixins
9
- https://github.com/sferik/rails_admin/blob/master/app/assets/stylesheets/rails_admin/base/mixins.scss
9
+ https://github.com/railsadminteam/rails_admin/blob/master/src/rails_admin/styles/base/mixins.scss
10
10
  Plus the ones from your theme.
11
11
  */
@@ -6,7 +6,7 @@
6
6
  Available variables to use/override:
7
7
 
8
8
  https://github.com/twbs/bootstrap-sass/blob/master/assets/stylesheets/bootstrap/_variables.scss
9
- https://github.com/sferik/rails_admin/blob/master/app/assets/stylesheets/rails_admin/base/variables.scss
9
+ https://github.com/railsadminteam/rails_admin/blob/master/src/rails_admin/styles/base/variables.scss
10
10
  Plus the ones from your themes.
11
11
 
12
12
  Test me: pink links
@@ -0,0 +1,76 @@
1
+ @charset "UTF-8";
2
+
3
+ <%
4
+ theme = ENV['RAILS_ADMIN_THEME'] || :default
5
+ %>
6
+
7
+ /*** Variables ***/
8
+
9
+ @import "rails_admin/custom/variables";
10
+ @import "rails_admin/bootstrap/variables";
11
+ @import "rails_admin/styles/base/variables";
12
+ @import "rails_admin/styles/themes/<%= theme %>/variables";
13
+
14
+ /*** Mixins ***/
15
+
16
+ @import "rails_admin/bootstrap/mixins";
17
+ @import "rails_admin/styles/base/mixins";
18
+ @import "rails_admin/styles/themes/<%= theme %>/mixins";
19
+ @import "rails_admin/custom/mixins";
20
+
21
+ /*** Libraries ***/
22
+
23
+ @import "rails_admin/bootstrap-datetimepicker-build";
24
+ @import "rails_admin/styles/filtering-select";
25
+ @import "rails_admin/styles/filtering-multiselect";
26
+ @import "rails_admin/styles/widgets";
27
+
28
+
29
+ /*** Font-awesome ***/
30
+
31
+ @import 'rails_admin/font-awesome';
32
+
33
+ /*** Bootstrap Theming ***/
34
+
35
+ @import "rails_admin/bootstrap/normalize";
36
+ @import "rails_admin/bootstrap/scaffolding";
37
+ @import "rails_admin/bootstrap/grid";
38
+ <%# @import "rails_admin/bootstrap/layouts"; %>
39
+ @import "rails_admin/bootstrap/type";
40
+ @import "rails_admin/bootstrap/forms";
41
+ @import "rails_admin/bootstrap/tables";
42
+ @import "rails_admin/bootstrap/dropdowns";
43
+ @import "rails_admin/bootstrap/wells";
44
+ @import "rails_admin/bootstrap/component-animations";
45
+ @import "rails_admin/bootstrap/close";
46
+ @import "rails_admin/bootstrap/buttons";
47
+ @import "rails_admin/bootstrap/button-groups";
48
+ @import "rails_admin/bootstrap/input-groups";
49
+ @import "rails_admin/bootstrap/alerts";
50
+ @import "rails_admin/bootstrap/navs";
51
+ @import "rails_admin/bootstrap/navbar";
52
+ @import "rails_admin/bootstrap/breadcrumbs";
53
+ @import "rails_admin/bootstrap/pagination";
54
+ @import "rails_admin/bootstrap/pager";
55
+ @import "rails_admin/bootstrap/modals";
56
+ @import "rails_admin/bootstrap/tooltip";
57
+ @import "rails_admin/bootstrap/popovers";
58
+ @import "rails_admin/bootstrap/thumbnails";
59
+ @import "rails_admin/bootstrap/labels";
60
+ @import "rails_admin/bootstrap/panels";
61
+ @import "rails_admin/bootstrap/badges";
62
+ @import "rails_admin/bootstrap/progress-bars";
63
+ <%# @import "rails_admin/bootstrap/accordion"; %>
64
+ @import "rails_admin/bootstrap/carousel";
65
+ <%# @import "rails_admin/bootstrap/hero-unit"; %>
66
+ @import "rails_admin/bootstrap/utilities";
67
+ @import "rails_admin/bootstrap/responsive-utilities";
68
+
69
+ /*** RailsAdmin Theming ***/
70
+
71
+ @import "rails_admin/styles/base/theming";
72
+ @import "rails_admin/styles/themes/<%= theme %>/theming";
73
+ @import "rails_admin/custom/theming";
74
+
75
+
76
+
@@ -25,13 +25,14 @@ module RailsAdmin
25
25
 
26
26
  def get_model
27
27
  @model_name = to_model_name(params[:model_name])
28
- raise(RailsAdmin::ModelNotFound) unless (@abstract_model = RailsAdmin::AbstractModel.new(@model_name))
29
- raise(RailsAdmin::ModelNotFound) if (@model_config = @abstract_model.config).excluded?
28
+ raise RailsAdmin::ModelNotFound unless (@abstract_model = RailsAdmin::AbstractModel.new(@model_name))
29
+ raise RailsAdmin::ModelNotFound if (@model_config = @abstract_model.config).excluded?
30
+
30
31
  @properties = @abstract_model.properties
31
32
  end
32
33
 
33
34
  def get_object
34
- raise(RailsAdmin::ObjectNotFound) unless (@object = @abstract_model.get(params[:id]))
35
+ raise RailsAdmin::ObjectNotFound unless (@object = @abstract_model.get(params[:id]))
35
36
  end
36
37
 
37
38
  def to_model_name(param)
@@ -6,31 +6,16 @@ module RailsAdmin
6
6
 
7
7
  layout :get_layout
8
8
 
9
- before_action :get_model, except: RailsAdmin::Config::Actions.all(:root).collect(&:action_name)
10
- before_action :get_object, only: RailsAdmin::Config::Actions.all(:member).collect(&:action_name)
11
9
  before_action :check_for_cancel
12
10
 
13
- RailsAdmin::Config::Actions.all.each do |action|
14
- class_eval <<-EOS, __FILE__, __LINE__ + 1
15
- def #{action.action_name}
16
- action = RailsAdmin::Config::Actions.find('#{action.action_name}'.to_sym)
17
- @authorization_adapter.try(:authorize, action.authorization_key, @abstract_model, @object)
18
- @action = action.with({controller: self, abstract_model: @abstract_model, object: @object})
19
- fail(ActionNotAllowed) unless @action.enabled?
20
- @page_name = wording_for(:title)
21
-
22
- instance_eval &@action.controller
23
- end
24
- EOS
25
- end
26
-
27
11
  def bulk_action
28
- send(params[:bulk_action]) if params[:bulk_action].in?(RailsAdmin::Config::Actions.all(controller: self, abstract_model: @abstract_model).select(&:bulkable?).collect(&:route_fragment))
12
+ get_model
13
+ process(params[:bulk_action]) if params[:bulk_action].in?(RailsAdmin::Config::Actions.all(controller: self, abstract_model: @abstract_model).select(&:bulkable?).collect(&:route_fragment))
29
14
  end
30
15
 
31
16
  def list_entries(model_config = @model_config, auth_scope_key = :index, additional_scope = get_association_scope_from_params, pagination = !(params[:associated_collection] || params[:all] || params[:bulk_ids]))
32
17
  scope = model_config.abstract_model.scoped
33
- if auth_scope = @authorization_adapter && @authorization_adapter.query(auth_scope_key, model_config.abstract_model)
18
+ if auth_scope = @authorization_adapter&.query(auth_scope_key, model_config.abstract_model)
34
19
  scope = scope.merge(auth_scope)
35
20
  end
36
21
  scope = scope.instance_eval(&additional_scope) if additional_scope
@@ -39,6 +24,38 @@ module RailsAdmin
39
24
 
40
25
  private
41
26
 
27
+ def action_missing(name, *_args)
28
+ action = RailsAdmin::Config::Actions.find(name.to_sym)
29
+ raise AbstractController::ActionNotFound.new("The action '#{name}' could not be found for #{self.class.name}") unless action
30
+
31
+ get_model unless action.root?
32
+ get_object if action.member?
33
+ @authorization_adapter.try(:authorize, action.authorization_key, @abstract_model, @object)
34
+ @action = action.with({controller: self, abstract_model: @abstract_model, object: @object})
35
+ raise(ActionNotAllowed) unless @action.enabled?
36
+
37
+ @page_name = wording_for(:title)
38
+
39
+ instance_eval(&@action.controller)
40
+ end
41
+
42
+ def method_missing(name, *args, &block)
43
+ action = RailsAdmin::Config::Actions.find(name.to_sym)
44
+ if action
45
+ action_missing name, *args, &block
46
+ else
47
+ super
48
+ end
49
+ end
50
+
51
+ def respond_to_missing?(sym, include_private)
52
+ if RailsAdmin::Config::Actions.find(name.to_sym)
53
+ true
54
+ else
55
+ super
56
+ end
57
+ end
58
+
42
59
  def get_layout
43
60
  "rails_admin/#{request.headers['X-PJAX'] ? 'pjax' : 'application'}"
44
61
  end
@@ -54,7 +71,7 @@ module RailsAdmin
54
71
  params[:sort_reverse] ||= 'false'
55
72
 
56
73
  field = model_config.list.fields.detect { |f| f.name.to_s == params[:sort] }
57
- column = begin
74
+ column =
58
75
  if field.nil? || field.sortable == true # use params[:sort] on the base table
59
76
  "#{abstract_model.table_name}.#{params[:sort]}"
60
77
  elsif field.sortable == false # use default sort, asked field is not sortable
@@ -68,7 +85,6 @@ module RailsAdmin
68
85
  else # use described column in the field conf.
69
86
  "#{abstract_model.table_name}.#{field.sortable}"
70
87
  end
71
- end
72
88
 
73
89
  reversed_sort = (field ? field.sort_reverse? : model_config.list.sort_reverse?)
74
90
  {sort: column, sort_reverse: (params[:sort_reverse] == reversed_sort.to_s)}
@@ -91,6 +107,7 @@ module RailsAdmin
91
107
 
92
108
  def sanitize_params_for!(action, model_config = @model_config, target_params = params[@abstract_model.param_key])
93
109
  return unless target_params.present?
110
+
94
111
  fields = visible_fields(action, model_config)
95
112
  allowed_methods = fields.collect(&:allowed_methods).flatten.uniq.collect(&:to_s) << 'id' << '_destroy'
96
113
  fields.each { |field| field.parse_input(target_params) }
@@ -110,20 +127,21 @@ module RailsAdmin
110
127
 
111
128
  respond_to do |format|
112
129
  format.html { render whereto, status: :not_acceptable }
113
- format.js { render whereto, layout: false, status: :not_acceptable }
130
+ format.js { render whereto, layout: 'rails_admin/modal', status: :not_acceptable, content_type: Mime[:html].to_s }
114
131
  end
115
132
  end
116
133
 
117
134
  def check_for_cancel
118
135
  return unless params[:_continue] || (params[:bulk_action] && !params[:bulk_ids])
136
+
119
137
  redirect_to(back_or_index, notice: I18n.t('admin.flash.noaction'))
120
138
  end
121
139
 
122
140
  def get_collection(model_config, scope, pagination)
123
- associations = model_config.list.fields.select { |f| f.try(:eager_load?) }.collect { |f| f.association.name }
141
+ eager_loads = model_config.list.fields.flat_map(&:eager_load_values)
124
142
  options = {}
125
143
  options = options.merge(page: (params[Kaminari.config.param_name] || 1).to_i, per: (params[:per] || model_config.list.items_per_page)) if pagination
126
- options = options.merge(include: associations) unless associations.blank?
144
+ options = options.merge(include: eager_loads) unless eager_loads.blank?
127
145
  options = options.merge(get_sort_hash(model_config))
128
146
  options = options.merge(query: params[:query]) if params[:query].present?
129
147
  options = options.merge(filters: params[:f]) if params[:f].present?
@@ -133,10 +151,11 @@ module RailsAdmin
133
151
 
134
152
  def get_association_scope_from_params
135
153
  return nil unless params[:associated_collection].present?
154
+
136
155
  source_abstract_model = RailsAdmin::AbstractModel.new(to_model_name(params[:source_abstract_model]))
137
156
  source_model_config = source_abstract_model.config
138
157
  source_object = source_abstract_model.get(params[:source_object_id])
139
- action = params[:current_action].in?(%w(create update)) ? params[:current_action] : 'edit'
158
+ action = params[:current_action].in?(%w[create update]) ? params[:current_action] : 'edit'
140
159
  @association = source_model_config.send(action).fields.detect { |f| f.name == params[:associated_collection].to_sym }.with(controller: self, object: source_object)
141
160
  @association.associated_collection_scope
142
161
  end