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
@@ -18,7 +18,7 @@ module RailsAdmin
18
18
 
19
19
  register_instance_option :controller do
20
20
  proc do
21
- @history = @auditing_adapter && @auditing_adapter.latest(@action.auditing_versions_limit) || []
21
+ @history = @auditing_adapter&.latest(@action.auditing_versions_limit) || []
22
22
  if @action.statistics?
23
23
  @abstract_models = RailsAdmin::Config.visible_models(controller: self).collect(&:abstract_model)
24
24
 
@@ -26,11 +26,12 @@ module RailsAdmin
26
26
  @count = {}
27
27
  @max = 0
28
28
  @abstract_models.each do |t|
29
- scope = @authorization_adapter && @authorization_adapter.query(:index, t)
29
+ scope = @authorization_adapter&.query(:index, t)
30
30
  current_count = t.count({}, scope)
31
31
  @max = current_count > @max ? current_count : @max
32
32
  @count[t.model.name] = current_count
33
33
  next unless t.properties.detect { |c| c.name == :created_at }
34
+
34
35
  @most_recent_created[t.model.name] = t.model.last.try(:created_at)
35
36
  end
36
37
  end
@@ -43,7 +44,7 @@ module RailsAdmin
43
44
  end
44
45
 
45
46
  register_instance_option :link_icon do
46
- 'icon-home'
47
+ 'fas fa-home'
47
48
  end
48
49
 
49
50
  register_instance_option :statistics? do
@@ -13,7 +13,7 @@ module RailsAdmin
13
13
  end
14
14
 
15
15
  register_instance_option :http_methods do
16
- [:get, :delete]
16
+ %i[get delete]
17
17
  end
18
18
 
19
19
  register_instance_option :authorization_key do
@@ -31,24 +31,20 @@ module RailsAdmin
31
31
 
32
32
  elsif request.delete? # DESTROY
33
33
 
34
- redirect_path = nil
35
- @auditing_adapter && @auditing_adapter.delete_object(@object, @abstract_model, _current_user)
34
+ @auditing_adapter&.delete_object(@object, @abstract_model, _current_user)
36
35
  if @object.destroy
37
36
  flash[:success] = t('admin.flash.successful', name: @model_config.label, action: t('admin.actions.delete.done'))
38
- redirect_path = index_path
37
+ redirect_to index_path
39
38
  else
40
- flash[:error] = t('admin.flash.error', name: @model_config.label, action: t('admin.actions.delete.done'))
41
- redirect_path = back_or_index
39
+ handle_save_error :delete
42
40
  end
43
41
 
44
- redirect_to redirect_path
45
-
46
42
  end
47
43
  end
48
44
  end
49
45
 
50
46
  register_instance_option :link_icon do
51
- 'icon-remove'
47
+ 'fas fa-times'
52
48
  end
53
49
  end
54
50
  end
@@ -9,7 +9,7 @@ module RailsAdmin
9
9
  end
10
10
 
11
11
  register_instance_option :http_methods do
12
- [:get, :put]
12
+ %i[get put]
13
13
  end
14
14
 
15
15
  register_instance_option :controller do
@@ -18,20 +18,20 @@ module RailsAdmin
18
18
 
19
19
  respond_to do |format|
20
20
  format.html { render @action.template_name }
21
- format.js { render @action.template_name, layout: false }
21
+ format.js { render @action.template_name, layout: 'rails_admin/modal', content_type: Mime[:html].to_s }
22
22
  end
23
23
 
24
24
  elsif request.put? # UPDATE
25
25
  sanitize_params_for!(request.xhr? ? :modal : :update)
26
26
 
27
- @object.set_attributes(params[@abstract_model.param_key])
28
- @authorization_adapter && @authorization_adapter.authorize(:update, @abstract_model, @object)
27
+ @object.assign_attributes(params[@abstract_model.param_key])
28
+ @authorization_adapter&.authorize(:update, @abstract_model, @object)
29
29
  changes = @object.changes
30
30
  if @object.save
31
- @auditing_adapter && @auditing_adapter.update_object(@object, @abstract_model, _current_user, changes)
31
+ @auditing_adapter&.update_object(@object, @abstract_model, _current_user, changes)
32
32
  respond_to do |format|
33
33
  format.html { redirect_to_on_success }
34
- format.js { render json: {id: @object.id.to_s, label: @model_config.with(object: @object).object_label} }
34
+ format.json { render json: {id: @object.id.to_s, label: @model_config.with(object: @object).object_label} }
35
35
  end
36
36
  else
37
37
  handle_save_error :edit
@@ -42,7 +42,7 @@ module RailsAdmin
42
42
  end
43
43
 
44
44
  register_instance_option :link_icon do
45
- 'icon-pencil'
45
+ 'fas fa-pencil-alt'
46
46
  end
47
47
  end
48
48
  end
@@ -9,7 +9,7 @@ module RailsAdmin
9
9
  end
10
10
 
11
11
  register_instance_option :http_methods do
12
- [:get, :post]
12
+ %i[get post]
13
13
  end
14
14
 
15
15
  register_instance_option :controller do
@@ -30,7 +30,7 @@ module RailsAdmin
30
30
  end
31
31
 
32
32
  register_instance_option :link_icon do
33
- 'icon-share'
33
+ 'fas fa-file-export'
34
34
  end
35
35
  end
36
36
  end
@@ -19,7 +19,7 @@ module RailsAdmin
19
19
  register_instance_option :controller do
20
20
  proc do
21
21
  @general = true
22
- @history = @auditing_adapter && @auditing_adapter.listing_for_model(@abstract_model, params[:query], params[:sort], params[:sort_reverse], params[:all], params[:page]) || []
22
+ @history = @auditing_adapter&.listing_for_model(@abstract_model, params[:query], params[:sort], params[:sort_reverse], params[:all], params[Kaminari.config.param_name]) || []
23
23
 
24
24
  render @action.template_name
25
25
  end
@@ -30,7 +30,7 @@ module RailsAdmin
30
30
  end
31
31
 
32
32
  register_instance_option :link_icon do
33
- 'icon-book'
33
+ 'fas fa-book'
34
34
  end
35
35
  end
36
36
  end
@@ -19,7 +19,7 @@ module RailsAdmin
19
19
  register_instance_option :controller do
20
20
  proc do
21
21
  @general = false
22
- @history = @auditing_adapter && @auditing_adapter.listing_for_object(@abstract_model, @object, params[:query], params[:sort], params[:sort_reverse], params[:all], params[:page]) || []
22
+ @history = @auditing_adapter&.listing_for_object(@abstract_model, @object, params[:query], params[:sort], params[:sort_reverse], params[:all], params[Kaminari.config.param_name]) || []
23
23
 
24
24
  render @action.template_name
25
25
  end
@@ -30,7 +30,7 @@ module RailsAdmin
30
30
  end
31
31
 
32
32
  register_instance_option :link_icon do
33
- 'icon-book'
33
+ 'fas fa-book'
34
34
  end
35
35
  end
36
36
  end
@@ -11,7 +11,7 @@ module RailsAdmin
11
11
  end
12
12
 
13
13
  register_instance_option :http_methods do
14
- [:get, :post]
14
+ %i[get post]
15
15
  end
16
16
 
17
17
  register_instance_option :route_fragment do
@@ -33,9 +33,7 @@ module RailsAdmin
33
33
 
34
34
  unless @model_config.list.scopes.empty?
35
35
  if params[:scope].blank?
36
- unless @model_config.list.scopes.first.nil?
37
- @objects = @objects.send(@model_config.list.scopes.first)
38
- end
36
+ @objects = @objects.send(@model_config.list.scopes.first) unless @model_config.list.scopes.first.nil?
39
37
  elsif @model_config.list.scopes.collect(&:to_s).include?(params[:scope])
40
38
  @objects = @objects.send(params[:scope].to_sym)
41
39
  end
@@ -47,7 +45,7 @@ module RailsAdmin
47
45
  end
48
46
 
49
47
  format.json do
50
- output = begin
48
+ output =
51
49
  if params[:compact]
52
50
  primary_key_method = @association ? @association.associated_primary_key : @model_config.abstract_model.primary_key
53
51
  label_method = @model_config.object_label_method
@@ -55,7 +53,7 @@ module RailsAdmin
55
53
  else
56
54
  @objects.to_json(@schema)
57
55
  end
58
- end
56
+
59
57
  if params[:send_data]
60
58
  send_data output, filename: "#{params[:model_name]}_#{DateTime.now.strftime('%Y-%m-%d_%Hh%Mm%S')}.json"
61
59
  else
@@ -87,7 +85,7 @@ module RailsAdmin
87
85
  end
88
86
 
89
87
  register_instance_option :link_icon do
90
- 'icon-th-list'
88
+ 'fas fa-th-list'
91
89
  end
92
90
  end
93
91
  end
@@ -9,7 +9,7 @@ module RailsAdmin
9
9
  end
10
10
 
11
11
  register_instance_option :http_methods do
12
- [:get, :post] # NEW / CREATE
12
+ %i[get post] # NEW / CREATE
13
13
  end
14
14
 
15
15
  register_instance_option :controller do
@@ -17,16 +17,16 @@ module RailsAdmin
17
17
  if request.get? # NEW
18
18
 
19
19
  @object = @abstract_model.new
20
- @authorization_adapter && @authorization_adapter.attributes_for(:new, @abstract_model).each do |name, value|
20
+ @authorization_adapter&.attributes_for(:new, @abstract_model)&.each do |name, value|
21
21
  @object.send("#{name}=", value)
22
22
  end
23
23
  if object_params = params[@abstract_model.param_key]
24
24
  sanitize_params_for!(request.xhr? ? :modal : :create)
25
- @object.set_attributes(@object.attributes.merge(object_params.to_h))
25
+ @object.assign_attributes(@object.attributes.merge(object_params.to_h))
26
26
  end
27
27
  respond_to do |format|
28
28
  format.html { render @action.template_name }
29
- format.js { render @action.template_name, layout: false }
29
+ format.js { render @action.template_name, layout: 'rails_admin/modal', content_type: Mime[:html].to_s }
30
30
  end
31
31
 
32
32
  elsif request.post? # CREATE
@@ -35,14 +35,14 @@ module RailsAdmin
35
35
  @object = @abstract_model.new
36
36
  sanitize_params_for!(request.xhr? ? :modal : :create)
37
37
 
38
- @object.set_attributes(params[@abstract_model.param_key])
39
- @authorization_adapter && @authorization_adapter.authorize(:create, @abstract_model, @object)
38
+ @object.assign_attributes(params[@abstract_model.param_key])
39
+ @authorization_adapter&.authorize(:create, @abstract_model, @object)
40
40
 
41
41
  if @object.save
42
- @auditing_adapter && @auditing_adapter.create_object(@object, @abstract_model, _current_user)
42
+ @auditing_adapter&.create_object(@object, @abstract_model, _current_user)
43
43
  respond_to do |format|
44
44
  format.html { redirect_to_on_success }
45
- format.js { render json: {id: @object.id.to_s, label: @model_config.with(object: @object).object_label} }
45
+ format.json { render json: {id: @object.id.to_s, label: @model_config.with(object: @object).object_label} }
46
46
  end
47
47
  else
48
48
  handle_save_error
@@ -53,7 +53,7 @@ module RailsAdmin
53
53
  end
54
54
 
55
55
  register_instance_option :link_icon do
56
- 'icon-plus'
56
+ 'fas fa-plus'
57
57
  end
58
58
  end
59
59
  end
@@ -26,7 +26,7 @@ module RailsAdmin
26
26
  end
27
27
 
28
28
  register_instance_option :link_icon do
29
- 'icon-info-sign'
29
+ 'fas fa-info-circle'
30
30
  end
31
31
  end
32
32
  end
@@ -9,7 +9,11 @@ module RailsAdmin
9
9
  end
10
10
 
11
11
  register_instance_option :visible? do
12
- authorized? && (bindings[:controller].main_app.url_for(bindings[:object]) rescue false)
12
+ authorized? && begin
13
+ bindings[:controller].main_app.url_for(bindings[:object])
14
+ rescue StandardError
15
+ false
16
+ end
13
17
  end
14
18
 
15
19
  register_instance_option :controller do
@@ -19,7 +23,7 @@ module RailsAdmin
19
23
  end
20
24
 
21
25
  register_instance_option :link_icon do
22
- 'icon-eye-open'
26
+ 'fas fa-eye'
23
27
  end
24
28
 
25
29
  register_instance_option :pjax? do
@@ -9,7 +9,7 @@ module RailsAdmin
9
9
  end
10
10
  scope ||= :all
11
11
  init_actions!
12
- actions = begin
12
+ actions =
13
13
  case scope
14
14
  when :all
15
15
  @@actions
@@ -22,7 +22,7 @@ module RailsAdmin
22
22
  when :member
23
23
  @@actions.select(&:member?)
24
24
  end
25
- end
25
+
26
26
  actions = actions.collect { |action| action.with(bindings) }
27
27
  bindings[:controller] ? actions.select(&:visible?) : actions
28
28
  end
@@ -52,7 +52,7 @@ module RailsAdmin
52
52
  def key
53
53
  :#{key}
54
54
  end
55
- ))
55
+ ), __FILE__, __LINE__ - 5)
56
56
  add_action_custom_key(a, &block)
57
57
  end
58
58
 
@@ -71,7 +71,7 @@ module RailsAdmin
71
71
  action = #{klass}.new
72
72
  add_action_custom_key(action, &block)
73
73
  end
74
- }
74
+ }, __FILE__, __LINE__ - 5
75
75
  end
76
76
 
77
77
  private
@@ -9,7 +9,7 @@ module RailsAdmin
9
9
 
10
10
  def has_option?(name) # rubocop:disable Naming/PredicateName
11
11
  options = self.class.instance_variable_get('@config_options')
12
- options && options.key?(name)
12
+ options&.key?(name)
13
13
  end
14
14
 
15
15
  # Register an instance option for this object only
@@ -87,7 +87,7 @@ module RailsAdmin
87
87
  elsif block_given?
88
88
  yield
89
89
  else
90
- raise("The #{option_name} configuration option is removed without replacement.")
90
+ raise "The #{option_name} configuration option is removed without replacement."
91
91
  end
92
92
  end
93
93
  end
@@ -5,15 +5,15 @@ module RailsAdmin
5
5
  module Config
6
6
  module Fields
7
7
  class Association < RailsAdmin::Config::Fields::Base
8
- def self.inherited(klass)
9
- super(klass)
10
- end
11
-
12
8
  # Reader for the association information hash
13
9
  def association
14
10
  @properties
15
11
  end
16
12
 
13
+ def method_name
14
+ association.key_accessor
15
+ end
16
+
17
17
  register_instance_option :pretty_value do
18
18
  v = bindings[:view]
19
19
  [value].flatten.select(&:present?).collect do |associated|
@@ -22,7 +22,7 @@ module RailsAdmin
22
22
  wording = associated.send(amc.object_label_method)
23
23
  can_see = !am.embedded? && (show_action = v.action(:show, am, associated))
24
24
  can_see ? v.link_to(wording, v.url_for(action: show_action.action_name, model_name: am.to_param, id: associated.id), class: 'pjax') : ERB::Util.html_escape(wording)
25
- end.to_sentence.html_safe
25
+ end.to_sentence.html_safe.presence || '-'
26
26
  end
27
27
 
28
28
  # Accessor whether association is visible or not. By default
@@ -62,10 +62,18 @@ module RailsAdmin
62
62
  association.foreign_key_nullable?
63
63
  end
64
64
 
65
- register_instance_option :eager_load? do
65
+ register_instance_option :eager_load do
66
66
  !!searchable
67
67
  end
68
68
 
69
+ register_instance_option :inline_add do
70
+ true
71
+ end
72
+
73
+ register_instance_option :inline_edit do
74
+ true
75
+ end
76
+
69
77
  # Reader for the association's child model's configuration
70
78
  def associated_model_config
71
79
  @associated_model_config ||= RailsAdmin.config(association.klass)
@@ -78,12 +86,7 @@ module RailsAdmin
78
86
 
79
87
  # Reader for associated primary key
80
88
  def associated_primary_key
81
- @associated_primary_key ||= associated_model_config.abstract_model.primary_key
82
- end
83
-
84
- # Reader for the association's key
85
- def foreign_key
86
- association.foreign_key
89
+ association.primary_key
87
90
  end
88
91
 
89
92
  # Reader whether this is a polymorphic association
@@ -14,13 +14,12 @@ module RailsAdmin
14
14
  include RailsAdmin::Config::Groupable
15
15
  include RailsAdmin::Config::Inspectable
16
16
 
17
- attr_reader :name, :properties, :abstract_model
17
+ attr_reader :name, :properties, :abstract_model, :parent, :root
18
18
  attr_accessor :defined, :order, :section
19
- attr_reader :parent, :root
20
19
 
21
- NAMED_INSTANCE_VARIABLES = [
22
- :@parent, :@root, :@section, :@children_fields_registered,
23
- :@associated_model_config, :@group
20
+ NAMED_INSTANCE_VARIABLES = %i[
21
+ @parent @root @section @children_fields_registered
22
+ @associated_model_config @group
24
23
  ].freeze
25
24
 
26
25
  def initialize(parent, name, properties)
@@ -36,7 +35,7 @@ module RailsAdmin
36
35
  end
37
36
 
38
37
  register_instance_option :css_class do
39
- "#{self.name}_field"
38
+ "#{name}_field"
40
39
  end
41
40
 
42
41
  def type_css_class
@@ -51,6 +50,10 @@ module RailsAdmin
51
50
  nil
52
51
  end
53
52
 
53
+ register_instance_option :sticky? do
54
+ false
55
+ end
56
+
54
57
  register_instance_option :sortable do
55
58
  !virtual? || children_fields.first || false
56
59
  end
@@ -78,7 +81,7 @@ module RailsAdmin
78
81
 
79
82
  # list of columns I should search for that field [{ column: 'table_name.column', type: field.type }, {..}]
80
83
  register_instance_option :searchable_columns do
81
- @searchable_columns ||= begin
84
+ @searchable_columns ||=
82
85
  case searchable
83
86
  when true
84
87
  [{column: "#{abstract_model.table_name}.#{name}", type: type}]
@@ -93,22 +96,21 @@ module RailsAdmin
93
96
  table_name, column = f.split '.'
94
97
  type = nil
95
98
  elsif f.is_a?(Hash) # <Model|table_name> => <attribute|column>
96
- am = f.keys.first.is_a?(Class) && AbstractModel.new(f.keys.first)
97
- table_name = am && am.table_name || f.keys.first
99
+ am = AbstractModel.new(f.keys.first) if f.keys.first.is_a?(Class)
100
+ table_name = am&.table_name || f.keys.first
98
101
  column = f.values.first
99
- property = am && am.properties.detect { |p| p.name == f.values.first.to_sym }
100
- type = property && property.type
102
+ property = am&.properties&.detect { |p| p.name == f.values.first.to_sym }
103
+ type = property&.type
101
104
  else # <attribute|column>
102
105
  am = (association? ? associated_model_config.abstract_model : abstract_model)
103
106
  table_name = am.table_name
104
107
  column = f
105
108
  property = am.properties.detect { |p| p.name == f.to_sym }
106
- type = property && property.type
109
+ type = property&.type
107
110
  end
108
111
  {column: "#{table_name}.#{column}", type: (type || :string)}
109
112
  end
110
113
  end
111
- end
112
114
  end
113
115
 
114
116
  register_instance_option :formatted_value do
@@ -155,7 +157,7 @@ module RailsAdmin
155
157
  #
156
158
  # @see RailsAdmin::AbstractModel.properties
157
159
  register_instance_option :length do
158
- @length ||= properties && properties.length
160
+ @length ||= properties&.length
159
161
  end
160
162
 
161
163
  # Accessor for field's length restrictions per validations
@@ -172,17 +174,17 @@ module RailsAdmin
172
174
  #
173
175
  # @see RailsAdmin::AbstractModel.properties
174
176
  register_instance_option :required? do
175
- context = begin
177
+ context =
176
178
  if bindings && bindings[:object]
177
179
  bindings[:object].persisted? ? :update : :create
178
180
  else
179
181
  :nil
180
182
  end
181
- end
183
+
182
184
  (@required ||= {})[context] ||= !!([name] + children_fields).uniq.detect do |column_name|
183
185
  abstract_model.model.validators_on(column_name).detect do |v|
184
186
  !(v.options[:allow_nil] || v.options[:allow_blank]) &&
185
- [:presence, :numericality, :attachment_presence].include?(v.kind) &&
187
+ %i[presence numericality attachment_presence].include?(v.kind) &&
186
188
  (v.options[:on] == context || v.options[:on].blank?) &&
187
189
  (v.options[:if].blank? && v.options[:unless].blank?)
188
190
  end
@@ -193,7 +195,7 @@ module RailsAdmin
193
195
  #
194
196
  # @see RailsAdmin::AbstractModel.properties
195
197
  register_instance_option :serial? do
196
- properties && properties.serial?
198
+ properties&.serial?
197
199
  end
198
200
 
199
201
  register_instance_option :view_helper do
@@ -213,6 +215,7 @@ module RailsAdmin
213
215
  returned = true
214
216
  (RailsAdmin.config.default_hidden_fields || {}).each do |section, fields|
215
217
  next unless self.section.is_a?("RailsAdmin::Config::Sections::#{section.to_s.camelize}".constantize)
218
+
216
219
  returned = false if fields.include?(name)
217
220
  end
218
221
  returned
@@ -223,14 +226,31 @@ module RailsAdmin
223
226
  []
224
227
  end
225
228
 
226
- register_instance_option :render do
227
- bindings[:view].render partial: "rails_admin/main/#{partial}", locals: {field: self, form: bindings[:form]}
228
- end
229
-
230
229
  register_instance_option :default_filter_operator do
231
230
  nil
232
231
  end
233
232
 
233
+ register_instance_option :eager_load do
234
+ false
235
+ end
236
+
237
+ register_deprecated_instance_option :eager_load?, :eager_load
238
+
239
+ def eager_load_values
240
+ case eager_load
241
+ when true
242
+ [name]
243
+ when false, nil
244
+ []
245
+ else
246
+ Array.wrap(eager_load)
247
+ end
248
+ end
249
+
250
+ register_instance_option :render do
251
+ bindings[:view].render partial: "rails_admin/main/#{partial}", locals: {field: self, form: bindings[:form]}
252
+ end
253
+
234
254
  def editable?
235
255
  !(@properties && @properties.read_only?)
236
256
  end
@@ -259,7 +279,7 @@ module RailsAdmin
259
279
  # @see RailsAdmin::Config::Fields::Base.register_instance_option :required?
260
280
  def optional(state = nil, &block)
261
281
  if !state.nil? || block
262
- required state.nil? ? proc { false == instance_eval(&block) } : false == state
282
+ required state.nil? ? proc { instance_eval(&block) == false } : state == false
263
283
  else
264
284
  optional?
265
285
  end
@@ -302,7 +322,7 @@ module RailsAdmin
302
322
  end
303
323
 
304
324
  def generic_help
305
- (required? ? I18n.translate('admin.form.required') : I18n.translate('admin.form.optional')) + '. '
325
+ "#{required? ? I18n.translate('admin.form.required') : I18n.translate('admin.form.optional')}. "
306
326
  end
307
327
 
308
328
  def generic_field_help
@@ -17,6 +17,7 @@ RailsAdmin::Config::Fields.register_factory do |parent, properties, fields|
17
17
  end
18
18
  children_fields = associations.map do |child_name|
19
19
  next unless child_association = parent.abstract_model.associations.detect { |p| p.name.to_sym == child_name }
20
+
20
21
  child_field = fields.detect { |f| f.name == child_name } || RailsAdmin::Config::Fields.default_factory.call(parent, child_association, fields)
21
22
  child_field.hide unless field == child_field
22
23
  child_field.filterable(false) unless field == child_field
@@ -3,18 +3,16 @@ require 'rails_admin/config/fields/types'
3
3
  require 'rails_admin/config/fields/types/belongs_to_association'
4
4
 
5
5
  RailsAdmin::Config::Fields.register_factory do |parent, properties, fields|
6
- if association = parent.abstract_model.associations.detect { |a| a.foreign_key == properties.name && [:belongs_to, :has_and_belongs_to_many].include?(a.type) }
6
+ if association = parent.abstract_model.associations.detect { |a| a.foreign_key == properties.name && %i[belongs_to has_and_belongs_to_many].include?(a.type) }
7
7
  field = RailsAdmin::Config::Fields::Types.load("#{association.polymorphic? ? :polymorphic : association.type}_association").new(parent, association.name, association)
8
8
  fields << field
9
9
 
10
10
  child_columns = []
11
- possible_field_names = begin
12
- if association.polymorphic?
13
- [:foreign_key, :foreign_type, :foreign_inverse_of]
14
- else
15
- [:foreign_key]
16
- end.collect { |k| association.send(k) }.compact
17
- end
11
+ possible_field_names = if association.polymorphic?
12
+ %i[foreign_key foreign_type foreign_inverse_of]
13
+ else
14
+ [:foreign_key]
15
+ end.collect { |k| association.send(k) }.compact
18
16
 
19
17
  parent.abstract_model.properties.select { |p| possible_field_names.include? p.name }.each do |column|
20
18
  unless child_field = fields.detect { |f| f.name.to_s == column.name.to_s }
@@ -7,12 +7,13 @@ RailsAdmin::Config::Fields.register_factory do |parent, properties, fields|
7
7
  if defined?(::CarrierWave) && model.is_a?(CarrierWave::Mount) && model.uploaders.include?(attachment_name = properties.name.to_s.chomp('_file_name').to_sym)
8
8
  columns = [model.uploader_options[attachment_name][:mount_on] || attachment_name, "#{attachment_name}_content_type".to_sym, "#{attachment_name}_file_size".to_sym]
9
9
  field = RailsAdmin::Config::Fields::Types.load(
10
- [:serialized, :json].include?(properties.type) ? :multiple_carrierwave : :carrierwave,
10
+ %i[serialized json].include?(properties.type) ? :multiple_carrierwave : :carrierwave,
11
11
  ).new(parent, attachment_name, properties)
12
12
  fields << field
13
13
  children_fields = []
14
14
  columns.each do |children_column_name|
15
15
  next unless child_properties = parent.abstract_model.properties.detect { |p| p.name.to_s == children_column_name.to_s }
16
+
16
17
  children_field = fields.detect { |f| f.name == children_column_name } || RailsAdmin::Config::Fields.default_factory.call(parent, child_properties, fields)
17
18
  children_field.hide unless field == children_field
18
19
  children_field.filterable(false) unless field == children_field
@@ -5,12 +5,13 @@ require 'rails_admin/config/fields/types/password'
5
5
  # Register a custom field factory for devise model
6
6
  RailsAdmin::Config::Fields.register_factory do |parent, properties, fields|
7
7
  if properties.name == :encrypted_password
8
- extensions = [:password_salt, :reset_password_token, :remember_token]
8
+ extensions = %i[password_salt reset_password_token remember_token]
9
9
  fields << RailsAdmin::Config::Fields::Types.load(:password).new(parent, :password, properties)
10
10
  fields << RailsAdmin::Config::Fields::Types.load(:password).new(parent, :password_confirmation, properties)
11
11
  extensions.each do |ext|
12
12
  properties = parent.abstract_model.properties.detect { |p| ext == p.name }
13
13
  next unless properties
14
+
14
15
  unless field = fields.detect { |f| f.name == ext }
15
16
  RailsAdmin::Config::Fields.default_factory.call(parent, properties, fields)
16
17
  field = fields.last