activeadmin 2.14.0 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +54 -0
  3. data/CONTRIBUTING.md +0 -7
  4. data/config/locales/ar.yml +0 -7
  5. data/config/locales/az.yml +0 -7
  6. data/config/locales/bg.yml +0 -7
  7. data/config/locales/bs.yml +0 -7
  8. data/config/locales/ca.yml +0 -7
  9. data/config/locales/cs.yml +0 -7
  10. data/config/locales/da.yml +0 -7
  11. data/config/locales/de-CH.yml +0 -7
  12. data/config/locales/de.yml +0 -8
  13. data/config/locales/el.yml +0 -7
  14. data/config/locales/en-CA.yml +0 -7
  15. data/config/locales/en-GB.yml +0 -7
  16. data/config/locales/en.yml +0 -8
  17. data/config/locales/eo.yml +0 -8
  18. data/config/locales/es-MX.yml +0 -7
  19. data/config/locales/es.yml +0 -8
  20. data/config/locales/fa.yml +0 -7
  21. data/config/locales/fi.yml +0 -7
  22. data/config/locales/fr.yml +0 -8
  23. data/config/locales/he.yml +0 -9
  24. data/config/locales/hr.yml +0 -7
  25. data/config/locales/hu.yml +0 -8
  26. data/config/locales/id.yml +0 -7
  27. data/config/locales/it.yml +0 -8
  28. data/config/locales/ja.yml +0 -8
  29. data/config/locales/ko.yml +0 -7
  30. data/config/locales/lt.yml +0 -8
  31. data/config/locales/lv.yml +0 -7
  32. data/config/locales/mk.yml +0 -8
  33. data/config/locales/nb.yml +0 -8
  34. data/config/locales/nl.yml +0 -8
  35. data/config/locales/pl.yml +0 -8
  36. data/config/locales/pt-BR.yml +0 -8
  37. data/config/locales/pt-PT.yml +0 -7
  38. data/config/locales/ro.yml +0 -7
  39. data/config/locales/ru.yml +0 -6
  40. data/config/locales/sk.yml +0 -8
  41. data/config/locales/sv-SE.yml +58 -39
  42. data/config/locales/tr.yml +0 -11
  43. data/config/locales/uk.yml +0 -6
  44. data/config/locales/vi.yml +0 -8
  45. data/config/locales/zh-CN.yml +0 -8
  46. data/config/locales/zh-TW.yml +0 -7
  47. data/lib/active_admin/csv_builder.rb +23 -2
  48. data/lib/active_admin/engine.rb +4 -0
  49. data/lib/active_admin/filters/active_filter.rb +1 -1
  50. data/lib/active_admin/filters/forms.rb +2 -2
  51. data/lib/active_admin/filters/formtastic_addons.rb +1 -1
  52. data/lib/active_admin/inputs/filters/base/search_method_select.rb +2 -2
  53. data/lib/active_admin/inputs/filters/date_range_input.rb +2 -2
  54. data/lib/active_admin/inputs/filters/numeric_input.rb +1 -1
  55. data/lib/active_admin/inputs/filters/select_input.rb +2 -0
  56. data/lib/active_admin/inputs/filters/string_input.rb +1 -1
  57. data/lib/active_admin/menu.rb +1 -0
  58. data/lib/active_admin/namespace.rb +1 -1
  59. data/lib/active_admin/namespace_settings.rb +1 -1
  60. data/lib/active_admin/orm/active_record/comments/comment.rb +8 -0
  61. data/lib/active_admin/pundit_adapter.rb +1 -1
  62. data/lib/active_admin/resource_controller/streaming.rb +1 -1
  63. data/lib/active_admin/version.rb +1 -1
  64. data/lib/active_admin/view_helpers/display_helper.rb +8 -1
  65. data/lib/active_admin/views/components/active_admin_form.rb +0 -4
  66. data/lib/active_admin/views/index_as_table.rb +0 -4
  67. data/lib/active_admin/views/pages/show.rb +1 -7
  68. data/lib/active_admin.rb +4 -2
  69. data/lib/generators/active_admin/install/templates/active_admin.rb.erb +1 -1
  70. metadata +16 -35
  71. data/lib/active_admin/deprecation.rb +0 -11
  72. data/lib/ransack_ext.rb +0 -21
@@ -25,12 +25,6 @@ ru:
25
25
  filter: "Фильтровать"
26
26
  clear: "Очистить"
27
27
  predicates:
28
- contains: "Содержит"
29
- equals: "Равно"
30
- starts_with: "Начинается с"
31
- ends_with: "Заканчивается"
32
- greater_than: "больше"
33
- less_than: "меньше"
34
28
  from: "От"
35
29
  to: "До"
36
30
  search_status:
@@ -47,14 +47,6 @@ sk:
47
47
  filter: "Filtrovať"
48
48
  clear: "Vyčistiť filtre"
49
49
  predicates:
50
- contains: "Obsahuje"
51
- equals: "Je presne"
52
- starts_with: "Začína na"
53
- ends_with: "Končí na"
54
- greater_than: "Väčší ako"
55
- less_than: "Menší ako"
56
- gteq_datetime: "Od"
57
- lteq_datetime: "Do"
58
50
  from: "Od"
59
51
  to: "Do"
60
52
  scopes:
@@ -1,17 +1,34 @@
1
1
  "sv-SE":
2
+ activerecord:
3
+ models:
4
+ comment:
5
+ one: "Kommentar"
6
+ other: "Kommentarer"
7
+ active_admin/comment:
8
+ one: "Kommentar"
9
+ other: "Kommentarer"
10
+ attributes:
11
+ active_admin/comment:
12
+ author_type: "Författartyp"
13
+ body: "Innehåll"
14
+ created_at: "Skapad"
15
+ namespace: "Namnrymd"
16
+ resource_type: "Resurstyp"
17
+ updated_at: "Aktualiserad"
2
18
  active_admin:
3
19
  dashboard: Skrivbord
4
20
  dashboard_welcome:
5
21
  welcome: "Välkommen till Active Admin. Detta är ditt standardskrivbord."
6
- call_to_action: "För att lägga till sektioner, gör en checkout på 'app/admin/dashboard.rb'"
22
+ call_to_action: "För att lägga till sektioner, till 'app/admin/dashboard.rb'"
7
23
  view: "Visa"
8
24
  edit: "Redigera"
9
25
  delete: "Ta bort"
10
- delete_confirmation: "Är du säker att du vill ta bort denna?"
26
+ delete_confirmation: "Är du säker att du vill ta bort detta?"
27
+ create_another: "Skapa en till %{model}"
11
28
  new_model: "Ny %{model}"
12
29
  edit_model: "Redigera %{model}"
13
30
  delete_model: "Ta bort %{model}"
14
- details: "Detaljvy för %{model}"
31
+ details: "%{model}-detaljer"
15
32
  cancel: "Avbryt"
16
33
  empty: "Tom"
17
34
  previous: "Föregående"
@@ -20,82 +37,84 @@
20
37
  has_many_new: "Skapa en ny %{model}"
21
38
  has_many_delete: "Ta bort"
22
39
  has_many_remove: "Ta bort"
40
+ move: "Flytta"
23
41
  filters:
24
42
  buttons:
25
- filter: "Filter"
43
+ filter: "Filtrera"
26
44
  clear: "Rensa filter"
27
45
  predicates:
28
- contains: "Innehåller"
29
- equals: "Lika med"
30
- starts_with: "Börjar med"
31
- ends_with: "Slutar med"
32
- greater_than: "Större än"
33
- less_than: "Mindre än"
34
46
  from: "Från"
35
47
  to: "Till"
48
+ scopes:
49
+ all: "Alla"
36
50
  search_status:
37
- headline: "Sök status:"
38
- current_scope: "Scope:"
39
- current_filters: "Nuvarande filter:"
51
+ headline: "Sökstatus:"
52
+ current_scope: "Omfattning:"
53
+ current_filters: "Aktiva filter:"
40
54
  no_current_filters: "Inga"
41
55
  status_tag:
42
56
  "yes": "Ja"
43
57
  "no": "Nej"
44
58
  "unset": "Nej"
45
- main_content: "Implementera %{model}#main_content för att kunna visa något."
59
+ main_content: "Implementera %{model}#main_content för att visa innehåll."
46
60
  logout: "Logga ut"
47
61
  powered_by: "Powered by %{active_admin} %{version}"
48
62
  sidebars:
49
63
  filters: "Filter"
50
- search_status: "Sök status"
64
+ search_status: "Sökstatus"
51
65
  pagination:
52
- empty: "Ingen %{model} funnen"
53
- one: "Visar <b>1</b> utav %{model}"
54
- one_page: "Visar <b>alla %{n}</b> utav %{model}"
66
+ empty: "Ingen %{model} hittades"
67
+ one: "Visar <b>1</b> %{model}"
68
+ one_page: "Visar <b>alla %{n}</b> %{model}"
55
69
  multiple: "Visar %{model} <b>%{from}&nbsp;-&nbsp;%{to}</b> av <b>%{total}</b> totalt"
56
70
  multiple_without_total: "Visar %{model} <b>%{from}&nbsp;-&nbsp;%{to}</b>"
71
+ per_page: "Per sida: "
57
72
  entry:
58
73
  one: "inlägg"
59
74
  other: "inlägg"
60
- any: "Någon"
75
+ any: "Alla"
61
76
  blank_slate:
62
- content: "Finns inga %{resource_name} än."
77
+ content: "Det finns inga %{resource_name} än."
63
78
  link: "Skapa en"
64
79
  dropdown_actions:
65
- button_label: "Behandling"
80
+ button_label: "Åtgärder"
66
81
  batch_actions:
67
- button_label: "Batch behandling"
82
+ button_label: "Batch-åtgärder"
68
83
  default_confirmation: "Är du säker på att du vill göra detta?"
69
84
  delete_confirmation: "Är du säker på att du vill radera dessa %{plural_model}?"
70
85
  succesfully_destroyed:
71
86
  one: "Lyckades radera 1 %{model}"
72
87
  other: "Lyckades radera %{count} %{plural_model}"
73
- selection_toggle_explanation: "(Toggle Selection)"
74
- action_label: "%{title} Markerad"
88
+ selection_toggle_explanation: "(Byt markering)"
89
+ action_label: "%{title} markerad"
75
90
  labels:
76
91
  destroy: "Radera"
77
92
  comments:
78
93
  created_at: "Skapad"
79
- resource_type: "Resurs typ"
80
- author_type: "Författar typ"
94
+ resource_type: "Resurstyp"
95
+ author_type: "Författartyp"
81
96
  body: "Innehåll"
82
97
  author: "Författare"
83
98
  add: "Lägg till kommentar"
99
+ delete: "Radera kommentar"
100
+ delete_confirmation: "Är du säker på att du vill radera dessa kommentarer?"
84
101
  resource: "Resurs"
85
102
  no_comments_yet: "Inga kommentarer än."
86
103
  author_missing: "Anonym"
87
104
  title_content: "Kommentarer (%{count})"
88
105
  errors:
89
- empty_text: "Kommentaren sparades inte, måste innehålla text."
106
+ empty_text: "Kommentaren sparades inte. Textfältet får inte vara tomt."
90
107
  devise:
91
108
  username:
92
109
  title: "Användarnamn"
93
110
  email:
94
- title: "Epost"
111
+ title: "E-post"
95
112
  subdomain:
96
113
  title: "Subdomän"
97
114
  password:
98
115
  title: "Lösenord"
116
+ password_confirmation:
117
+ title: "Bekräfta lösenord"
99
118
  sign_up:
100
119
  title: "Registera"
101
120
  submit: "Registera"
@@ -105,29 +124,29 @@
105
124
  submit: "Inloggning"
106
125
  reset_password:
107
126
  title: "Glömt ditt lösenord?"
108
- submit: "Återställa mitt lösenord"
127
+ submit: "Återställ mitt lösenord"
109
128
  change_password:
110
129
  title: "Ändra ditt lösenord"
111
130
  submit: "Ändra mitt lösenord"
112
131
  unlock:
113
- title: "Skicka upplåsnings instruktioner"
114
- submit: "Skicka upplåsnings instruktioner"
132
+ title: "Skicka upplåsningsinstruktioner"
133
+ submit: "Skicka upplåsningsinstruktioner"
115
134
  resend_confirmation_instructions:
116
- title: "Skicka bekräftnings instruktioner"
117
- submit: "Skicka bekräftnings instruktioner"
135
+ title: "Skicka bekräftelseinstruktioner"
136
+ submit: "Skicka bekräftelseinstruktioner"
118
137
  links:
119
138
  sign_up: "Registera"
120
139
  sign_in: "Logga in"
121
140
  forgot_your_password: "Glömt ditt lösenord?"
122
141
  sign_in_with_omniauth_provider: "Logga in med %{provider}"
123
- resend_unlock_instructions: "Skicka upplåsnings instruktioner"
124
- resend_confirmation_instructions: "Skicka bekräftnings instruktioner"
142
+ resend_unlock_instructions: "Skicka upplåsningsinstruktioner igen"
143
+ resend_confirmation_instructions: "Skicka bekräftningsinstruktioner igen"
125
144
  unsupported_browser:
126
- headline: "Notera att ActiveAdmin inte längre stödjer Internet Explorer version 8 eller mindre."
127
- recommendation: "Vi rekommenderar dig att uppgradera till den senaste versionen av <a href=\"http://windows.microsoft.com/ie\">Internet Explorer</a>, <a href=\"https://chrome.google.com/\">Google Chrome</a>, eller <a href=\"https://mozilla.org/firefox/\">Firefox</a>."
128
- turn_off_compatibility_view: "Om du använder IE 9 eller senare, se till att <a href=\"https://support.microsoft.com/sv-se/help/17471\">stäng av \"Compatibility View\"</a>."
145
+ headline: "Observera att ActiveAdmin inte längre stödjer Internet Explorer version 8 eller lägre."
146
+ recommendation: "Vi rekommenderar att du uppgraderar till den senaste versionen av <a href=\"http://windows.microsoft.com/ie\">Internet Explorer</a>, <a href=\"https://chrome.google.com/\">Google Chrome</a>, eller <a href=\"https://mozilla.org/firefox/\">Firefox</a>."
147
+ turn_off_compatibility_view: "Om du använder IE 9 eller senare, se till att <a href=\"https://support.microsoft.com/sv-se/help/17471\">stänga av \"Compatibility View\"</a>."
129
148
  access_denied:
130
- message: "Du har inte rättighet att utföra denna åtgärd."
149
+ message: "Du har inte behörighet att utföra denna åtgärd."
131
150
  index_list:
132
151
  table: "Tabell"
133
152
  block: "Lista"
@@ -26,17 +26,6 @@ tr:
26
26
  buttons:
27
27
  filter: "Filtrele"
28
28
  clear: "Filtreleri Temizle"
29
- predicates:
30
- contains: "İçerir"
31
- equals: "Eşittir"
32
- starts_with: "İle başlar"
33
- ends_with: "İle biter"
34
- greater_than: "Büyüktür"
35
- less_than: "Küçüktür"
36
- gteq_datetime: "Büyük yada eşit"
37
- lteq_datetime: "Küçük yada eşit"
38
- from: "Başlangıç"
39
- to: "Bitiş"
40
29
  search_status:
41
30
  headline: "Arama"
42
31
  current_scope: "Kapsam:"
@@ -25,12 +25,6 @@ uk:
25
25
  filter: "Фільтрувати"
26
26
  clear: "Очистити"
27
27
  predicates:
28
- contains: "Містить"
29
- equals: "="
30
- starts_with: "Починається з"
31
- ends_with: "Закінчується"
32
- greater_than: "більше"
33
- less_than: "менше"
34
28
  from: "від"
35
29
  to: "до"
36
30
  search_status:
@@ -43,14 +43,6 @@ vi:
43
43
  filter: "Lọc"
44
44
  clear: "Xóa dữ liệu lọc"
45
45
  predicates:
46
- contains: "Có chứa"
47
- equals: "Bằng"
48
- starts_with: "Bắt đầu với"
49
- ends_with: "Kết thúc bởi"
50
- greater_than: "Lớn hơn"
51
- less_than: "Nhỏ hơn"
52
- gteq_datetime: "Lớn hơn hoặc bằng"
53
- lteq_datetime: "Nhỏ hơn hoặc bằng"
54
46
  from: "Từ"
55
47
  to: "Đến"
56
48
  scopes:
@@ -43,14 +43,6 @@
43
43
  filter: "过滤"
44
44
  clear: "清除条件"
45
45
  predicates:
46
- contains: "包含"
47
- equals: "等于"
48
- starts_with: "始于"
49
- ends_with: "止于"
50
- greater_than: "大于"
51
- less_than: "小于"
52
- gteq_datetime: "大于等于"
53
- lteq_datetime: "小于等于"
54
46
  from: "起"
55
47
  to: "止"
56
48
  scopes:
@@ -24,13 +24,6 @@
24
24
  buttons:
25
25
  filter: "篩選"
26
26
  clear: "清除篩選條件"
27
- predicates:
28
- contains: "包含"
29
- equals: "等於"
30
- starts_with: "開頭為"
31
- ends_with: "結尾為"
32
- greater_than: "大於"
33
- less_than: "小於"
34
27
  search_status:
35
28
  headline: "搜尋條件:"
36
29
  current_scope: "子集:"
@@ -51,7 +51,7 @@ module ActiveAdmin
51
51
  csv << bom if bom
52
52
 
53
53
  if column_names
54
- csv << CSV.generate_line(columns.map { |c| encode c.name, options }, **csv_options)
54
+ csv << CSV.generate_line(columns.map { |c| sanitize(encode(c.name, options)) }, **csv_options)
55
55
  end
56
56
 
57
57
  controller.send(:in_paginated_batches) do |resource|
@@ -70,7 +70,7 @@ module ActiveAdmin
70
70
 
71
71
  def build_row(resource, columns, options)
72
72
  columns.map do |column|
73
- encode call_method_or_proc_on(resource, column.data), options
73
+ sanitize(encode(call_method_or_proc_on(resource, column.data), options))
74
74
  end
75
75
  end
76
76
 
@@ -86,6 +86,10 @@ module ActiveAdmin
86
86
  end
87
87
  end
88
88
 
89
+ def sanitize(content)
90
+ Sanitizer.sanitize(content)
91
+ end
92
+
89
93
  def method_missing(method, *args, &block)
90
94
  if @view_context.respond_to? method
91
95
  @view_context.public_send method, *args, &block
@@ -120,4 +124,21 @@ module ActiveAdmin
120
124
  @column_transitive_options ||= @options.slice(*COLUMN_TRANSITIVE_OPTIONS)
121
125
  end
122
126
  end
127
+
128
+ # Prevents CSV Injection according to https://owasp.org/www-community/attacks/CSV_Injection
129
+ module Sanitizer
130
+ extend self
131
+
132
+ ATTACK_CHARACTERS = ["=", "+", "-", "@", "\t", "\r"].freeze
133
+
134
+ def sanitize(value)
135
+ return "'#{value}" if require_sanitization?(value)
136
+
137
+ value
138
+ end
139
+
140
+ def require_sanitization?(value)
141
+ value.is_a?(String) && value.starts_with?(*ATTACK_CHARACTERS)
142
+ end
143
+ end
123
144
  end
@@ -21,5 +21,9 @@ module ActiveAdmin
21
21
  initializer "active_admin.routes" do
22
22
  require "active_admin/helpers/routes/url_helpers"
23
23
  end
24
+
25
+ initializer "active_admin.deprecator" do |app|
26
+ app.deprecators[:activeadmin] = ActiveAdmin.deprecator if app.respond_to?(:deprecators)
27
+ end
24
28
  end
25
29
  end
@@ -41,7 +41,7 @@ module ActiveAdmin
41
41
 
42
42
  def predicate_name
43
43
  I18n.t(
44
- "active_admin.filters.predicates.#{condition.predicate.name}",
44
+ "ransack.predicates.#{condition.predicate.name}",
45
45
  default: ransack_predicate_name)
46
46
  end
47
47
 
@@ -21,7 +21,7 @@ module ActiveAdmin
21
21
  # Returns the default filter type for a given attribute. If you want
22
22
  # to use a custom search method, you have to specify the type yourself.
23
23
  def default_input_type(method, options = {})
24
- if method =~ /_(eq|equals|cont|contains|start|starts_with|end|ends_with)\z/
24
+ if method =~ /_(eq|cont|start|end)\z/
25
25
  :string
26
26
  elsif klass._ransackers.key?(method.to_s)
27
27
  klass._ransackers[method.to_s].type
@@ -31,7 +31,7 @@ module ActiveAdmin
31
31
  case column.type
32
32
  when :date, :datetime
33
33
  :date_range
34
- when :string, :text
34
+ when :string, :text, :citext
35
35
  :string
36
36
  when :integer, :float, :decimal
37
37
  :numeric
@@ -47,7 +47,7 @@ module ActiveAdmin
47
47
  #
48
48
 
49
49
  def searchable_has_many_through?
50
- if reflection && reflection.options[:through]
50
+ if klass.ransackable_associations.include?(method.to_s) && reflection && reflection.options[:through]
51
51
  reflection.through_reflection.klass.ransackable_attributes.include? reflection.foreign_key
52
52
  else
53
53
  false
@@ -9,7 +9,7 @@
9
9
  # include Base
10
10
  # include Base::SearchMethodSelect
11
11
  #
12
- # filter :equals, :greater_than, :less_than
12
+ # filter :eq, :gt, :lt
13
13
  # end
14
14
  #
15
15
  module ActiveAdmin
@@ -65,7 +65,7 @@ module ActiveAdmin
65
65
 
66
66
  def filter_options
67
67
  filters.collect do |filter|
68
- [I18n.t("active_admin.filters.predicates.#{filter}"), "#{method}_#{filter}"]
68
+ [I18n.t("ransack.predicates.#{filter}").capitalize, "#{method}_#{filter}"]
69
69
  end
70
70
  end
71
71
 
@@ -15,12 +15,12 @@ module ActiveAdmin
15
15
  end
16
16
 
17
17
  def gt_input_name
18
- column && column.type == :date ? "#{method}_gteq" : "#{method}_gteq_datetime"
18
+ "#{method}_gteq"
19
19
  end
20
20
  alias :input_name :gt_input_name
21
21
 
22
22
  def lt_input_name
23
- column && column.type == :date ? "#{method}_lteq" : "#{method}_lteq_datetime"
23
+ "#{method}_lteq"
24
24
  end
25
25
 
26
26
  def input_html_options
@@ -6,7 +6,7 @@ module ActiveAdmin
6
6
  include Base
7
7
  include Base::SearchMethodSelect
8
8
 
9
- filter :equals, :greater_than, :less_than
9
+ filter :eq, :gt, :lt
10
10
  end
11
11
  end
12
12
  end
@@ -43,6 +43,8 @@ module ActiveAdmin
43
43
  else
44
44
  super
45
45
  end
46
+ rescue ActiveRecord::QueryCanceled => error
47
+ raise ActiveRecord::QueryCanceled.new "#{error.message.strip} while querying the values for the ActiveAdmin :#{method} filter"
46
48
  end
47
49
 
48
50
  def pluck_column
@@ -6,7 +6,7 @@ module ActiveAdmin
6
6
  include Base
7
7
  include Base::SearchMethodSelect
8
8
 
9
- filter :contains, :equals, :starts_with, :ends_with
9
+ filter :cont, :eq, :start, :end
10
10
 
11
11
  # If the filter method includes a search condition, build a normal string search field.
12
12
  # Else, build a search field with a companion dropdown to choose a search condition from.
@@ -48,6 +48,7 @@ module ActiveAdmin
48
48
  # menu.add parent: 'Dashboard', label: 'My Child Dashboard'
49
49
  #
50
50
  def add(options)
51
+ options = options.dup # Make sure parameter is not modified
51
52
  parent_chain = Array.wrap(options.delete(:parent))
52
53
 
53
54
  item = if parent = parent_chain.shift
@@ -28,7 +28,7 @@ module ActiveAdmin
28
28
  class Namespace
29
29
  class << self
30
30
  def setting(name, default)
31
- Deprecation.warn "This method does not do anything and will be removed."
31
+ ActiveAdmin.deprecator.warn "This method does not do anything and will be removed."
32
32
  end
33
33
  end
34
34
 
@@ -119,7 +119,7 @@ module ActiveAdmin
119
119
  :title,
120
120
  :email,
121
121
  ]
122
- register :filter_method_for_large_association, "_starts_with"
122
+ register :filter_method_for_large_association, "_start"
123
123
 
124
124
  # Switch between asset pipeline and webpacker assets
125
125
  register :use_webpacker, false
@@ -28,5 +28,13 @@ module ActiveAdmin
28
28
  self.resource_type = self.class.resource_type(resource)
29
29
  end
30
30
 
31
+ def self.ransackable_attributes(auth_object = nil)
32
+ authorizable_ransackable_attributes
33
+ end
34
+
35
+ def self.ransackable_associations(auth_object = nil)
36
+ authorizable_ransackable_associations
37
+ end
38
+
31
39
  end
32
40
  end
@@ -77,7 +77,7 @@ module ActiveAdmin
77
77
 
78
78
  policy_name = policy.class.to_s
79
79
 
80
- Deprecation.warn "You have `pundit_policy_namespace` configured as `#{default_policy_namespace}`, " \
80
+ ActiveAdmin.deprecator.warn "You have `pundit_policy_namespace` configured as `#{default_policy_namespace}`, " \
81
81
  "but ActiveAdmin was unable to find policy #{default_policy_module}::#{policy_name}. " \
82
82
  "#{policy_name} will be used instead. " \
83
83
  "This behavior will be removed in future versions of ActiveAdmin. " \
@@ -31,7 +31,7 @@ module ActiveAdmin
31
31
  end
32
32
 
33
33
  def csv_filename
34
- "#{resource_collection_name.to_s.gsub('_', '-')}-#{Time.zone.now.to_date.to_formatted_s(:default)}.csv"
34
+ "#{resource_collection_name.to_s.gsub('_', '-')}-#{Time.zone.now.to_date.to_s}.csv"
35
35
  end
36
36
 
37
37
  def stream_csv
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ActiveAdmin
3
- VERSION = "2.14.0"
3
+ VERSION = "3.2.0"
4
4
  end
@@ -24,7 +24,14 @@ module ActiveAdmin
24
24
  # Attempts to call any known display name methods on the resource.
25
25
  # See the setting in `application.rb` for the list of methods and their priority.
26
26
  def display_name(resource)
27
- ERB::Util.html_escape(render_in_context(resource, display_name_method_for(resource))) unless resource.nil?
27
+ unless resource.nil?
28
+ result = render_in_context(resource, display_name_method_for(resource))
29
+ if result.to_s&.strip&.present?
30
+ ERB::Util.html_escape(result)
31
+ else
32
+ ERB::Util.html_escape(render_in_context(resource, DISPLAY_NAME_FALLBACK))
33
+ end
34
+ end
28
35
  end
29
36
 
30
37
  # Looks up and caches the first available display name method.
@@ -102,10 +102,6 @@ module ActiveAdmin
102
102
  form_builder.object
103
103
  end
104
104
 
105
- def form_buffers
106
- raise "'form_buffers' has been removed from ActiveAdmin::FormBuilder, please read https://github.com/activeadmin/activeadmin/blob/master/docs/5-forms.md for details."
107
- end
108
-
109
105
  private
110
106
 
111
107
  def create_another_checkbox
@@ -304,10 +304,6 @@ module ActiveAdmin
304
304
  end
305
305
  end
306
306
 
307
- def default_actions
308
- raise "`default_actions` is no longer provided in ActiveAdmin 1.x. Use `actions` instead."
309
- end
310
-
311
307
  # Add links to perform actions.
312
308
  #
313
309
  # ```ruby
@@ -40,13 +40,7 @@ module ActiveAdmin
40
40
  protected
41
41
 
42
42
  def default_title
43
- title = display_name(resource)
44
-
45
- if title.blank?
46
- title = "#{active_admin_config.resource_label} ##{resource.id}"
47
- end
48
-
49
- title
43
+ display_name(resource)
50
44
  end
51
45
 
52
46
  module DefaultMainContent
data/lib/active_admin.rb CHANGED
@@ -3,7 +3,6 @@ require "active_support/core_ext"
3
3
  require "set"
4
4
 
5
5
  require "ransack"
6
- require "ransack_ext"
7
6
  require "kaminari"
8
7
  require "formtastic"
9
8
  require "formtastic_i18n"
@@ -27,7 +26,6 @@ module ActiveAdmin
27
26
  autoload :ControllerAction, "active_admin/controller_action"
28
27
  autoload :CSVBuilder, "active_admin/csv_builder"
29
28
  autoload :Dependency, "active_admin/dependency"
30
- autoload :Deprecation, "active_admin/deprecation"
31
29
  autoload :Devise, "active_admin/devise"
32
30
  autoload :DSL, "active_admin/dsl"
33
31
  autoload :FormBuilder, "active_admin/form_builder"
@@ -62,6 +60,10 @@ module ActiveAdmin
62
60
  @application ||= ::ActiveAdmin::Application.new
63
61
  end
64
62
 
63
+ def deprecator
64
+ @deprecator ||= ActiveSupport::Deprecation.new("4.0", "active-admin")
65
+ end
66
+
65
67
  # Gets called within the initializer
66
68
  def setup
67
69
  application.setup!
@@ -320,7 +320,7 @@ ActiveAdmin.setup do |config|
320
320
  # :title,
321
321
  # :email,
322
322
  # ]
323
- # config.filter_method_for_large_association = '_starts_with'
323
+ # config.filter_method_for_large_association = '_start'
324
324
 
325
325
  # == Head
326
326
  #