activeadmin 2.5.0 → 2.8.1

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 (149) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +120 -6
  3. data/CONTRIBUTING.md +11 -57
  4. data/README.md +2 -2
  5. data/app/assets/javascripts/active_admin/base.js +26 -18
  6. data/app/assets/stylesheets/active_admin/_header.scss +37 -3
  7. data/app/assets/stylesheets/active_admin/components/_comments.scss +2 -2
  8. data/app/assets/stylesheets/active_admin/mixins/_variables.scss +3 -0
  9. data/app/javascript/active_admin/base.js +9 -0
  10. data/app/javascript/active_admin/initializers/per-page.js +1 -1
  11. data/app/javascript/active_admin/lib/checkbox-toggler.js +3 -3
  12. data/app/javascript/active_admin/lib/dropdown-menu.js +1 -1
  13. data/app/javascript/active_admin/lib/modal-dialog.js +7 -7
  14. data/app/javascript/active_admin/lib/per-page.js +1 -1
  15. data/app/javascript/active_admin/lib/table-checkbox-toggler.js +1 -1
  16. data/app/views/layouts/active_admin_logged_out.html.erb +15 -5
  17. data/config/locales/ar.yml +6 -6
  18. data/config/locales/en-CA.yml +3 -3
  19. data/config/locales/en-GB.yml +3 -3
  20. data/config/locales/en.yml +3 -3
  21. data/config/locales/es-MX.yml +2 -1
  22. data/config/locales/es.yml +5 -5
  23. data/config/locales/fr.yml +4 -4
  24. data/config/locales/it.yml +18 -0
  25. data/config/locales/ja.yml +3 -3
  26. data/config/locales/lv.yml +2 -2
  27. data/config/locales/vi.yml +6 -5
  28. data/docs/0-installation.md +26 -2
  29. data/docs/11-decorators.md +16 -5
  30. data/docs/2-resource-customization.md +10 -1
  31. data/docs/3-index-pages.md +1 -1
  32. data/docs/9-batch-actions.md +2 -2
  33. data/docs/Gemfile +2 -2
  34. data/docs/Gemfile.lock +93 -84
  35. data/docs/_includes/top-menu.html +1 -1
  36. data/docs/documentation.md +1 -1
  37. data/docs/index.html +6 -6
  38. data/lib/active_admin.rb +60 -60
  39. data/lib/active_admin/application.rb +13 -13
  40. data/lib/active_admin/application_settings.rb +3 -3
  41. data/lib/active_admin/authorization_adapter.rb +3 -3
  42. data/lib/active_admin/base_controller.rb +4 -4
  43. data/lib/active_admin/base_controller/authorization.rb +13 -12
  44. data/lib/active_admin/batch_actions/controller.rb +3 -3
  45. data/lib/active_admin/batch_actions/resource_extension.rb +9 -8
  46. data/lib/active_admin/batch_actions/views/batch_action_form.rb +3 -3
  47. data/lib/active_admin/batch_actions/views/batch_action_selector.rb +6 -6
  48. data/lib/active_admin/batch_actions/views/selection_cells.rb +3 -3
  49. data/lib/active_admin/cancan_adapter.rb +1 -1
  50. data/lib/active_admin/collection_decorator.rb +31 -0
  51. data/lib/active_admin/csv_builder.rb +11 -7
  52. data/lib/active_admin/dependency.rb +11 -11
  53. data/lib/active_admin/devise.rb +5 -5
  54. data/lib/active_admin/dsl.rb +1 -1
  55. data/lib/active_admin/dynamic_settings_node.rb +2 -2
  56. data/lib/active_admin/engine.rb +3 -3
  57. data/lib/active_admin/filters.rb +7 -7
  58. data/lib/active_admin/filters/active.rb +1 -1
  59. data/lib/active_admin/filters/active_filter.rb +5 -4
  60. data/lib/active_admin/filters/active_sidebar.rb +5 -5
  61. data/lib/active_admin/filters/forms.rb +6 -6
  62. data/lib/active_admin/filters/formtastic_addons.rb +1 -6
  63. data/lib/active_admin/filters/resource_extension.rb +1 -1
  64. data/lib/active_admin/form_builder.rb +21 -19
  65. data/lib/active_admin/generators/boilerplate.rb +1 -1
  66. data/lib/active_admin/helpers/optional_display.rb +2 -2
  67. data/lib/active_admin/inputs/datepicker_input.rb +1 -1
  68. data/lib/active_admin/inputs/filters/base.rb +1 -1
  69. data/lib/active_admin/inputs/filters/base/search_method_select.rb +4 -4
  70. data/lib/active_admin/inputs/filters/boolean_input.rb +1 -1
  71. data/lib/active_admin/inputs/filters/check_boxes_input.rb +1 -1
  72. data/lib/active_admin/inputs/filters/date_range_input.rb +12 -9
  73. data/lib/active_admin/inputs/filters/select_input.rb +2 -2
  74. data/lib/active_admin/localizers.rb +1 -1
  75. data/lib/active_admin/localizers/resource_localizer.rb +3 -3
  76. data/lib/active_admin/menu.rb +6 -3
  77. data/lib/active_admin/menu_item.rb +7 -7
  78. data/lib/active_admin/namespace.rb +12 -12
  79. data/lib/active_admin/namespace_settings.rb +8 -5
  80. data/lib/active_admin/order_clause.rb +1 -1
  81. data/lib/active_admin/orm/active_record.rb +1 -1
  82. data/lib/active_admin/orm/active_record/comments.rb +19 -19
  83. data/lib/active_admin/orm/active_record/comments/comment.rb +3 -3
  84. data/lib/active_admin/orm/active_record/comments/views.rb +2 -2
  85. data/lib/active_admin/orm/active_record/comments/views/active_admin_comments.rb +19 -19
  86. data/lib/active_admin/page.rb +1 -1
  87. data/lib/active_admin/pundit_adapter.rb +5 -5
  88. data/lib/active_admin/resource.rb +17 -17
  89. data/lib/active_admin/resource/action_items.rb +5 -5
  90. data/lib/active_admin/resource/attributes.rb +1 -1
  91. data/lib/active_admin/resource/belongs_to.rb +2 -2
  92. data/lib/active_admin/resource/controllers.rb +1 -1
  93. data/lib/active_admin/resource/menu.rb +4 -4
  94. data/lib/active_admin/resource/naming.rb +5 -5
  95. data/lib/active_admin/resource/routes.rb +5 -5
  96. data/lib/active_admin/resource/scope_to.rb +7 -7
  97. data/lib/active_admin/resource/sidebars.rb +1 -1
  98. data/lib/active_admin/resource_controller.rb +12 -11
  99. data/lib/active_admin/resource_controller/data_access.rb +1 -1
  100. data/lib/active_admin/resource_controller/decorators.rb +6 -26
  101. data/lib/active_admin/resource_controller/streaming.rb +7 -6
  102. data/lib/active_admin/resource_dsl.rb +5 -5
  103. data/lib/active_admin/scope.rb +6 -6
  104. data/lib/active_admin/version.rb +1 -1
  105. data/lib/active_admin/view_factory.rb +17 -17
  106. data/lib/active_admin/view_helpers.rb +1 -1
  107. data/lib/active_admin/view_helpers/breadcrumb_helper.rb +3 -3
  108. data/lib/active_admin/view_helpers/display_helper.rb +5 -5
  109. data/lib/active_admin/view_helpers/download_format_links_helper.rb +1 -1
  110. data/lib/active_admin/view_helpers/fields_for.rb +2 -2
  111. data/lib/active_admin/views.rb +1 -1
  112. data/lib/active_admin/views/components/active_admin_form.rb +5 -5
  113. data/lib/active_admin/views/components/attributes_table.rb +5 -5
  114. data/lib/active_admin/views/components/blank_slate.rb +1 -1
  115. data/lib/active_admin/views/components/dropdown_menu.rb +8 -8
  116. data/lib/active_admin/views/components/index_list.rb +3 -3
  117. data/lib/active_admin/views/components/menu.rb +1 -1
  118. data/lib/active_admin/views/components/menu_item.rb +4 -4
  119. data/lib/active_admin/views/components/paginated_collection.rb +18 -18
  120. data/lib/active_admin/views/components/panel.rb +1 -1
  121. data/lib/active_admin/views/components/scopes.rb +7 -5
  122. data/lib/active_admin/views/components/site_title.rb +1 -1
  123. data/lib/active_admin/views/components/status_tag.rb +11 -11
  124. data/lib/active_admin/views/components/table_for.rb +17 -17
  125. data/lib/active_admin/views/components/tabs.rb +3 -3
  126. data/lib/active_admin/views/footer.rb +2 -1
  127. data/lib/active_admin/views/header.rb +2 -2
  128. data/lib/active_admin/views/index_as_blog.rb +1 -1
  129. data/lib/active_admin/views/index_as_grid.rb +1 -1
  130. data/lib/active_admin/views/index_as_table.rb +16 -16
  131. data/lib/active_admin/views/pages/base.rb +14 -10
  132. data/lib/active_admin/views/pages/index.rb +14 -13
  133. data/lib/active_admin/views/tabbed_navigation.rb +2 -2
  134. data/lib/active_admin/views/title_bar.rb +1 -1
  135. data/lib/activeadmin.rb +1 -1
  136. data/lib/generators/active_admin/assets/assets_generator.rb +2 -2
  137. data/lib/generators/active_admin/assets/templates/active_admin.scss +2 -2
  138. data/lib/generators/active_admin/devise/devise_generator.rb +5 -5
  139. data/lib/generators/active_admin/install/install_generator.rb +14 -8
  140. data/lib/generators/active_admin/install/templates/active_admin.rb.erb +9 -2
  141. data/lib/generators/active_admin/page/page_generator.rb +1 -1
  142. data/lib/generators/active_admin/resource/resource_generator.rb +3 -3
  143. data/lib/generators/active_admin/webpacker/plugins/jquery.js +7 -0
  144. data/lib/generators/active_admin/webpacker/templates/active_admin.js +5 -0
  145. data/lib/generators/active_admin/webpacker/templates/active_admin.scss +17 -0
  146. data/lib/generators/active_admin/webpacker/templates/print.scss +2 -0
  147. data/lib/generators/active_admin/webpacker/webpacker_generator.rb +26 -0
  148. data/lib/ransack_ext.rb +8 -8
  149. metadata +20 -8
@@ -4,7 +4,7 @@ module ActiveAdmin
4
4
  class SiteTitle < Component
5
5
 
6
6
  def tag_name
7
- 'h1'
7
+ "h1"
8
8
  end
9
9
 
10
10
  def build(namespace)
@@ -5,11 +5,11 @@ module ActiveAdmin
5
5
  builder_method :status_tag
6
6
 
7
7
  def tag_name
8
- 'span'
8
+ "span"
9
9
  end
10
10
 
11
11
  def default_class_name
12
- 'status_tag'
12
+ "status_tag"
13
13
  end
14
14
 
15
15
  # @overload status_tag(status, options = {})
@@ -49,12 +49,12 @@ module ActiveAdmin
49
49
 
50
50
  def convert_to_boolean_status(status)
51
51
  case status
52
- when true, 'true'
53
- 'Yes'
54
- when false, 'false'
55
- 'No'
52
+ when true, "true"
53
+ "Yes"
54
+ when false, "false"
55
+ "No"
56
56
  when nil
57
- 'Unset'
57
+ "Unset"
58
58
  else
59
59
  status
60
60
  end
@@ -62,12 +62,12 @@ module ActiveAdmin
62
62
 
63
63
  def status_to_class(status)
64
64
  case status
65
- when 'Unset'
66
- 'unset no'
65
+ when "Unset"
66
+ "unset no"
67
67
  when String, Symbol
68
- status.to_s.titleize.gsub(/\s/, '').underscore
68
+ status.to_s.titleize.gsub(/\s/, "").underscore
69
69
  else
70
- ''
70
+ ""
71
71
  end
72
72
  end
73
73
  end
@@ -4,18 +4,18 @@ module ActiveAdmin
4
4
  builder_method :table_for
5
5
 
6
6
  def tag_name
7
- 'table'
7
+ "table"
8
8
  end
9
9
 
10
10
  def build(obj, *attrs)
11
- options = attrs.extract_options!
12
- @sortable = options.delete(:sortable)
13
- @collection = obj.respond_to?(:each) && !obj.is_a?(Hash) ? obj : [obj]
11
+ options = attrs.extract_options!
12
+ @sortable = options.delete(:sortable)
13
+ @collection = obj.respond_to?(:each) && !obj.is_a?(Hash) ? obj : [obj]
14
14
  @resource_class = options.delete(:i18n)
15
15
  @resource_class ||= @collection.klass if @collection.respond_to? :klass
16
16
 
17
- @columns = []
18
- @row_class = options.delete(:row_class)
17
+ @columns = []
18
+ @row_class = options.delete(:row_class)
19
19
 
20
20
  build_table
21
21
  super(options)
@@ -29,7 +29,7 @@ module ActiveAdmin
29
29
  def column(*args, &block)
30
30
  options = default_options.merge(args.extract_options!)
31
31
  title = args[0]
32
- data = args[1] || args[0]
32
+ data = args[1] || args[0]
33
33
 
34
34
  col = Column.new(title, data, @resource_class, options, &block)
35
35
  @columns << col
@@ -65,12 +65,12 @@ module ActiveAdmin
65
65
  end
66
66
 
67
67
  def build_table_header(col)
68
- classes = Arbre::HTML::ClassList.new
68
+ classes = Arbre::HTML::ClassList.new
69
69
  sort_key = sortable? && col.sortable? && col.sort_key
70
- params = request.query_parameters.except :page, :order, :commit, :format
70
+ params = request.query_parameters.except :page, :order, :commit, :format
71
71
 
72
- classes << 'sortable' if sort_key
73
- classes << "sorted-#{current_sort[1]}" if sort_key && current_sort[0] == sort_key
72
+ classes << "sortable" if sort_key
73
+ classes << "sorted-#{current_sort[1]}" if sort_key && current_sort[0] == sort_key
74
74
  classes << col.html_class
75
75
 
76
76
  if sort_key
@@ -86,13 +86,13 @@ module ActiveAdmin
86
86
  @tbody = tbody do
87
87
  # Build enough rows for our collection
88
88
  @collection.each do |elem|
89
- classes = [helpers.cycle('odd', 'even')]
89
+ classes = [helpers.cycle("odd", "even")]
90
90
 
91
91
  if @row_class
92
92
  classes << @row_class.call(elem)
93
93
  end
94
94
 
95
- tr(class: classes.flatten.join(' '), id: dom_id_for(elem))
95
+ tr(class: classes.flatten.join(" "), id: dom_id_for(elem))
96
96
  end
97
97
  end
98
98
  end
@@ -126,8 +126,8 @@ module ActiveAdmin
126
126
  # 'desc' it will return 'asc'
127
127
  def order_for_sort_key(sort_key)
128
128
  current_key, current_order = current_sort
129
- return 'desc' unless current_key == sort_key
130
- current_order == 'desc' ? 'asc' : 'desc'
129
+ return "desc" unless current_key == sort_key
130
+ current_order == "desc" ? "asc" : "desc"
131
131
  end
132
132
 
133
133
  def default_options
@@ -138,7 +138,7 @@ module ActiveAdmin
138
138
 
139
139
  class Column
140
140
 
141
- attr_accessor :title, :data , :html_class
141
+ attr_accessor :title, :data, :html_class
142
142
 
143
143
  def initialize(*args, &block)
144
144
  @options = args.extract_options!
@@ -150,7 +150,7 @@ module ActiveAdmin
150
150
  elsif @title.present?
151
151
  html_classes << "col-#{@title.to_s.parameterize(separator: "_")}"
152
152
  end
153
- @html_class = html_classes.join(' ')
153
+ @html_class = html_classes.join(" ")
154
154
  @data = args[1] || args[0]
155
155
  @data = block if block
156
156
  @resource_class = args[2]
@@ -10,8 +10,8 @@ module ActiveAdmin
10
10
  end
11
11
 
12
12
  def build(&block)
13
- @menu = ul(class: 'nav nav-tabs', role: "tablist")
14
- @tabs_content = div(class: 'tab-content')
13
+ @menu = ul(class: "nav nav-tabs", role: "tablist")
14
+ @tabs_content = div(class: "tab-content")
15
15
  end
16
16
 
17
17
  def build_menu_item(title, options, &block)
@@ -32,7 +32,7 @@ module ActiveAdmin
32
32
 
33
33
  def fragmentize(string)
34
34
  result = string.parameterize
35
- result = URI.encode(string) if result.blank?
35
+ result = CGI.escape(string) if result.blank?
36
36
  result
37
37
  end
38
38
  end
@@ -20,7 +20,8 @@ module ActiveAdmin
20
20
  end
21
21
 
22
22
  def powered_by_message
23
- I18n.t('active_admin.powered_by',
23
+ I18n.t(
24
+ "active_admin.powered_by",
24
25
  active_admin: link_to("Active Admin", "https://activeadmin.info"),
25
26
  version: ActiveAdmin::VERSION).html_safe
26
27
  end
@@ -10,8 +10,8 @@ module ActiveAdmin
10
10
  @utility_menu = @namespace.fetch_menu(:utility_navigation)
11
11
 
12
12
  site_title @namespace
13
- global_navigation @menu, class: 'header-item tabs'
14
- utility_navigation @utility_menu, id: "utility_nav", class: 'header-item tabs'
13
+ global_navigation @menu, class: "header-item tabs"
14
+ utility_navigation @utility_menu, id: "utility_nav", class: "header-item tabs"
15
15
  end
16
16
 
17
17
  end
@@ -135,7 +135,7 @@ module ActiveAdmin
135
135
 
136
136
  def build_body(post)
137
137
  if @body
138
- div class: 'content' do
138
+ div class: "content" do
139
139
  render_method_on_post_or_call_proc post, @body
140
140
  end
141
141
  end
@@ -68,7 +68,7 @@ module ActiveAdmin
68
68
  end
69
69
 
70
70
  def build_empty_cell
71
- td '&nbsp;'.html_safe
71
+ td "&nbsp;".html_safe
72
72
  end
73
73
 
74
74
  def default_number_of_columns
@@ -278,13 +278,13 @@ module ActiveAdmin
278
278
  # Display a column for checkbox
279
279
  def selectable_column
280
280
  return unless active_admin_config.batch_actions.any?
281
- column resource_selection_toggle_cell, class: 'col-selectable', sortable: false do |resource|
281
+ column resource_selection_toggle_cell, class: "col-selectable", sortable: false do |resource|
282
282
  resource_selection_cell resource
283
283
  end
284
284
  end
285
285
 
286
286
  def index_column(start_value = 1)
287
- column '#', class: 'col-index', sortable: false do |resource|
287
+ column "#", class: "col-index", sortable: false do |resource|
288
288
  @collection.offset_value + @collection.index(resource) + start_value
289
289
  end
290
290
  end
@@ -293,9 +293,9 @@ module ActiveAdmin
293
293
  def id_column
294
294
  raise "#{resource_class.name} has no primary_key!" unless resource_class.primary_key
295
295
  column(resource_class.human_attribute_name(resource_class.primary_key), sortable: resource_class.primary_key) do |resource|
296
- if controller.action_methods.include?('show')
296
+ if controller.action_methods.include?("show")
297
297
  link_to resource.id, resource_path(resource), class: "resource_id_link"
298
- elsif controller.action_methods.include?('edit')
298
+ elsif controller.action_methods.include?("edit")
299
299
  link_to resource.id, edit_resource_path(resource), class: "resource_id_link"
300
300
  else
301
301
  resource.id
@@ -304,7 +304,7 @@ module ActiveAdmin
304
304
  end
305
305
 
306
306
  def default_actions
307
- raise '`default_actions` is no longer provided in ActiveAdmin 1.x. Use `actions` instead.'
307
+ raise "`default_actions` is no longer provided in ActiveAdmin 1.x. Use `actions` instead."
308
308
  end
309
309
 
310
310
  # Add links to perform actions.
@@ -344,12 +344,12 @@ module ActiveAdmin
344
344
  #
345
345
  # ```
346
346
  def actions(options = {}, &block)
347
- name = options.delete(:name) { '' }
348
- defaults = options.delete(:defaults) { true }
349
- dropdown = options.delete(:dropdown) { false }
350
- dropdown_name = options.delete(:dropdown_name) { I18n.t 'active_admin.dropdown_actions.button_label', default: 'Actions' }
347
+ name = options.delete(:name) { "" }
348
+ defaults = options.delete(:defaults) { true }
349
+ dropdown = options.delete(:dropdown) { false }
350
+ dropdown_name = options.delete(:dropdown_name) { I18n.t "active_admin.dropdown_actions.button_label", default: "Actions" }
351
351
 
352
- options[:class] ||= 'col-actions'
352
+ options[:class] ||= "col-actions"
353
353
 
354
354
  column name, options do |resource|
355
355
  if dropdown
@@ -373,23 +373,23 @@ module ActiveAdmin
373
373
 
374
374
  def defaults(resource, options = {})
375
375
  localizer = ActiveAdmin::Localizers.resource(active_admin_config)
376
- if controller.action_methods.include?('show') && authorized?(ActiveAdmin::Auth::READ, resource)
376
+ if controller.action_methods.include?("show") && authorized?(ActiveAdmin::Auth::READ, resource)
377
377
  item localizer.t(:view), resource_path(resource), class: "view_link #{options[:css_class]}", title: localizer.t(:view)
378
378
  end
379
- if controller.action_methods.include?('edit') && authorized?(ActiveAdmin::Auth::UPDATE, resource)
379
+ if controller.action_methods.include?("edit") && authorized?(ActiveAdmin::Auth::UPDATE, resource)
380
380
  item localizer.t(:edit), edit_resource_path(resource), class: "edit_link #{options[:css_class]}", title: localizer.t(:edit)
381
381
  end
382
- if controller.action_methods.include?('destroy') && authorized?(ActiveAdmin::Auth::DESTROY, resource)
382
+ if controller.action_methods.include?("destroy") && authorized?(ActiveAdmin::Auth::DESTROY, resource)
383
383
  item localizer.t(:delete), resource_path(resource), class: "delete_link #{options[:css_class]}", title: localizer.t(:delete),
384
- method: :delete, data: { confirm: localizer.t(:delete_confirmation) }
384
+ method: :delete, data: { confirm: localizer.t(:delete_confirmation) }
385
385
  end
386
386
  end
387
387
 
388
388
  class TableActions < ActiveAdmin::Component
389
389
  builder_method :table_actions
390
390
 
391
- def item *args
392
- text_node link_to *args
391
+ def item *args, **kwargs
392
+ text_node link_to(*args, **kwargs)
393
393
  end
394
394
  end
395
395
  end # IndexTableFor
@@ -15,7 +15,7 @@ module ActiveAdmin
15
15
  end
16
16
 
17
17
  def main_content
18
- I18n.t('active_admin.main_content', model: title).html_safe
18
+ I18n.t("active_admin.main_content", model: title).html_safe
19
19
  end
20
20
 
21
21
  private
@@ -29,7 +29,8 @@ module ActiveAdmin
29
29
  text_node(active_admin_namespace.head)
30
30
 
31
31
  active_admin_application.stylesheets.each do |style, options|
32
- text_node stylesheet_link_tag(style, options).html_safe
32
+ stylesheet_tag = active_admin_namespace.use_webpacker ? stylesheet_pack_tag(style, **options) : stylesheet_link_tag(style, **options)
33
+ text_node(stylesheet_tag.html_safe) if stylesheet_tag
33
34
  end
34
35
 
35
36
  active_admin_namespace.meta_tags.each do |name, content|
@@ -37,7 +38,8 @@ module ActiveAdmin
37
38
  end
38
39
 
39
40
  active_admin_application.javascripts.each do |path|
40
- text_node(javascript_include_tag(path))
41
+ javascript_tag = active_admin_namespace.use_webpacker ? javascript_pack_tag(path) : javascript_include_tag(path)
42
+ text_node(javascript_tag)
41
43
  end
42
44
 
43
45
  if active_admin_namespace.favicon
@@ -63,9 +65,9 @@ module ActiveAdmin
63
65
  def body_classes
64
66
  Arbre::HTML::ClassList.new [
65
67
  params[:action],
66
- params[:controller].tr('/', '_'),
67
- 'active_admin', 'logged_in',
68
- active_admin_namespace.name.to_s + '_namespace'
68
+ params[:controller].tr("/", "_"),
69
+ "active_admin", "logged_in",
70
+ active_admin_namespace.name.to_s + "_namespace"
69
71
  ]
70
72
  end
71
73
 
@@ -79,14 +81,16 @@ module ActiveAdmin
79
81
  build_flash_messages
80
82
  div id: "active_admin_content", class: (skip_sidebar? ? "without_sidebar" : "with_sidebar") do
81
83
  build_main_content_wrapper
82
- sidebar sidebar_sections_for_action, id: 'sidebar' unless skip_sidebar?
84
+ sidebar sidebar_sections_for_action, id: "sidebar" unless skip_sidebar?
83
85
  end
84
86
  end
85
87
 
86
88
  def build_flash_messages
87
- div class: 'flashes' do
88
- flash_messages.each do |type, message|
89
- div message, class: "flash flash_#{type}"
89
+ div class: "flashes" do
90
+ flash_messages.each do |type, messages|
91
+ [*messages].each do |message|
92
+ div message, class: "flash flash_#{type}"
93
+ end
90
94
  end
91
95
  end
92
96
  end
@@ -1,4 +1,4 @@
1
- require 'active_admin/helpers/collection'
1
+ require "active_admin/helpers/collection"
2
2
 
3
3
  module ActiveAdmin
4
4
  module Views
@@ -111,7 +111,7 @@ module ActiveAdmin
111
111
 
112
112
  def render_blank_slate
113
113
  blank_slate_content = I18n.t("active_admin.blank_slate.content", resource_name: active_admin_config.plural_resource_label)
114
- if controller.action_methods.include?('new') && authorized?(ActiveAdmin::Auth::CREATE, active_admin_config.resource_class)
114
+ if controller.action_methods.include?("new") && authorized?(ActiveAdmin::Auth::CREATE, active_admin_config.resource_class)
115
115
  blank_slate_content = [blank_slate_content, blank_slate_link].compact.join(" ")
116
116
  end
117
117
  insert_tag(view_factory.blank_slate, blank_slate_content)
@@ -125,18 +125,19 @@ module ActiveAdmin
125
125
  def render_index
126
126
  renderer_class = find_index_renderer_class(config[:as])
127
127
 
128
- paginator = config.fetch(:paginator, true)
129
- download_links = config.fetch(:download_links, active_admin_config.namespace.download_links)
128
+ paginator = config.fetch(:paginator, true)
129
+ download_links = config.fetch(:download_links, active_admin_config.namespace.download_links)
130
130
  pagination_total = config.fetch(:pagination_total, true)
131
- per_page = config.fetch(:per_page, active_admin_config.per_page)
132
-
133
- paginated_collection(collection, entry_name: active_admin_config.resource_label,
134
- entries_name: active_admin_config.plural_resource_label(count: collection_size),
135
- download_links: download_links,
136
- paginator: paginator,
137
- per_page: per_page,
138
- pagination_total: pagination_total) do
139
- div class: 'index_content' do
131
+ per_page = config.fetch(:per_page, active_admin_config.per_page)
132
+
133
+ paginated_collection(
134
+ collection, entry_name: active_admin_config.resource_label,
135
+ entries_name: active_admin_config.plural_resource_label(count: collection_size),
136
+ download_links: download_links,
137
+ paginator: paginator,
138
+ per_page: per_page,
139
+ pagination_total: pagination_total) do
140
+ div class: "index_content" do
140
141
  insert_tag(renderer_class, config, collection)
141
142
  end
142
143
  end
@@ -1,10 +1,10 @@
1
- require_relative 'components/menu'
1
+ require_relative "components/menu"
2
2
 
3
3
  module ActiveAdmin
4
4
  module Views
5
5
  class TabbedNavigation < Menu
6
6
  def build(menu, options = {})
7
- super(menu, options.reverse_merge(id: 'tabs'))
7
+ super(menu, options.reverse_merge(id: "tabs"))
8
8
  end
9
9
  end
10
10
  end
@@ -43,7 +43,7 @@ module ActiveAdmin
43
43
  end
44
44
 
45
45
  def build_title_tag
46
- h2(@title, id: 'page_title')
46
+ h2(@title, id: "page_title")
47
47
  end
48
48
 
49
49
  def build_action_items
@@ -1 +1 @@
1
- require 'active_admin'
1
+ require "active_admin"
@@ -2,10 +2,10 @@ module ActiveAdmin
2
2
  module Generators
3
3
  class AssetsGenerator < Rails::Generators::Base
4
4
 
5
- source_root File.expand_path('templates', __dir__)
5
+ source_root File.expand_path("templates", __dir__)
6
6
 
7
7
  def install_assets
8
- template 'active_admin.js', 'app/assets/javascripts/active_admin.js'
8
+ template "active_admin.js", "app/assets/javascripts/active_admin.js"
9
9
  template "active_admin.scss", "app/assets/stylesheets/active_admin.scss"
10
10
  end
11
11
 
@@ -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; }