activeadmin 2.2.0 → 2.12.0

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

Potentially problematic release.


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

Files changed (274) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +382 -32
  3. data/CONTRIBUTING.md +45 -67
  4. data/README.md +11 -4
  5. data/app/assets/javascripts/active_admin/base.js +524 -0
  6. data/app/assets/stylesheets/active_admin/_base.scss +53 -37
  7. data/app/assets/stylesheets/active_admin/_forms.scss +0 -10
  8. data/app/assets/stylesheets/active_admin/_header.scss +40 -8
  9. data/app/assets/stylesheets/active_admin/_mixins.scss +1 -1
  10. data/{vendor → app}/assets/stylesheets/active_admin/_normalize.scss +25 -123
  11. data/app/assets/stylesheets/active_admin/{print.scss → _print.scss} +2 -2
  12. data/app/assets/stylesheets/active_admin/components/_comments.scss +2 -2
  13. data/app/assets/stylesheets/active_admin/components/_date_picker.scss +1 -2
  14. data/app/assets/stylesheets/active_admin/components/_dropdown_menu.scss +0 -1
  15. data/app/assets/stylesheets/active_admin/components/_tables.scss +1 -2
  16. data/app/assets/stylesheets/active_admin/mixins/_all.scss +8 -8
  17. data/app/assets/stylesheets/active_admin/mixins/_variables.scss +17 -0
  18. data/app/assets/stylesheets/active_admin/structure/_main_structure.scss +1 -1
  19. data/app/assets/stylesheets/active_admin/structure/_title_bar.scss +0 -1
  20. data/app/javascript/active_admin/base.js +28 -0
  21. data/app/{assets/javascripts/active_admin/lib/batch_actions.es6 → javascript/active_admin/initializers/batch-actions.js} +9 -3
  22. data/app/javascript/active_admin/initializers/checkbox-toggler.js +3 -0
  23. data/app/javascript/active_admin/initializers/dropdown-menu.js +9 -0
  24. data/app/javascript/active_admin/initializers/filters.js +10 -0
  25. data/app/{assets/javascripts/active_admin/lib/has_many.es6 → javascript/active_admin/initializers/has-many.js} +4 -1
  26. data/app/javascript/active_admin/initializers/per-page.js +13 -0
  27. data/app/javascript/active_admin/initializers/table-checkbox-toggler.js +3 -0
  28. data/app/{assets/javascripts/active_admin/lib/checkbox-toggler.es6 → javascript/active_admin/lib/checkbox-toggler.js} +5 -5
  29. data/app/{assets/javascripts/active_admin/lib/dropdown-menu.es6 → javascript/active_admin/lib/dropdown-menu.js} +3 -10
  30. data/app/javascript/active_admin/lib/filters.js +39 -0
  31. data/app/{assets/javascripts/active_admin/lib/modal_dialog.es6 → javascript/active_admin/lib/modal-dialog.js} +10 -8
  32. data/app/javascript/active_admin/lib/per-page.js +38 -0
  33. data/app/{assets/javascripts/active_admin/lib/table-checkbox-toggler.es6 → javascript/active_admin/lib/table-checkbox-toggler.js} +5 -3
  34. data/app/javascript/active_admin/lib/utils.js +40 -0
  35. data/app/views/active_admin/devise/mailer/reset_password_instructions.html.erb +1 -1
  36. data/app/views/active_admin/devise/mailer/unlock_instructions.html.erb +2 -2
  37. data/app/views/active_admin/devise/shared/_links.erb +1 -1
  38. data/app/views/active_admin/page/index.html.arb +1 -0
  39. data/app/views/active_admin/resource/edit.html.arb +1 -0
  40. data/app/views/active_admin/resource/index.html.arb +1 -0
  41. data/app/views/active_admin/resource/new.html.arb +1 -0
  42. data/app/views/active_admin/resource/show.html.arb +1 -0
  43. data/app/views/kaminari/active_admin_countless/_first_page.html.erb +11 -0
  44. data/app/views/kaminari/active_admin_countless/_gap.html.erb +8 -0
  45. data/app/views/kaminari/active_admin_countless/_next_page.html.erb +11 -0
  46. data/app/views/kaminari/active_admin_countless/_page.html.erb +12 -0
  47. data/app/views/kaminari/active_admin_countless/_paginator.html.erb +24 -0
  48. data/app/views/kaminari/active_admin_countless/_prev_page.html.erb +11 -0
  49. data/app/views/layouts/active_admin.html.arb +1 -0
  50. data/app/views/layouts/active_admin_logged_out.html.erb +15 -5
  51. data/config/locales/ar.yml +6 -6
  52. data/config/locales/az.yml +138 -0
  53. data/config/locales/ca.yml +0 -1
  54. data/config/locales/de.yml +18 -0
  55. data/config/locales/en-CA.yml +3 -3
  56. data/config/locales/en-GB.yml +3 -3
  57. data/config/locales/en.yml +3 -3
  58. data/config/locales/es-MX.yml +2 -1
  59. data/config/locales/es.yml +5 -5
  60. data/config/locales/fr.yml +4 -4
  61. data/config/locales/it.yml +18 -0
  62. data/config/locales/ja.yml +3 -3
  63. data/config/locales/ko.yml +1 -1
  64. data/config/locales/lv.yml +2 -2
  65. data/config/locales/nl.yml +1 -1
  66. data/config/locales/ro.yml +3 -2
  67. data/config/locales/sk.yml +59 -0
  68. data/config/locales/vi.yml +6 -5
  69. data/docs/0-installation.md +27 -3
  70. data/docs/1-general-configuration.md +20 -0
  71. data/docs/11-decorators.md +16 -5
  72. data/docs/2-resource-customization.md +11 -2
  73. data/docs/3-index-pages/index-as-table.md +7 -0
  74. data/docs/3-index-pages.md +1 -1
  75. data/docs/5-forms.md +7 -2
  76. data/docs/6-show-pages.md +12 -0
  77. data/docs/8-custom-actions.md +1 -1
  78. data/docs/9-batch-actions.md +2 -2
  79. data/docs/Gemfile +3 -3
  80. data/docs/Gemfile.lock +192 -158
  81. data/docs/_config.yml +2 -0
  82. data/docs/_includes/top-menu.html +2 -2
  83. data/docs/documentation.md +1 -1
  84. data/docs/index.html +109 -8
  85. data/docs/stylesheets/main.css +29 -0
  86. data/lib/active_admin/abstract_view_factory.rb +1 -0
  87. data/lib/active_admin/application.rb +20 -20
  88. data/lib/active_admin/application_settings.rb +4 -3
  89. data/lib/active_admin/asset_registration.rb +1 -0
  90. data/lib/active_admin/authorization_adapter.rb +4 -3
  91. data/lib/active_admin/base_controller/authorization.rb +15 -13
  92. data/lib/active_admin/base_controller/menu.rb +1 -0
  93. data/lib/active_admin/base_controller.rb +6 -5
  94. data/lib/active_admin/batch_actions/controller.rb +4 -3
  95. data/lib/active_admin/batch_actions/resource_extension.rb +10 -8
  96. data/lib/active_admin/batch_actions/views/batch_action_form.rb +4 -3
  97. data/lib/active_admin/batch_actions/views/batch_action_selector.rb +7 -6
  98. data/lib/active_admin/batch_actions/views/selection_cells.rb +4 -3
  99. data/lib/active_admin/batch_actions.rb +1 -0
  100. data/lib/active_admin/callbacks.rb +1 -0
  101. data/lib/active_admin/cancan_adapter.rb +2 -1
  102. data/lib/active_admin/collection_decorator.rb +32 -0
  103. data/lib/active_admin/component.rb +1 -0
  104. data/lib/active_admin/controller_action.rb +1 -0
  105. data/lib/active_admin/csv_builder.rb +13 -23
  106. data/lib/active_admin/dependency.rb +13 -12
  107. data/lib/active_admin/deprecation.rb +1 -0
  108. data/lib/active_admin/devise.rb +16 -5
  109. data/lib/active_admin/dsl.rb +2 -1
  110. data/lib/active_admin/dynamic_setting.rb +1 -0
  111. data/lib/active_admin/dynamic_settings_node.rb +3 -2
  112. data/lib/active_admin/engine.rb +13 -9
  113. data/lib/active_admin/error.rb +1 -2
  114. data/lib/active_admin/filters/active.rb +2 -1
  115. data/lib/active_admin/filters/active_filter.rb +7 -7
  116. data/lib/active_admin/filters/active_sidebar.rb +4 -30
  117. data/lib/active_admin/filters/dsl.rb +1 -0
  118. data/lib/active_admin/filters/forms.rb +7 -6
  119. data/lib/active_admin/filters/formtastic_addons.rb +2 -6
  120. data/lib/active_admin/filters/resource_extension.rb +26 -1
  121. data/lib/active_admin/filters.rb +8 -7
  122. data/lib/active_admin/form_builder.rb +25 -20
  123. data/lib/active_admin/generators/boilerplate.rb +13 -4
  124. data/lib/active_admin/helpers/collection.rb +2 -0
  125. data/lib/active_admin/helpers/i18n.rb +1 -0
  126. data/lib/active_admin/helpers/optional_display.rb +3 -2
  127. data/lib/active_admin/helpers/routes/url_helpers.rb +1 -0
  128. data/lib/active_admin/helpers/scope_chain.rb +1 -0
  129. data/lib/active_admin/inputs/datepicker_input.rb +2 -1
  130. data/lib/active_admin/inputs/filters/base/search_method_select.rb +5 -4
  131. data/lib/active_admin/inputs/filters/base.rb +2 -1
  132. data/lib/active_admin/inputs/filters/boolean_input.rb +2 -1
  133. data/lib/active_admin/inputs/filters/check_boxes_input.rb +2 -1
  134. data/lib/active_admin/inputs/filters/date_picker_input.rb +1 -0
  135. data/lib/active_admin/inputs/filters/date_range_input.rb +16 -12
  136. data/lib/active_admin/inputs/filters/numeric_input.rb +1 -0
  137. data/lib/active_admin/inputs/filters/select_input.rb +3 -2
  138. data/lib/active_admin/inputs/filters/string_input.rb +1 -0
  139. data/lib/active_admin/inputs/filters/text_input.rb +1 -0
  140. data/lib/active_admin/inputs.rb +1 -0
  141. data/lib/active_admin/localizers/resource_localizer.rb +4 -3
  142. data/lib/active_admin/localizers.rb +2 -1
  143. data/lib/active_admin/menu.rb +7 -3
  144. data/lib/active_admin/menu_collection.rb +1 -0
  145. data/lib/active_admin/menu_item.rb +8 -7
  146. data/lib/active_admin/namespace.rb +14 -13
  147. data/lib/active_admin/namespace_settings.rb +21 -4
  148. data/lib/active_admin/order_clause.rb +3 -2
  149. data/lib/active_admin/orm/active_record/comments/comment.rb +4 -3
  150. data/lib/active_admin/orm/active_record/comments/namespace_helper.rb +1 -0
  151. data/lib/active_admin/orm/active_record/comments/resource_helper.rb +1 -0
  152. data/lib/active_admin/orm/active_record/comments/show_page_helper.rb +1 -0
  153. data/lib/active_admin/orm/active_record/comments/views/active_admin_comments.rb +20 -19
  154. data/lib/active_admin/orm/active_record/comments/views.rb +3 -2
  155. data/lib/active_admin/orm/active_record/comments.rb +20 -19
  156. data/lib/active_admin/orm/active_record.rb +2 -1
  157. data/lib/active_admin/orm/mongoid.rb +1 -0
  158. data/lib/active_admin/page.rb +2 -1
  159. data/lib/active_admin/page_controller.rb +1 -0
  160. data/lib/active_admin/page_dsl.rb +1 -0
  161. data/lib/active_admin/page_presenter.rb +1 -0
  162. data/lib/active_admin/pundit_adapter.rb +47 -11
  163. data/lib/active_admin/resource/action_items.rb +6 -5
  164. data/lib/active_admin/resource/attributes.rb +2 -1
  165. data/lib/active_admin/resource/belongs_to.rb +6 -2
  166. data/lib/active_admin/resource/controllers.rb +2 -1
  167. data/lib/active_admin/resource/includes.rb +1 -0
  168. data/lib/active_admin/resource/menu.rb +5 -4
  169. data/lib/active_admin/resource/model.rb +16 -0
  170. data/lib/active_admin/resource/naming.rb +6 -5
  171. data/lib/active_admin/resource/ordering.rb +1 -0
  172. data/lib/active_admin/resource/page_presenters.rb +1 -0
  173. data/lib/active_admin/resource/pagination.rb +1 -0
  174. data/lib/active_admin/resource/routes.rb +17 -10
  175. data/lib/active_admin/resource/scope_to.rb +8 -7
  176. data/lib/active_admin/resource/scopes.rb +1 -0
  177. data/lib/active_admin/resource/sidebars.rb +2 -1
  178. data/lib/active_admin/resource.rb +33 -19
  179. data/lib/active_admin/resource_collection.rb +1 -0
  180. data/lib/active_admin/resource_controller/action_builder.rb +1 -0
  181. data/lib/active_admin/resource_controller/data_access.rb +31 -5
  182. data/lib/active_admin/resource_controller/decorators.rb +8 -29
  183. data/lib/active_admin/resource_controller/polymorphic_routes.rb +38 -0
  184. data/lib/active_admin/resource_controller/resource_class_methods.rb +1 -0
  185. data/lib/active_admin/resource_controller/scoping.rb +1 -0
  186. data/lib/active_admin/resource_controller/sidebars.rb +1 -0
  187. data/lib/active_admin/resource_controller/streaming.rb +9 -7
  188. data/lib/active_admin/resource_controller.rb +14 -10
  189. data/lib/active_admin/resource_dsl.rb +11 -25
  190. data/lib/active_admin/router.rb +1 -0
  191. data/lib/active_admin/scope.rb +7 -6
  192. data/lib/active_admin/settings_node.rb +1 -0
  193. data/lib/active_admin/sidebar_section.rb +1 -0
  194. data/lib/active_admin/version.rb +2 -1
  195. data/lib/active_admin/view_factory.rb +18 -17
  196. data/lib/active_admin/view_helpers/active_admin_application_helper.rb +1 -0
  197. data/lib/active_admin/view_helpers/auto_link_helper.rb +1 -0
  198. data/lib/active_admin/view_helpers/breadcrumb_helper.rb +4 -3
  199. data/lib/active_admin/view_helpers/display_helper.rb +15 -7
  200. data/lib/active_admin/view_helpers/download_format_links_helper.rb +2 -1
  201. data/lib/active_admin/view_helpers/fields_for.rb +3 -2
  202. data/lib/active_admin/view_helpers/flash_helper.rb +1 -0
  203. data/lib/active_admin/view_helpers/form_helper.rb +1 -0
  204. data/lib/active_admin/view_helpers/method_or_proc_helper.rb +1 -0
  205. data/lib/active_admin/view_helpers/scope_name_helper.rb +1 -0
  206. data/lib/active_admin/view_helpers/sidebar_helper.rb +1 -0
  207. data/lib/active_admin/view_helpers/title_helper.rb +1 -0
  208. data/lib/active_admin/view_helpers/view_factory_helper.rb +1 -0
  209. data/lib/active_admin/view_helpers.rb +2 -1
  210. data/lib/active_admin/views/action_items.rb +1 -0
  211. data/lib/active_admin/views/components/active_admin_form.rb +7 -6
  212. data/lib/active_admin/views/components/active_filters_sidebar_content.rb +59 -0
  213. data/lib/active_admin/views/components/attributes_table.rb +6 -5
  214. data/lib/active_admin/views/components/blank_slate.rb +2 -1
  215. data/lib/active_admin/views/components/columns.rb +1 -0
  216. data/lib/active_admin/views/components/dropdown_menu.rb +7 -9
  217. data/lib/active_admin/views/components/index_list.rb +4 -3
  218. data/lib/active_admin/views/components/menu.rb +2 -1
  219. data/lib/active_admin/views/components/menu_item.rb +5 -4
  220. data/lib/active_admin/views/components/paginated_collection.rb +21 -19
  221. data/lib/active_admin/views/components/panel.rb +2 -1
  222. data/lib/active_admin/views/components/scopes.rb +8 -5
  223. data/lib/active_admin/views/components/sidebar.rb +1 -0
  224. data/lib/active_admin/views/components/sidebar_section.rb +1 -0
  225. data/lib/active_admin/views/components/site_title.rb +2 -1
  226. data/lib/active_admin/views/components/status_tag.rb +12 -11
  227. data/lib/active_admin/views/components/table_for.rb +19 -17
  228. data/lib/active_admin/views/components/tabs.rb +4 -3
  229. data/lib/active_admin/views/components/unsupported_browser.rb +1 -0
  230. data/lib/active_admin/views/footer.rb +3 -1
  231. data/lib/active_admin/views/header.rb +3 -2
  232. data/lib/active_admin/views/index_as_block.rb +1 -0
  233. data/lib/active_admin/views/index_as_blog.rb +2 -1
  234. data/lib/active_admin/views/index_as_grid.rb +2 -1
  235. data/lib/active_admin/views/index_as_table.rb +24 -16
  236. data/lib/active_admin/views/pages/base.rb +19 -12
  237. data/lib/active_admin/views/pages/form.rb +1 -0
  238. data/lib/active_admin/views/pages/index.rb +16 -13
  239. data/lib/active_admin/views/pages/layout.rb +1 -0
  240. data/lib/active_admin/views/pages/page.rb +1 -0
  241. data/lib/active_admin/views/pages/show.rb +1 -0
  242. data/lib/active_admin/views/tabbed_navigation.rb +3 -2
  243. data/lib/active_admin/views/title_bar.rb +2 -1
  244. data/lib/active_admin/views.rb +2 -1
  245. data/lib/active_admin.rb +63 -64
  246. data/lib/activeadmin.rb +2 -1
  247. data/lib/generators/active_admin/assets/assets_generator.rb +3 -2
  248. data/lib/generators/active_admin/assets/templates/active_admin.scss +2 -2
  249. data/lib/generators/active_admin/devise/devise_generator.rb +6 -5
  250. data/lib/generators/active_admin/install/install_generator.rb +15 -8
  251. data/lib/generators/active_admin/install/templates/active_admin.rb.erb +21 -1
  252. data/lib/generators/active_admin/install/templates/dashboard.rb +1 -0
  253. data/lib/generators/active_admin/page/page_generator.rb +2 -1
  254. data/lib/generators/active_admin/page/templates/page.rb +1 -0
  255. data/lib/generators/active_admin/resource/resource_generator.rb +4 -3
  256. data/lib/generators/active_admin/resource/templates/admin.rb.erb +4 -2
  257. data/lib/generators/active_admin/webpacker/plugins/jquery.js +7 -0
  258. data/lib/generators/active_admin/webpacker/templates/active_admin.js +5 -0
  259. data/lib/generators/active_admin/webpacker/templates/active_admin.scss +17 -0
  260. data/lib/generators/active_admin/webpacker/templates/print.scss +2 -0
  261. data/lib/generators/active_admin/webpacker/webpacker_generator.rb +27 -0
  262. data/lib/ransack_ext.rb +9 -8
  263. metadata +62 -91
  264. data/app/assets/images/active_admin/nested_menu_arrow.gif +0 -0
  265. data/app/assets/images/active_admin/nested_menu_arrow_dark.gif +0 -0
  266. data/app/assets/images/active_admin/orderable.png +0 -0
  267. data/app/assets/javascripts/active_admin/base.es6 +0 -23
  268. data/app/assets/javascripts/active_admin/initializers/filters.es6 +0 -45
  269. data/app/assets/javascripts/active_admin/lib/active_admin.es6 +0 -41
  270. data/app/assets/javascripts/active_admin/lib/per_page.es6 +0 -47
  271. /data/app/{assets/javascripts/active_admin/ext/jquery-ui.es6 → javascript/active_admin/ext/jquery-ui.js} +0 -0
  272. /data/app/{assets/javascripts/active_admin/ext/jquery.es6 → javascript/active_admin/ext/jquery.js} +0 -0
  273. /data/app/{assets/javascripts/active_admin/initializers/datepicker.es6 → javascript/active_admin/initializers/datepicker.js} +0 -0
  274. /data/app/{assets/javascripts/active_admin/initializers/tabs.es6 → javascript/active_admin/initializers/tabs.js} +0 -0
data/lib/activeadmin.rb CHANGED
@@ -1 +1,2 @@
1
- require 'active_admin'
1
+ # frozen_string_literal: true
2
+ require "active_admin"
@@ -1,11 +1,12 @@
1
+ # frozen_string_literal: true
1
2
  module ActiveAdmin
2
3
  module Generators
3
4
  class AssetsGenerator < Rails::Generators::Base
4
5
 
5
- source_root File.expand_path('templates', __dir__)
6
+ source_root File.expand_path("templates", __dir__)
6
7
 
7
8
  def install_assets
8
- template 'active_admin.js', 'app/assets/javascripts/active_admin.js'
9
+ template "active_admin.js", "app/assets/javascripts/active_admin.js"
9
10
  template "active_admin.scss", "app/assets/stylesheets/active_admin.scss"
10
11
  end
11
12
 
@@ -1,4 +1,4 @@
1
- // SASS variable overrides must be declared before loading up Active Admin's styles.
1
+ // Sass variable overrides must be declared before loading up Active Admin's styles.
2
2
  //
3
3
  // To view the variables that Active Admin provides, take a look at
4
4
  // `app/assets/stylesheets/active_admin/mixins/_variables.scss` in the
@@ -11,7 +11,7 @@
11
11
  @import "active_admin/mixins";
12
12
  @import "active_admin/base";
13
13
 
14
- // Overriding any non-variable SASS must be done after the fact.
14
+ // Overriding any non-variable Sass must be done after the fact.
15
15
  // For example, to change the default status-tag color:
16
16
  //
17
17
  // .status_tag { background: #6090DB; }
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require "active_admin/error"
2
3
  require "active_admin/dependency"
3
4
 
@@ -7,13 +8,13 @@ module ActiveAdmin
7
8
  desc "Creates an admin user and uses Devise for authentication"
8
9
  argument :name, type: :string, default: "AdminUser"
9
10
 
10
- class_option :registerable, type: :boolean, default: false,
11
- desc: "Should the generated resource be registerable?"
11
+ class_option :registerable, type: :boolean, default: false,
12
+ desc: "Should the generated resource be registerable?"
12
13
 
13
14
  RESERVED_NAMES = [:active_admin_user]
14
15
 
15
- class_option :default_user, type: :boolean, default: true,
16
- desc: "Should a default user be created inside the migration?"
16
+ class_option :default_user, type: :boolean, default: true,
17
+ desc: "Should a default user be created inside the migration?"
17
18
 
18
19
  def install_devise
19
20
  begin
@@ -22,7 +23,7 @@ module ActiveAdmin
22
23
  raise ActiveAdmin::GeneratorError, "#{e.message} If you don't want to use devise, run the generator with --skip-users."
23
24
  end
24
25
 
25
- require 'devise'
26
+ require "devise"
26
27
 
27
28
  initializer_file =
28
29
  File.join(destination_root, "config", "initializers", "devise.rb")
@@ -1,4 +1,5 @@
1
- require 'rails/generators/active_record'
1
+ # frozen_string_literal: true
2
+ require "rails/generators/active_record"
2
3
 
3
4
  module ActiveAdmin
4
5
  module Generators
@@ -8,22 +9,24 @@ module ActiveAdmin
8
9
 
9
10
  hook_for :users, default: "devise", desc: "Admin user generator to run. Skip with --skip-users"
10
11
  class_option :skip_comments, type: :boolean, default: false, desc: "Skip installation of comments"
12
+ class_option :use_webpacker, type: :boolean, default: false, desc: "Use Webpacker assets instead of Sprockets"
11
13
 
12
- source_root File.expand_path('templates', __dir__)
14
+ source_root File.expand_path("templates", __dir__)
13
15
 
14
16
  def copy_initializer
15
- @underscored_user_name = name.underscore.gsub('/', '_')
17
+ @underscored_user_name = name.underscore.gsub("/", "_")
16
18
  @use_authentication_method = options[:users].present?
17
19
  @skip_comments = options[:skip_comments]
18
- template 'active_admin.rb.erb', 'config/initializers/active_admin.rb'
20
+ @use_webpacker = options[:use_webpacker]
21
+ template "active_admin.rb.erb", "config/initializers/active_admin.rb"
19
22
  end
20
23
 
21
24
  def setup_directory
22
25
  empty_directory "app/admin"
23
- template 'dashboard.rb', 'app/admin/dashboard.rb'
26
+ template "dashboard.rb", "app/admin/dashboard.rb"
24
27
  if options[:users].present?
25
28
  @user_class = name
26
- template 'admin_users.rb.erb', "app/admin/#{name.underscore.pluralize}.rb"
29
+ template "admin_users.rb.erb", "app/admin/#{name.underscore.pluralize}.rb"
27
30
  end
28
31
  end
29
32
 
@@ -36,12 +39,16 @@ module ActiveAdmin
36
39
  end
37
40
 
38
41
  def create_assets
39
- generate "active_admin:assets"
42
+ if options[:use_webpacker]
43
+ generate "active_admin:webpacker"
44
+ else
45
+ generate "active_admin:assets"
46
+ end
40
47
  end
41
48
 
42
49
  def create_migrations
43
50
  unless options[:skip_comments]
44
- migration_template 'migrations/create_active_admin_comments.rb.erb', 'db/migrate/create_active_admin_comments.rb'
51
+ migration_template "migrations/create_active_admin_comments.rb.erb", "db/migrate/create_active_admin_comments.rb"
45
52
  end
46
53
  end
47
54
  end
@@ -286,12 +286,25 @@ ActiveAdmin.setup do |config|
286
286
  # config.filters = true
287
287
  #
288
288
  # By default the filters include associations in a select, which means
289
- # that every record will be loaded for each association.
289
+ # that every record will be loaded for each association (up
290
+ # to the value of config.maximum_association_filter_arity).
290
291
  # You can enabled or disable the inclusion
291
292
  # of those filters by default here.
292
293
  #
293
294
  # config.include_default_association_filters = true
294
295
 
296
+ # config.maximum_association_filter_arity = 256 # default value of :unlimited will change to 256 in a future version
297
+ # config.filter_columns_for_large_association = [
298
+ # :display_name,
299
+ # :full_name,
300
+ # :name,
301
+ # :username,
302
+ # :login,
303
+ # :title,
304
+ # :email,
305
+ # ]
306
+ # config.filter_method_for_large_association = '_starts_with'
307
+
295
308
  # == Head
296
309
  #
297
310
  # You can add your own content to the site head like analytics. Make sure
@@ -312,4 +325,11 @@ ActiveAdmin.setup do |config|
312
325
  # You can inherit it with own class and inject it for all resources
313
326
  #
314
327
  # config.order_clause = MyOrderClause
328
+
329
+ # == Webpacker
330
+ #
331
+ # By default, Active Admin uses Sprocket's asset pipeline.
332
+ # You can switch to using Webpacker here.
333
+ #
334
+ <% unless @use_webpacker %># <% end %>config.use_webpacker = true
315
335
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  ActiveAdmin.register_page "Dashboard" do
2
3
  menu priority: 1, label: proc { I18n.t("active_admin.dashboard") }
3
4
 
@@ -1,7 +1,8 @@
1
+ # frozen_string_literal: true
1
2
  module ActiveAdmin
2
3
  module Generators
3
4
  class PageGenerator < Rails::Generators::NamedBase
4
- source_root File.expand_path('templates', __dir__)
5
+ source_root File.expand_path("templates", __dir__)
5
6
 
6
7
  def generate_config_file
7
8
  template "page.rb", "app/admin/#{file_path.tr('/', '_')}.rb"
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  ActiveAdmin.register_page "<%= class_name %>" do
2
3
  content do
3
4
  # your content
@@ -1,4 +1,5 @@
1
- require 'active_admin/generators/boilerplate'
1
+ # frozen_string_literal: true
2
+ require "active_admin/generators/boilerplate"
2
3
 
3
4
  module ActiveAdmin
4
5
  module Generators
@@ -6,9 +7,9 @@ module ActiveAdmin
6
7
  desc "Registers resources with Active Admin"
7
8
 
8
9
  class_option :include_boilerplate, type: :boolean, default: false,
9
- desc: "Generate boilerplate code for your resource."
10
+ desc: "Generate boilerplate code for your resource."
10
11
 
11
- source_root File.expand_path('templates', __dir__)
12
+ source_root File.expand_path("templates", __dir__)
12
13
 
13
14
  def generate_config_file
14
15
  @boilerplate = ActiveAdmin::Generators::Boilerplate.new(class_name)
@@ -3,12 +3,14 @@ ActiveAdmin.register <%= class_name %> do
3
3
  # See permitted parameters documentation:
4
4
  # https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
5
5
  #
6
- # permit_params :list, :of, :attributes, :on, :model
6
+ # Uncomment all parameters which should be permitted for assignment
7
+ #
8
+ # permit_params <%= @boilerplate.permit_params %>
7
9
  #
8
10
  # or
9
11
  #
10
12
  # permit_params do
11
- # permitted = [:permitted, :attributes]
13
+ # permitted = [<%= @boilerplate.permit_params %>]
12
14
  # permitted << :other if params[:action] == 'create' && current_user.admin?
13
15
  # permitted
14
16
  # end
@@ -0,0 +1,7 @@
1
+ const webpack = require('webpack')
2
+
3
+ module.exports = new webpack.ProvidePlugin({
4
+ "$":"jquery",
5
+ "jQuery":"jquery",
6
+ "window.jQuery":"jquery"
7
+ });
@@ -0,0 +1,5 @@
1
+ // Load Active Admin's styles into Webpacker,
2
+ // see `active_admin.scss` for customization.
3
+ import "../stylesheets/active_admin";
4
+
5
+ import "@activeadmin/activeadmin";
@@ -0,0 +1,17 @@
1
+ // Sass variable overrides must be declared before loading up Active Admin's styles.
2
+ //
3
+ // To view the variables that Active Admin provides, take a look at
4
+ // `app/assets/stylesheets/active_admin/mixins/_variables.scss` in the
5
+ // Active Admin source.
6
+ //
7
+ // For example, to change the sidebar width:
8
+ // $sidebar-width: 242px;
9
+
10
+ // Active Admin's got SASS!
11
+ @import "~@activeadmin/activeadmin/src/scss/mixins";
12
+ @import "~@activeadmin/activeadmin/src/scss/base";
13
+
14
+ // Overriding any non-variable Sass must be done after the fact.
15
+ // For example, to change the default status-tag color:
16
+ //
17
+ // .status_tag { background: #6090DB; }
@@ -0,0 +1,2 @@
1
+ /* Active Admin Print Stylesheet */
2
+ @import "~@activeadmin/activeadmin/src/scss/print";
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+ module ActiveAdmin
3
+ module Generators
4
+ class WebpackerGenerator < Rails::Generators::Base
5
+
6
+ source_root File.expand_path("templates", __dir__)
7
+
8
+ def install_assets
9
+ template "active_admin.js", "app/javascript/packs/active_admin.js"
10
+ template "active_admin.scss", "app/javascript/stylesheets/active_admin.scss"
11
+ template "print.scss", "app/javascript/packs/active_admin/print.scss"
12
+
13
+ copy_file "#{__dir__}/plugins/jquery.js", Rails.root.join("config/webpack/plugins/jquery.js").to_s
14
+
15
+ insert_into_file Rails.root.join("config/webpack/environment.js").to_s,
16
+ "const jquery = require('./plugins/jquery')\n",
17
+ after: /require\(('|")@rails\/webpacker\1\);?\n/
18
+
19
+ insert_into_file Rails.root.join("config/webpack/environment.js").to_s,
20
+ "environment.plugins.prepend('jquery', jquery)\n",
21
+ before: "module.exports"
22
+
23
+ run "yarn add @activeadmin/activeadmin"
24
+ end
25
+ end
26
+ end
27
+ end
data/lib/ransack_ext.rb CHANGED
@@ -1,20 +1,21 @@
1
+ # frozen_string_literal: true
1
2
  # This sets up aliases for old Metasearch query methods so they behave
2
3
  # identically to the versions given in Ransack.
3
4
  #
4
5
  Ransack.configure do |config|
5
- { 'contains' => 'cont', 'starts_with' => 'start', 'ends_with' => 'end' }.each do |old, current|
6
+ { "contains" => "cont", "starts_with" => "start", "ends_with" => "end" }.each do |old, current|
6
7
  config.add_predicate old, Ransack::Constants::DERIVED_PREDICATES.detect { |q, _| q == current }[1]
7
8
  end
8
9
 
9
- { 'equals' => 'eq', 'greater_than' => 'gt', 'less_than' => 'lt' }.each do |old, current|
10
+ { "equals" => "eq", "greater_than" => "gt", "less_than" => "lt" }.each do |old, current|
10
11
  config.add_predicate old, arel_predicate: current
11
12
  end
12
13
 
13
- config.add_predicate 'gteq_datetime',
14
- arel_predicate: 'gteq',
15
- formatter: ->(v) { v.beginning_of_day }
14
+ config.add_predicate "gteq_datetime",
15
+ arel_predicate: "gteq",
16
+ formatter: ->(v) { v.beginning_of_day }
16
17
 
17
- config.add_predicate 'lteq_datetime',
18
- arel_predicate: 'lt',
19
- formatter: ->(v) { v + 1.day }
18
+ config.add_predicate "lteq_datetime",
19
+ arel_predicate: "lt",
20
+ formatter: ->(v) { v + 1.day }
20
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles Maresh
@@ -12,10 +12,10 @@ authors:
12
12
  - Piers C
13
13
  - Sean Linsley
14
14
  - Timo Schilling
15
- autorequire:
15
+ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2019-07-15 00:00:00.000000000 Z
18
+ date: 2022-04-22 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: arbre
@@ -41,16 +41,22 @@ dependencies:
41
41
  name: formtastic
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - "~>"
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: '3.1'
47
+ - - "<"
48
+ - !ruby/object:Gem::Version
49
+ version: '5.0'
47
50
  type: :runtime
48
51
  prerelease: false
49
52
  version_requirements: !ruby/object:Gem::Requirement
50
53
  requirements:
51
- - - "~>"
54
+ - - ">="
52
55
  - !ruby/object:Gem::Version
53
56
  version: '3.1'
57
+ - - "<"
58
+ - !ruby/object:Gem::Version
59
+ version: '5.0'
54
60
  - !ruby/object:Gem::Dependency
55
61
  name: formtastic_i18n
56
62
  requirement: !ruby/object:Gem::Requirement
@@ -102,7 +108,7 @@ dependencies:
102
108
  version: '1.0'
103
109
  - - ">="
104
110
  - !ruby/object:Gem::Version
105
- version: 1.0.1
111
+ version: 1.2.1
106
112
  type: :runtime
107
113
  prerelease: false
108
114
  version_requirements: !ruby/object:Gem::Requirement
@@ -112,101 +118,47 @@ dependencies:
112
118
  version: '1.0'
113
119
  - - ">="
114
120
  - !ruby/object:Gem::Version
115
- version: 1.0.1
121
+ version: 1.2.1
116
122
  - !ruby/object:Gem::Dependency
117
123
  name: railties
118
124
  requirement: !ruby/object:Gem::Requirement
119
125
  requirements:
120
126
  - - ">="
121
127
  - !ruby/object:Gem::Version
122
- version: '5.0'
128
+ version: '6.0'
123
129
  - - "<"
124
130
  - !ruby/object:Gem::Version
125
- version: '6.1'
131
+ version: '7.1'
126
132
  type: :runtime
127
133
  prerelease: false
128
134
  version_requirements: !ruby/object:Gem::Requirement
129
135
  requirements:
130
136
  - - ">="
131
137
  - !ruby/object:Gem::Version
132
- version: '5.0'
138
+ version: '6.0'
133
139
  - - "<"
134
140
  - !ruby/object:Gem::Version
135
- version: '6.1'
141
+ version: '7.1'
136
142
  - !ruby/object:Gem::Dependency
137
143
  name: ransack
138
144
  requirement: !ruby/object:Gem::Requirement
139
145
  requirements:
140
- - - "~>"
141
- - !ruby/object:Gem::Version
142
- version: '2.1'
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: 2.1.1
146
- type: :runtime
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - "~>"
151
- - !ruby/object:Gem::Version
152
- version: '2.1'
153
146
  - - ">="
154
147
  - !ruby/object:Gem::Version
155
148
  version: 2.1.1
156
- - !ruby/object:Gem::Dependency
157
- name: sassc-rails
158
- requirement: !ruby/object:Gem::Requirement
159
- requirements:
160
- - - "~>"
161
- - !ruby/object:Gem::Version
162
- version: '2.1'
163
- type: :runtime
164
- prerelease: false
165
- version_requirements: !ruby/object:Gem::Requirement
166
- requirements:
167
- - - "~>"
168
- - !ruby/object:Gem::Version
169
- version: '2.1'
170
- - !ruby/object:Gem::Dependency
171
- name: sprockets
172
- requirement: !ruby/object:Gem::Requirement
173
- requirements:
174
- - - ">="
175
- - !ruby/object:Gem::Version
176
- version: '3.0'
177
149
  - - "<"
178
150
  - !ruby/object:Gem::Version
179
- version: '4.1'
151
+ version: '4'
180
152
  type: :runtime
181
153
  prerelease: false
182
154
  version_requirements: !ruby/object:Gem::Requirement
183
155
  requirements:
184
156
  - - ">="
185
157
  - !ruby/object:Gem::Version
186
- version: '3.0'
158
+ version: 2.1.1
187
159
  - - "<"
188
160
  - !ruby/object:Gem::Version
189
- version: '4.1'
190
- - !ruby/object:Gem::Dependency
191
- name: sprockets-es6
192
- requirement: !ruby/object:Gem::Requirement
193
- requirements:
194
- - - "~>"
195
- - !ruby/object:Gem::Version
196
- version: '0.9'
197
- - - ">="
198
- - !ruby/object:Gem::Version
199
- version: 0.9.2
200
- type: :runtime
201
- prerelease: false
202
- version_requirements: !ruby/object:Gem::Requirement
203
- requirements:
204
- - - "~>"
205
- - !ruby/object:Gem::Version
206
- version: '0.9'
207
- - - ">="
208
- - !ruby/object:Gem::Version
209
- version: 0.9.2
161
+ version: '4'
210
162
  description: The administration framework for Ruby on Rails.
211
163
  email:
212
164
  - deivid.rodriguez@riseup.net
@@ -223,27 +175,13 @@ files:
223
175
  - CONTRIBUTING.md
224
176
  - LICENSE
225
177
  - README.md
226
- - app/assets/images/active_admin/nested_menu_arrow.gif
227
- - app/assets/images/active_admin/nested_menu_arrow_dark.gif
228
- - app/assets/images/active_admin/orderable.png
229
- - app/assets/javascripts/active_admin/base.es6
230
- - app/assets/javascripts/active_admin/ext/jquery-ui.es6
231
- - app/assets/javascripts/active_admin/ext/jquery.es6
232
- - app/assets/javascripts/active_admin/initializers/datepicker.es6
233
- - app/assets/javascripts/active_admin/initializers/filters.es6
234
- - app/assets/javascripts/active_admin/initializers/tabs.es6
235
- - app/assets/javascripts/active_admin/lib/active_admin.es6
236
- - app/assets/javascripts/active_admin/lib/batch_actions.es6
237
- - app/assets/javascripts/active_admin/lib/checkbox-toggler.es6
238
- - app/assets/javascripts/active_admin/lib/dropdown-menu.es6
239
- - app/assets/javascripts/active_admin/lib/has_many.es6
240
- - app/assets/javascripts/active_admin/lib/modal_dialog.es6
241
- - app/assets/javascripts/active_admin/lib/per_page.es6
242
- - app/assets/javascripts/active_admin/lib/table-checkbox-toggler.es6
178
+ - app/assets/javascripts/active_admin/base.js
243
179
  - app/assets/stylesheets/active_admin/_base.scss
244
180
  - app/assets/stylesheets/active_admin/_forms.scss
245
181
  - app/assets/stylesheets/active_admin/_header.scss
246
182
  - app/assets/stylesheets/active_admin/_mixins.scss
183
+ - app/assets/stylesheets/active_admin/_normalize.scss
184
+ - app/assets/stylesheets/active_admin/_print.scss
247
185
  - app/assets/stylesheets/active_admin/_typography.scss
248
186
  - app/assets/stylesheets/active_admin/components/_batch_actions.scss
249
187
  - app/assets/stylesheets/active_admin/components/_blank_slates.scss
@@ -276,10 +214,28 @@ files:
276
214
  - app/assets/stylesheets/active_admin/mixins/_utilities.scss
277
215
  - app/assets/stylesheets/active_admin/mixins/_variables.scss
278
216
  - app/assets/stylesheets/active_admin/pages/_logged_out.scss
279
- - app/assets/stylesheets/active_admin/print.scss
280
217
  - app/assets/stylesheets/active_admin/structure/_footer.scss
281
218
  - app/assets/stylesheets/active_admin/structure/_main_structure.scss
282
219
  - app/assets/stylesheets/active_admin/structure/_title_bar.scss
220
+ - app/javascript/active_admin/base.js
221
+ - app/javascript/active_admin/ext/jquery-ui.js
222
+ - app/javascript/active_admin/ext/jquery.js
223
+ - app/javascript/active_admin/initializers/batch-actions.js
224
+ - app/javascript/active_admin/initializers/checkbox-toggler.js
225
+ - app/javascript/active_admin/initializers/datepicker.js
226
+ - app/javascript/active_admin/initializers/dropdown-menu.js
227
+ - app/javascript/active_admin/initializers/filters.js
228
+ - app/javascript/active_admin/initializers/has-many.js
229
+ - app/javascript/active_admin/initializers/per-page.js
230
+ - app/javascript/active_admin/initializers/table-checkbox-toggler.js
231
+ - app/javascript/active_admin/initializers/tabs.js
232
+ - app/javascript/active_admin/lib/checkbox-toggler.js
233
+ - app/javascript/active_admin/lib/dropdown-menu.js
234
+ - app/javascript/active_admin/lib/filters.js
235
+ - app/javascript/active_admin/lib/modal-dialog.js
236
+ - app/javascript/active_admin/lib/per-page.js
237
+ - app/javascript/active_admin/lib/table-checkbox-toggler.js
238
+ - app/javascript/active_admin/lib/utils.js
283
239
  - app/views/active_admin/devise/confirmations/new.html.erb
284
240
  - app/views/active_admin/devise/mailer/reset_password_instructions.html.erb
285
241
  - app/views/active_admin/devise/mailer/unlock_instructions.html.erb
@@ -302,9 +258,16 @@ files:
302
258
  - app/views/kaminari/active_admin/_page.html.erb
303
259
  - app/views/kaminari/active_admin/_paginator.html.erb
304
260
  - app/views/kaminari/active_admin/_prev_page.html.erb
261
+ - app/views/kaminari/active_admin_countless/_first_page.html.erb
262
+ - app/views/kaminari/active_admin_countless/_gap.html.erb
263
+ - app/views/kaminari/active_admin_countless/_next_page.html.erb
264
+ - app/views/kaminari/active_admin_countless/_page.html.erb
265
+ - app/views/kaminari/active_admin_countless/_paginator.html.erb
266
+ - app/views/kaminari/active_admin_countless/_prev_page.html.erb
305
267
  - app/views/layouts/active_admin.html.arb
306
268
  - app/views/layouts/active_admin_logged_out.html.erb
307
269
  - config/locales/ar.yml
270
+ - config/locales/az.yml
308
271
  - config/locales/bg.yml
309
272
  - config/locales/bs.yml
310
273
  - config/locales/ca.yml
@@ -403,6 +366,7 @@ files:
403
366
  - lib/active_admin/batch_actions/views/selection_cells.rb
404
367
  - lib/active_admin/callbacks.rb
405
368
  - lib/active_admin/cancan_adapter.rb
369
+ - lib/active_admin/collection_decorator.rb
406
370
  - lib/active_admin/component.rb
407
371
  - lib/active_admin/controller_action.rb
408
372
  - lib/active_admin/csv_builder.rb
@@ -471,6 +435,7 @@ files:
471
435
  - lib/active_admin/resource/controllers.rb
472
436
  - lib/active_admin/resource/includes.rb
473
437
  - lib/active_admin/resource/menu.rb
438
+ - lib/active_admin/resource/model.rb
474
439
  - lib/active_admin/resource/naming.rb
475
440
  - lib/active_admin/resource/ordering.rb
476
441
  - lib/active_admin/resource/page_presenters.rb
@@ -484,6 +449,7 @@ files:
484
449
  - lib/active_admin/resource_controller/action_builder.rb
485
450
  - lib/active_admin/resource_controller/data_access.rb
486
451
  - lib/active_admin/resource_controller/decorators.rb
452
+ - lib/active_admin/resource_controller/polymorphic_routes.rb
487
453
  - lib/active_admin/resource_controller/resource_class_methods.rb
488
454
  - lib/active_admin/resource_controller/scoping.rb
489
455
  - lib/active_admin/resource_controller/sidebars.rb
@@ -512,6 +478,7 @@ files:
512
478
  - lib/active_admin/views.rb
513
479
  - lib/active_admin/views/action_items.rb
514
480
  - lib/active_admin/views/components/active_admin_form.rb
481
+ - lib/active_admin/views/components/active_filters_sidebar_content.rb
515
482
  - lib/active_admin/views/components/attributes_table.rb
516
483
  - lib/active_admin/views/components/blank_slate.rb
517
484
  - lib/active_admin/views/components/columns.rb
@@ -558,6 +525,11 @@ files:
558
525
  - lib/generators/active_admin/page/templates/page.rb
559
526
  - lib/generators/active_admin/resource/resource_generator.rb
560
527
  - lib/generators/active_admin/resource/templates/admin.rb.erb
528
+ - lib/generators/active_admin/webpacker/plugins/jquery.js
529
+ - lib/generators/active_admin/webpacker/templates/active_admin.js
530
+ - lib/generators/active_admin/webpacker/templates/active_admin.scss
531
+ - lib/generators/active_admin/webpacker/templates/print.scss
532
+ - lib/generators/active_admin/webpacker/webpacker_generator.rb
561
533
  - lib/ransack_ext.rb
562
534
  - vendor/assets/javascripts/jquery-ui/data.js
563
535
  - vendor/assets/javascripts/jquery-ui/disable-selection.js
@@ -587,12 +559,11 @@ files:
587
559
  - vendor/assets/javascripts/jquery-ui/widgets/resizable.js
588
560
  - vendor/assets/javascripts/jquery-ui/widgets/sortable.js
589
561
  - vendor/assets/javascripts/jquery-ui/widgets/tabs.js
590
- - vendor/assets/stylesheets/active_admin/_normalize.scss
591
562
  homepage: https://activeadmin.info
592
563
  licenses:
593
564
  - MIT
594
565
  metadata: {}
595
- post_install_message:
566
+ post_install_message:
596
567
  rdoc_options: []
597
568
  require_paths:
598
569
  - lib
@@ -600,15 +571,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
600
571
  requirements:
601
572
  - - ">="
602
573
  - !ruby/object:Gem::Version
603
- version: '2.4'
574
+ version: '2.6'
604
575
  required_rubygems_version: !ruby/object:Gem::Requirement
605
576
  requirements:
606
577
  - - ">="
607
578
  - !ruby/object:Gem::Version
608
579
  version: '0'
609
580
  requirements: []
610
- rubygems_version: 3.0.4
611
- signing_key:
581
+ rubygems_version: 3.3.10
582
+ signing_key:
612
583
  specification_version: 4
613
584
  summary: Active Admin is a Ruby on Rails plugin for generating administration style
614
585
  interfaces. It abstracts common business application patterns to make it simple