rails_admin 2.3.0 → 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 +7 -3
  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
@@ -0,0 +1,146 @@
1
+ <% params = request.params.except(:action, :controller, :utf8, :page, :per_page, :format, :authenticity_token) %>
2
+ <% visible_fields = @model_config.export.with(view: self, object: @abstract_model.model.new, controller: self.controller).visible_fields %>
3
+ <%= form_tag export_path(params.merge(all: true)), method: 'post', class: 'form-horizontal' do %>
4
+ <input name="send_data" type="hidden" value="true">/</input>
5
+ <fieldset id="fields_to_export">
6
+ <legend>
7
+ <i class="fas fa-chevron-down"></i>
8
+ <%= t('admin.export.select') %>
9
+ </legend>
10
+ <div class="form-group control-group">
11
+ <div class="col-sm-12">
12
+ <div class="checkbox">
13
+ <label for="check_all">
14
+ <%= check_box_tag 'all', 'all', true, { id: 'check_all' } %>
15
+ <b>
16
+ <%= t('admin.export.select_all_fields') %>
17
+ </b>
18
+ </label>
19
+ </div>
20
+ </div>
21
+ </div>
22
+ <div class="form-group control-group">
23
+ <div class="col-sm-12">
24
+ <div class="well well-sm reverse-selection" rel="tooltip" style="margin: 0; cursor: pointer;" title="<%= t('admin.export.click_to_reverse_selection') %>">
25
+ <b>
26
+ <%= t('admin.export.fields_from', name: @model_config.label_plural.downcase) %>
27
+ </b>
28
+ </div>
29
+ <div class="controls">
30
+ <div class="row">
31
+ <% visible_fields.select{ |f| !f.association? || f.association.polymorphic? }.each do |field| %>
32
+ <% list = field.virtual? ? 'methods' : 'only' %>
33
+ <div class="checkbox col-sm-3">
34
+ <% if field.association? && field.association.polymorphic? %>
35
+ <label for="schema_<%= list %>_<%= field.method_name %>">
36
+ <%= check_box_tag "schema[#{list}][]", field.method_name, true, { id: "schema_#{list}_#{field.method_name}" } %>
37
+ <%= field.label + " [id]" %>
38
+ </label>
39
+ <% polymorphic_type_column_name = @abstract_model.properties.detect {|p| field.association.foreign_type == p.name }.name %>
40
+ <label for="schema_<%= list %>_<%= polymorphic_type_column_name %>">
41
+ <%= check_box_tag "schema[#{list}][]", polymorphic_type_column_name, true, { id: "schema_#{list}_#{polymorphic_type_column_name}" } %>
42
+ <%= field.label + " [type]" %>
43
+ </label>
44
+ <% else %>
45
+ <label for="schema_<%= list %>_<%= field.name %>">
46
+ <%= check_box_tag "schema[#{list}][]", field.name, true, { id: "schema_#{list}_#{field.name}" } %>
47
+ <%= field.label %>
48
+ </label>
49
+ <% end %>
50
+ </div>
51
+ <% end %>
52
+ </div>
53
+ </div>
54
+ </div>
55
+ </div>
56
+ <% visible_fields.select{ |f| f.association? && !f.association.polymorphic? }.each do |field| %>
57
+ <% fields = field.associated_model_config.export.with(controller: self.controller, view: self, object: (associated_model = field.associated_model_config.abstract_model.model).new).visible_fields.select{ |f| !f.association? } %>
58
+ <div class="form-group control-group">
59
+ <div class="col-sm-12">
60
+ <div class="well well-sm reverse-selection" rel="tooltip" style="margin: 0; cursor: pointer;" title="<%= t('admin.export.click_to_reverse_selection') %>">
61
+ <b>
62
+ <%= t('admin.export.fields_from_associated', name: field.label.downcase) %>
63
+ </b>
64
+ </div>
65
+ <div class="controls">
66
+ <div class="row">
67
+ <% fields.each do |associated_model_field| %>
68
+ <% list = associated_model_field.virtual? ? 'methods' : 'only' %>
69
+ <div class="checkbox col-sm-3">
70
+ <label for="schema_include_<%= field.name %>_<%= list %>_<%= associated_model_field.name %>">
71
+ <%= check_box_tag "schema[include][#{field.name}][#{list}][]", associated_model_field.name, true, { id: "schema_include_#{field.name}_#{list}_#{associated_model_field.name}" } %>
72
+ <%= associated_model_field.label %>
73
+ </label>
74
+ </div>
75
+ <% end %>
76
+ </div>
77
+ </div>
78
+ </div>
79
+ </div>
80
+ <% end %>
81
+ </fieldset>
82
+ <fieldset>
83
+ <legend>
84
+ <i class="fas fa-chevron-down"></i>
85
+ <%= t('admin.export.options_for', name: 'csv') %>
86
+ </legend>
87
+ <div class="form-group control-group">
88
+ <% guessed_encoding = @abstract_model.encoding %>
89
+ <label class="col-sm-2 control-label" for="csv_options_encoding_to">
90
+ <%= t('admin.export.csv.encoding_to') %>
91
+ </label>
92
+ <div class="col-sm-10 controls">
93
+ <% # from http://books.google.com/support/partner/bin/answer.py?answer=30990 : %>
94
+ <%= select_tag 'csv_options[encoding_to]', options_for_select(Encoding.name_list.sort), include_blank: true, placeholder: t('admin.misc.search'), :'data-enumeration' => true %>
95
+ <p class="help-block">
96
+ <%= t('admin.export.csv.encoding_to_help', name: guessed_encoding) %>
97
+ </p>
98
+ </div>
99
+ </div>
100
+ <div class="form-group control-group">
101
+ <label class="col-sm-2 control-label" for="csv_options_skip_header">
102
+ <%= t('admin.export.csv.skip_header') %>
103
+ </label>
104
+ <div class="col-sm-10 controls">
105
+ <div class="checkbox">
106
+ <label style="display: block;">
107
+ <%= check_box_tag 'csv_options[skip_header]', 'true' %>
108
+ </label>
109
+ </div>
110
+ <p class="help-block">
111
+ <%= t('admin.export.csv.skip_header_help') %>
112
+ </p>
113
+ </div>
114
+ </div>
115
+ <div class="form-group control-group">
116
+ <label class="col-sm-2 control-label" for="csv_options_generator_col_sep">
117
+ <%= t('admin.export.csv.col_sep') %>
118
+ </label>
119
+ <div class="col-sm-10 controls">
120
+ <%= select_tag 'csv_options[generator][col_sep]', options_for_select({ '' => t('admin.export.csv.default_col_sep'), "<comma> ','" => ',', "<semicolon> ';'" => ';', '<tabs>' => "'\t'" }), placeholder: t('admin.misc.search'), :'data-enumeration' => true %>
121
+ <p class="help-block">
122
+ <%= t('admin.export.csv.col_sep_help', value: t('admin.export.csv.default_col_sep')) %>
123
+ </p>
124
+ </div>
125
+ </div>
126
+ </fieldset>
127
+ <div class="form-group form-actions">
128
+ <div class="col-sm-offset-2 col-sm-10">
129
+ <input name="return_to" type="<%= :hidden %>" value="<%= (params[:return_to].presence || request.referer) %>"></input>
130
+ <button class="btn btn-primary" name="csv" type="submit">
131
+ <i class="fas fa-check"></i>
132
+ <%= t("admin.export.confirmation", name: 'csv') %>
133
+ </button>
134
+ <button class="btn btn-info" name="json" type="submit">
135
+ <%= t("admin.export.confirmation", name: 'json') %>
136
+ </button>
137
+ <button class="btn btn-info" name="xml" type="submit">
138
+ <%= t("admin.export.confirmation", name: 'xml') %>
139
+ </button>
140
+ <button class="btn" name="_continue" type="submit">
141
+ <i class="fas fa-times"></i>
142
+ <%= t("admin.form.cancel") %>
143
+ </button>
144
+ </div>
145
+ </div>
146
+ <% end %>
@@ -0,0 +1,78 @@
1
+ <% params = request.params.except(:action, :controller, :model_name) %>
2
+ <% query = params[:query] %>
3
+ <% filter = params[:filter] %>
4
+ <% sort = params[:sort] %>
5
+ <% sort_reverse = params[:sort_reverse] %>
6
+ <% path_method = params[:id] ? "history_show_path" : "history_index_path" %>
7
+ <%= form_tag("", method: "get", class: "search pjax-form form-inline") do %>
8
+ <div class="well">
9
+ <div class="input-group">
10
+ <input class="input-small form-control input-small" name="query" placeholder="<%= t("admin.misc.filter") %>" type="search" value="<%= query %>"></input>
11
+ <span class="input-group-btn">
12
+ <button class="btn btn-primary" data-disable-with="<%= '<i class="fas fa-sync"></i> '.html_safe + t('admin.misc.refresh') %>" type="submit">
13
+ <i class="fas fa-sync"></i>
14
+ <%= t("admin.misc.refresh") %>
15
+ </button>
16
+ </span>
17
+ </div>
18
+ </div>
19
+ <% end %>
20
+ <table class="table table-condensed table-striped table-hover" id="history">
21
+ <thead>
22
+ <tr>
23
+ <% columns = [] %>
24
+ <% columns << { property_name: "created_at", css_class: "created_at",link_text: t('admin.table_headers.created_at') } %>
25
+ <% columns << { property_name: "username", css_class: "username", link_text: t('admin.table_headers.username') } %>
26
+ <% columns << { property_name: "item", css_class: "item", link_text: t('admin.table_headers.item') } if @general %>
27
+ <% columns << { property_name: "message", css_class: "message", link_text: t('admin.table_headers.message') } %>
28
+ <% columns.each do |column| %>
29
+ <% property_name = column[:property_name] %>
30
+ <% selected = (sort == property_name) %>
31
+ <% sort_direction = (sort_reverse ? "headerSortUp" : "headerSortDown" if selected) %>
32
+ <% sort_location = send(path_method, params.except("sort_reverse").merge(model_name: @abstract_model.to_param, sort: property_name).merge(selected && sort_reverse != "true" ? {sort_reverse: "true"} : {})) %>
33
+ <th class="header pjax <%= column[:css_class] %> <%= sort_direction if selected %>" data-href="<%= sort_location %>">
34
+ <%= column[:link_text] %>
35
+ </th>
36
+ <% end %>
37
+ </tr>
38
+ </thead>
39
+ <tbody>
40
+ <% @history.each_with_index do |object, index| %>
41
+ <tr>
42
+ <% unless object.created_at.nil? %>
43
+ <td>
44
+ <%= l(object.created_at, format: :long, default: l(object.created_at, format: :long)) %>
45
+ </td>
46
+ <% end %>
47
+ <td>
48
+ <%= object.username %>
49
+ </td>
50
+ <% if @general %>
51
+ <% if o = @abstract_model.get(object.item) %>
52
+ <% label = o.send(@abstract_model.config.object_label_method) %>
53
+ <% if show_action = action(:show, @abstract_model, o) %>
54
+ <td>
55
+ <%= link_to(label, url_for(action: show_action.action_name, model_name: @abstract_model.to_param, id: o.id), class: 'pjax') %>
56
+ </td>
57
+ <% else %>
58
+ <td>
59
+ <%= label %>
60
+ </td>
61
+ <% end %>
62
+ <% else %>
63
+ <td>
64
+ <%= "#{@abstract_model.config.label} ##{object.item}" %>
65
+ </td>
66
+ <% end %>
67
+ <% end %>
68
+ <td>
69
+ <%= object.message.in?(['delete', 'new']) ? t("admin.actions.#{object.message}.done").capitalize : object.message %>
70
+ </td>
71
+ </tr>
72
+ <% end %>
73
+ </tbody>
74
+ </table>
75
+ <% unless params[:all] || !@history.respond_to?(:current_page) %>
76
+ <%= paginate(@history, theme: 'ra-twitter-bootstrap', remote: true) %>
77
+ <%= link_to(t("admin.misc.show_all"), send(path_method, params.merge(all: true)), class: "show-all btn pjax") unless (tc = @history.total_count) <= @history.size || tc > 100 %>
78
+ <% end %>
@@ -0,0 +1,193 @@
1
+ <%
2
+ query = params[:query]
3
+ params = request.params.except(:authenticity_token, :action, :controller, :utf8, :bulk_export, :_pjax)
4
+ params.delete(:query) if params[:query].blank?
5
+ params.delete(:sort_reverse) unless params[:sort_reverse] == 'true'
6
+ sort_reverse = params[:sort_reverse]
7
+ sort = params[:sort]
8
+ params.delete(:sort) if params[:sort] == @model_config.list.sort_by.to_s
9
+ export_action = RailsAdmin::Config::Actions.find(:export, { controller: self.controller, abstract_model: @abstract_model })
10
+ export_action = nil unless export_action && authorized?(export_action.authorization_key, @abstract_model)
11
+ description = RailsAdmin.config(@abstract_model.model_name).description
12
+ properties = @model_config.list.with(controller: self.controller, view: self, object: @abstract_model.model.new).fields_for_table
13
+ checkboxes = @model_config.list.checkboxes?
14
+ table_table_header_count = begin
15
+ count = checkboxes ? 1 : 0
16
+ count = count + properties.count
17
+ end
18
+ %>
19
+
20
+ <% content_for :contextual_tabs do %>
21
+ <% if checkboxes %>
22
+ <%= bulk_menu %>
23
+ <% end %>
24
+ <% if filterable_fields.present? %>
25
+ <li class="dropdown" style="float:right">
26
+ <a class="dropdown-toggle" data-toggle="dropdown" href="#">
27
+ <%= t('admin.misc.add_filter') %>
28
+ <b class="caret"></b>
29
+ </a>
30
+ <ul class="dropdown-menu" id="filters" style="left:auto; right:0;">
31
+ <% filterable_fields.each do |field| %>
32
+ <%
33
+ field_options = case field.type
34
+ when :enum
35
+ options_for_select(field.with(object: @abstract_model.model.new).enum)
36
+ else
37
+ ''
38
+ end
39
+ %>
40
+ <li>
41
+ <a
42
+ href="#"
43
+ data-field-label="<%= field.label %>"
44
+ data-field-name="<%= field.name %>"
45
+ data-field-operator="<%= field.default_filter_operator %>"
46
+ data-field-options="<%= "#{field_options}" %>"
47
+ data-field-required="<%= field.required.to_s %>"
48
+ data-field-type="<%= field.type %>"
49
+ data-field-value=""
50
+ data-field-datetimepicker-format="<%= field.try(:momentjs_format) %>"
51
+ >
52
+ <%= field.label %>
53
+ </a>
54
+ </li>
55
+ <% end %>
56
+ </ul>
57
+ </li>
58
+ <% end %>
59
+ <% end %>
60
+
61
+ <style>
62
+ <% properties.select{ |p| p.column_width.present? }.each do |property| %>
63
+ <%= "#list th.#{property.css_class} { width: #{property.column_width}px; min-width: #{property.column_width}px; }" %>
64
+ <%= "#list td.#{property.css_class} { max-width: #{property.column_width}px;}" %>
65
+ <% end %>
66
+ </style>
67
+
68
+ <div id="list">
69
+ <%= form_tag(index_path(params.except(*%w[page f query])), method: :get, class: "pjax-form form-inline") do %>
70
+ <div class="well">
71
+ <span data-options="<%= ordered_filter_options.to_json %>" id="filters_box"></span>
72
+ <hr class="filters_box" style="display:<%= ordered_filters.empty? ? 'none' : 'block' %>"/>
73
+ <div class="input-group">
74
+ <input class="form-control input-small" name="query" placeholder="<%= t("admin.misc.filter") %>" type="search" value="<%= query %>"></input>
75
+ <span class="input-group-btn">
76
+ <button class="btn btn-primary" data-disable-with="<%= '<i class="fas fa-sync"></i>' + t('admin.misc.refresh') %>" type="submit">
77
+ <i class="fas fa-sync"></i>
78
+ <%= t('admin.misc.refresh') %>
79
+ </button>
80
+ <button class="btn btn-info" id="remove_filter" title="<%= t('admin.misc.reset_filters') %>">
81
+ <i class="fas fa-times"></i>
82
+ </button>
83
+ </span>
84
+ </div>
85
+ <% if export_action %>
86
+ <span style="float:right">
87
+ <%= link_to wording_for(:link, export_action), export_path(params.except('page')), class: 'btn btn-info' %>
88
+ </span>
89
+ <% end %>
90
+ </div>
91
+ <% end %>
92
+ <% unless @model_config.list.scopes.empty? %>
93
+ <ul class="nav nav-tabs" id="scope_selector">
94
+ <% @model_config.list.scopes.each_with_index do |scope, index| %>
95
+ <% scope = '_all' if scope.nil? %>
96
+ <li class="<%= 'active' if scope.to_s == params[:scope] || (params[:scope].blank? && index == 0) %>">
97
+ <a class="pjax" href="<%= index_path(params.merge(scope: scope, page: nil)) %>">
98
+ <%= I18n.t("admin.scopes.#{@abstract_model.to_param}.#{scope}", default: I18n.t("admin.scopes.#{scope}", default: scope.to_s.titleize)) %>
99
+ </a>
100
+ </li>
101
+ <% end %>
102
+ </ul>
103
+ <% end %>
104
+ <%= form_tag bulk_action_path(model_name: @abstract_model.to_param), method: :post, id: "bulk_form", class: ["form"] do %>
105
+ <%= hidden_field_tag :bulk_action %>
106
+ <% if description.present? %>
107
+ <p>
108
+ <strong>
109
+ <%= description %>
110
+ </strong>
111
+ </p>
112
+ <% end %>
113
+ <div id="sidescroll">
114
+ <table class="table table-condensed table-striped table-hover">
115
+ <thead>
116
+ <tr>
117
+ <% if checkboxes %>
118
+ <th class="shrink sticky">
119
+ <input class="toggle" type="checkbox"></input>
120
+ </th>
121
+ <% end %>
122
+ <% properties.each do |property| %>
123
+ <% selected = (sort == property.name.to_s) %>
124
+ <% if property.sortable %>
125
+ <% sort_location = index_path params.except('sort_reverse').except('page').merge(sort: property.name).merge(selected && sort_reverse != "true" ? {sort_reverse: "true"} : {}) %>
126
+ <% sort_direction = (sort_reverse == 'true' ? "headerSortUp" : "headerSortDown" if selected) %>
127
+ <% end %>
128
+ <th class="<%= [property.sortable && "header pjax", property.sortable && sort_direction, property.sticky? && 'sticky', property.css_class, property.type_css_class].compact.join(' ') %>" data-href="<%= property.sortable && sort_location %>" rel="tooltip" title="<%= property.hint %>">
129
+ <%= property.label %>
130
+ </th>
131
+ <% end %>
132
+ <th class="last shrink"></th>
133
+ </tr>
134
+ </thead>
135
+ <tbody>
136
+ <% @objects.each do |object| %>
137
+ <tr class="<%= @abstract_model.param_key %>_row <%= @model_config.list.with(object: object).row_css_class %>">
138
+ <% if checkboxes %>
139
+ <td class="sticky">
140
+ <%= check_box_tag "bulk_ids[]", object.id, false %>
141
+ </td>
142
+ <% end %>
143
+ <% properties.map{ |property| property.bind(:object, object) }.each do |property| %>
144
+ <% value = property.pretty_value %>
145
+ <td class="<%= [property.sticky? && 'sticky', property.css_class, property.type_css_class].compact.join(' ') %>" title="<%= strip_tags(value.to_s) %>">
146
+ <%= value %>
147
+ </td>
148
+ <% end %>
149
+ <td class="last links ra-sidescroll-frozen">
150
+ <ul class="inline list-inline">
151
+ <%= menu_for :member, @abstract_model, object, true %>
152
+ </ul>
153
+ </td>
154
+ </tr>
155
+ <% end %>
156
+ <% if @objects.empty? %>
157
+ <tr class="empty_row">
158
+ <td colspan="<%= table_table_header_count %>">
159
+ <%= I18n.t('admin.actions.index.no_records') %>
160
+ </td>
161
+ </tr>
162
+ <% end %>
163
+ </tbody>
164
+ </table>
165
+ </div>
166
+ <% if @model_config.list.limited_pagination %>
167
+ <div class="row">
168
+ <div class="col-md-6">
169
+ <%= paginate(@objects, theme: 'ra-twitter-bootstrap/without_count', total_pages: Float::INFINITY, remote: true) %>
170
+ </div>
171
+ </div>
172
+ <% elsif @objects.respond_to?(:total_count) %>
173
+ <% total_count = @objects.total_count.to_i %>
174
+ <div class="row">
175
+ <div class="col-md-6">
176
+ <%= paginate(@objects, theme: 'ra-twitter-bootstrap', remote: true) %>
177
+ </div>
178
+ </div>
179
+ <div class="row">
180
+ <div class="col-md-6">
181
+ <%= link_to(t("admin.misc.show_all"), index_path(params.merge(all: true)), class: "show-all btn btn-default clearfix pjax") unless total_count > 100 || total_count <= @objects.to_a.size %>
182
+ </div>
183
+ </div>
184
+ <div class="clearfix total-count">
185
+ <%= "#{total_count} #{@model_config.pluralize(total_count).downcase}" %>
186
+ </div>
187
+ <% else %>
188
+ <div class="clearfix total-count">
189
+ <%= "#{@objects.size} #{@model_config.pluralize(@objects.size).downcase}" %>
190
+ </div>
191
+ <% end %>
192
+ <% end %>
193
+ </div>
@@ -0,0 +1,3 @@
1
+ <%= rails_admin_form_for @object, url: new_path(model_name: @abstract_model.to_param), as: @abstract_model.param_key, html: { multipart: true, class: "form-horizontal denser", data: { title: @page_name } } do |form| %>
2
+ <%= form.generate action: :create %>
3
+ <% end %>
@@ -0,0 +1,28 @@
1
+ <% @model_config.show.with(object: @object, view: self, controller: self.controller).visible_groups.each do |fieldset| %>
2
+ <% unless (fields = fieldset.with(object: @object, view: self, controller: self.controller).visible_fields).empty? %>
3
+ <% unless (fields = fields.reject{ |f| RailsAdmin::config.compact_show_view && (f.formatted_value.nil? || f.formatted_value == '') }).empty? %>
4
+ <div class="fieldset">
5
+ <h4>
6
+ <%= fieldset.label %>
7
+ </h4>
8
+ <% if fieldset.help %>
9
+ <p>
10
+ <%= fieldset.help %>
11
+ </p>
12
+ <% end %>
13
+ <dl>
14
+ <% fields.each_with_index do |field, index| %>
15
+ <dt>
16
+ <span class="<%= field.type_css_class %> <%= field.css_class %> label label-info">
17
+ <%= field.label %>
18
+ </span>
19
+ </dt>
20
+ <dd class="well">
21
+ <%= field.pretty_value %>
22
+ </dd>
23
+ <% end %>
24
+ </dl>
25
+ </div>
26
+ <% end %>
27
+ <% end %>
28
+ <% end %>
@@ -2,7 +2,9 @@ ActiveSupport.on_load(:active_record) do
2
2
  module ActiveRecord
3
3
  class Base
4
4
  def self.rails_admin(&block)
5
- RailsAdmin.config(self, &block)
5
+ RailsAdmin.config do |config|
6
+ config.model(self, &block)
7
+ end
6
8
  end
7
9
 
8
10
  def rails_admin_default_object_label_method
@@ -1,4 +1,4 @@
1
1
  if defined?(::Mongoid::Document)
2
2
  require 'rails_admin/adapters/mongoid/extension'
3
- Mongoid::Document.send(:include, RailsAdmin::Adapters::Mongoid::Extension)
3
+ Mongoid::Document.include RailsAdmin::Adapters::Mongoid::Extension
4
4
  end
@@ -11,6 +11,7 @@ en:
11
11
  yesterday: Yesterday
12
12
  this_week: This week
13
13
  last_week: Last week
14
+ time: Time ...
14
15
  number: Number ...
15
16
  contains: Contains
16
17
  does_not_contain: Does not contain
@@ -19,6 +20,7 @@ en:
19
20
  ends_with: Ends with
20
21
  too_many_objects: "Too many objects, use search box above"
21
22
  no_objects: "No objects found"
23
+ clear: Clear
22
24
  loading: "Loading..."
23
25
  toggle_navigation: Toggle navigation
24
26
  home:
@@ -72,6 +74,7 @@ en:
72
74
  title: "List of %{model_label_plural}"
73
75
  menu: "List"
74
76
  breadcrumb: "%{model_label_plural}"
77
+ no_records: "No records found"
75
78
  show:
76
79
  title: "Details for %{model_label} '%{object_label}'"
77
80
  menu: "Show"
@@ -127,6 +130,7 @@ en:
127
130
  save: "Save"
128
131
  save_and_add_another: "Save and add another"
129
132
  save_and_edit: "Save and edit"
133
+ delete_file: "Delete '%{field_label}' #%{number}"
130
134
  all_of_the_following_related_items_will_be_deleted: "? The following related items may be deleted or orphaned:"
131
135
  are_you_sure_you_want_to_delete_the_object: "Are you sure you want to delete this %{model_name}"
132
136
  confirmation: "Yes, I'm sure"
@@ -141,7 +145,7 @@ en:
141
145
  display: "Display %{name}: %{type}"
142
146
  options_for: "Options for %{name}"
143
147
  empty_value_for_associated_objects: "<empty>"
144
- click_to_reverse_selection: 'Click to reverse selection'
148
+ click_to_reverse_selection: "Click to reverse selection"
145
149
  csv:
146
150
  header_for_root_methods: "%{name}" # 'model' is available
147
151
  header_for_association_methods: "%{name} [%{association}]"
@@ -1,18 +1,66 @@
1
1
  require 'rails/generators'
2
- require File.expand_path('../utils', __FILE__)
2
+ require File.expand_path('utils', __dir__)
3
3
 
4
4
  module RailsAdmin
5
5
  class InstallGenerator < Rails::Generators::Base
6
- source_root File.expand_path('../templates', __FILE__)
6
+ source_root File.expand_path('templates', __dir__)
7
7
  include Generators::Utils::InstanceMethods
8
8
 
9
9
  argument :_namespace, type: :string, required: false, desc: 'RailsAdmin url namespace'
10
+ class_option :asset, type: :string, required: false, default: nil, desc: 'Asset delivery method [options: webpack, webpacker, sprockets]'
10
11
  desc 'RailsAdmin installation generator'
11
12
 
12
13
  def install
13
14
  namespace = ask_for('Where do you want to mount rails_admin?', 'admin', _namespace)
14
15
  route("mount RailsAdmin::Engine => '/#{namespace}', as: 'rails_admin'")
15
- template 'initializer.erb', 'config/initializers/rails_admin.rb'
16
+ if File.exist? File.join(destination_root, 'config/initializers/rails_admin.rb')
17
+ insert_into_file 'config/initializers/rails_admin.rb', " config.asset_source = :#{asset}\n", after: "RailsAdmin.config do |config|\n"
18
+ else
19
+ template 'initializer.erb', 'config/initializers/rails_admin.rb'
20
+ end
21
+ display "Using [#{asset}] for asset delivery method"
22
+ case asset
23
+ when 'webpack'
24
+ configure_for_webpack
25
+ when 'webpacker'
26
+ configure_for_webpacker5
27
+ when 'sprockets'
28
+ configure_for_sprockets
29
+ end
30
+ end
31
+
32
+ private
33
+
34
+ def asset
35
+ return options['asset'] if options['asset']
36
+
37
+ if Rails.root.join('webpack.config.js').exist?
38
+ 'webpack'
39
+ elsif defined?(Webpacker)
40
+ 'webpacker'
41
+ else
42
+ 'sprockets'
43
+ end
44
+ end
45
+
46
+ def configure_for_sprockets
47
+ gem 'sassc-rails'
48
+ end
49
+
50
+ def configure_for_webpacker5
51
+ run "yarn add rails_admin@#{RailsAdmin::Version.js}"
52
+ @scss_relative_dir = '../stylesheets/'
53
+ template 'rails_admin.js.erb', 'app/javascript/packs/rails_admin.js'
54
+ template 'rails_admin.scss', 'app/javascript/stylesheets/rails_admin.scss'
55
+ template 'environment.js', 'config/webpack/environment.js'
56
+ end
57
+
58
+ def configure_for_webpack
59
+ run "yarn add rails_admin@#{RailsAdmin::Version.js} css-loader mini-css-extract-plugin sass sass-loader"
60
+ @scss_relative_dir = './'
61
+ template 'rails_admin.js.erb', 'app/javascript/rails_admin.js'
62
+ template 'rails_admin.scss', 'app/javascript/rails_admin.scss'
63
+ template 'webpack.config.js', 'webpack.config.js'
16
64
  end
17
65
  end
18
66
  end
@@ -0,0 +1,6 @@
1
+ const webpack = require('webpack');
2
+ const { environment } = require('@rails/webpacker')
3
+
4
+ environment.plugins.append('ProvidePlugin-jQuery', new webpack.ProvidePlugin({jQuery: 'jquery'}));
5
+
6
+ module.exports = environment
@@ -1,4 +1,5 @@
1
1
  RailsAdmin.config do |config|
2
+ config.asset_source = :<%= asset %>
2
3
 
3
4
  ### Popular gems integration
4
5
 
@@ -17,7 +18,7 @@ RailsAdmin.config do |config|
17
18
  ## == PaperTrail ==
18
19
  # config.audit_with :paper_trail, 'User', 'PaperTrail::Version' # PaperTrail >= 3.0.0
19
20
 
20
- ### More at https://github.com/sferik/rails_admin/wiki/Base-configuration
21
+ ### More at https://github.com/railsadminteam/rails_admin/wiki/Base-configuration
21
22
 
22
23
  ## == Gravatar integration ==
23
24
  ## To disable Gravatar integration in Navigation Bar set to false
@@ -0,0 +1,2 @@
1
+ import "rails_admin/src/rails_admin/base";
2
+ import "<%= @scss_relative_dir %>rails_admin.scss";
@@ -0,0 +1 @@
1
+ @import "~rails_admin/src/rails_admin/styles/base";
@@ -0,0 +1,32 @@
1
+ const path = require("path")
2
+ const webpack = require('webpack')
3
+ const MiniCssExtractPlugin = require("mini-css-extract-plugin")
4
+
5
+ module.exports = {
6
+ mode: "production",
7
+ entry: {
8
+ application: "./app/javascript/application.js",
9
+ rails_admin: "./app/javascript/rails_admin.js",
10
+ },
11
+ output: {
12
+ filename: "[name].js",
13
+ path: path.resolve(__dirname, "app/assets/builds"),
14
+ },
15
+ module: {
16
+ rules: [
17
+ {
18
+ test: /.s?css$/,
19
+ use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"],
20
+ },
21
+ ],
22
+ },
23
+ plugins: [
24
+ new webpack.optimize.LimitChunkCountPlugin({
25
+ maxChunks: 1
26
+ }),
27
+ new webpack.ProvidePlugin({
28
+ jQuery: "jquery"
29
+ }),
30
+ new MiniCssExtractPlugin(),
31
+ ]
32
+ }