activeadmin 1.0.0.pre1 → 1.0.0.pre2

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 (167) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +18 -16
  3. data/CHANGELOG.md +18 -1013
  4. data/Gemfile +18 -11
  5. data/LICENSE +0 -5
  6. data/README.md +0 -2
  7. data/activeadmin.gemspec +3 -1
  8. data/app/assets/javascripts/active_admin/application.js.coffee +8 -3
  9. data/app/assets/javascripts/active_admin/base.js.coffee +1 -6
  10. data/app/assets/javascripts/active_admin/jquery_ui.js.erb +11 -0
  11. data/app/assets/javascripts/active_admin/lib/flash.js.coffee +1 -1
  12. data/app/assets/javascripts/active_admin/lib/modal_dialog.js.coffee +11 -3
  13. data/app/assets/javascripts/active_admin/lib/per_page.js.coffee +5 -1
  14. data/app/assets/stylesheets/active_admin/_base.scss +1 -4
  15. data/app/assets/stylesheets/active_admin/_forms.scss +13 -8
  16. data/app/assets/stylesheets/active_admin/components/_buttons.scss +0 -5
  17. data/app/assets/stylesheets/active_admin/mixins/_all.scss +0 -1
  18. data/app/assets/stylesheets/active_admin/mixins/_sections.scss +0 -1
  19. data/app/assets/stylesheets/active_admin/mixins/_typography.scss +1 -1
  20. data/app/assets/stylesheets/active_admin/mixins/_variables.scss +1 -1
  21. data/app/assets/stylesheets/active_admin/structure/_title_bar.scss +0 -5
  22. data/app/views/layouts/active_admin_logged_out.html.erb +4 -0
  23. data/config/locales/ar.yml +14 -2
  24. data/config/locales/de-CH.yml +2 -0
  25. data/config/locales/de.yml +15 -0
  26. data/config/locales/en.yml +10 -2
  27. data/config/locales/es.yml +26 -4
  28. data/config/locales/fr.yml +5 -0
  29. data/config/locales/id.yml +135 -0
  30. data/config/locales/ja.yml +21 -3
  31. data/config/locales/ko.yml +66 -36
  32. data/config/locales/nl.yml +14 -1
  33. data/config/locales/pt-BR.yml +11 -0
  34. data/config/locales/ru.yml +15 -1
  35. data/config/locales/sv-SE.yml +45 -5
  36. data/config/locales/uk.yml +16 -4
  37. data/config/locales/zh-CN.yml +5 -0
  38. data/config/locales/zh-TW.yml +32 -1
  39. data/docs/0-installation.md +7 -1
  40. data/docs/1-general-configuration.md +9 -0
  41. data/docs/10-custom-pages.md +10 -0
  42. data/docs/12-arbre-components.md +1 -1
  43. data/docs/14-gotchas.md +2 -2
  44. data/docs/2-resource-customization.md +5 -3
  45. data/docs/3-index-pages.md +7 -0
  46. data/docs/3-index-pages/index-as-table.md +4 -0
  47. data/docs/6-show-pages.md +1 -1
  48. data/docs/7-sidebars.md +8 -0
  49. data/features/index/batch_actions.feature +21 -2
  50. data/features/index/pagination.feature +16 -12
  51. data/features/meta_tags.feature +21 -0
  52. data/features/registering_assets.feature +1 -2
  53. data/features/show/columns.feature +40 -0
  54. data/features/show/default_content.feature +2 -1
  55. data/features/step_definitions/asset_steps.rb +3 -3
  56. data/features/step_definitions/batch_action_steps.rb +11 -2
  57. data/features/step_definitions/column_steps.rb +8 -0
  58. data/features/step_definitions/configuration_steps.rb +2 -2
  59. data/features/step_definitions/factory_steps.rb +3 -2
  60. data/features/step_definitions/meta_tag_steps.rb +3 -0
  61. data/features/step_definitions/pagination_steps.rb +8 -0
  62. data/features/step_definitions/table_steps.rb +2 -1
  63. data/lib/active_admin.rb +3 -3
  64. data/lib/active_admin/application.rb +66 -16
  65. data/lib/active_admin/batch_actions.rb +0 -1
  66. data/lib/active_admin/batch_actions/controller.rb +2 -2
  67. data/lib/active_admin/batch_actions/resource_extension.rb +3 -1
  68. data/lib/active_admin/callbacks.rb +1 -1
  69. data/lib/active_admin/csv_builder.rb +2 -2
  70. data/lib/active_admin/dependency.rb +18 -16
  71. data/lib/active_admin/devise.rb +1 -1
  72. data/lib/active_admin/dsl.rb +1 -1
  73. data/lib/active_admin/event.rb +8 -17
  74. data/lib/active_admin/filters/active.rb +29 -0
  75. data/lib/active_admin/filters/forms.rb +6 -1
  76. data/lib/active_admin/filters/humanized.rb +68 -0
  77. data/lib/active_admin/filters/resource_extension.rb +48 -1
  78. data/lib/active_admin/form_builder.rb +4 -4
  79. data/lib/active_admin/generators/boilerplate.rb +37 -0
  80. data/lib/active_admin/helpers/routes/url_helpers.rb +1 -1
  81. data/lib/active_admin/inputs.rb +1 -0
  82. data/lib/active_admin/inputs/filters/date_picker_input.rb +13 -0
  83. data/lib/active_admin/inputs/filters/date_range_input.rb +1 -1
  84. data/lib/active_admin/menu.rb +1 -0
  85. data/lib/active_admin/menu_item.rb +1 -1
  86. data/lib/active_admin/namespace.rb +5 -5
  87. data/lib/active_admin/orm/active_record/comments.rb +10 -1
  88. data/lib/active_admin/orm/active_record/comments/comment.rb +1 -1
  89. data/lib/active_admin/orm/active_record/comments/views/active_admin_comments.rb +11 -0
  90. data/lib/active_admin/resource.rb +9 -3
  91. data/lib/active_admin/resource/action_items.rb +13 -3
  92. data/lib/active_admin/resource/belongs_to.rb +6 -2
  93. data/lib/active_admin/resource/pagination.rb +4 -0
  94. data/lib/active_admin/resource_collection.rb +3 -1
  95. data/lib/active_admin/resource_controller/data_access.rb +6 -11
  96. data/lib/active_admin/resource_controller/decorators.rb +1 -1
  97. data/lib/active_admin/resource_dsl.rb +8 -2
  98. data/lib/active_admin/sidebar_section.rb +4 -12
  99. data/lib/active_admin/version.rb +1 -1
  100. data/lib/active_admin/view_factory.rb +1 -2
  101. data/lib/active_admin/view_helpers.rb +0 -1
  102. data/lib/active_admin/view_helpers/display_helper.rb +3 -4
  103. data/lib/active_admin/view_helpers/method_or_proc_helper.rb +3 -3
  104. data/lib/active_admin/views/components/active_admin_form.rb +3 -3
  105. data/lib/active_admin/views/components/columns.rb +9 -4
  106. data/lib/active_admin/views/components/dropdown_menu.rb +0 -2
  107. data/lib/active_admin/views/components/paginated_collection.rb +35 -13
  108. data/lib/active_admin/views/components/panel.rb +1 -3
  109. data/lib/active_admin/views/components/sidebar_section.rb +6 -1
  110. data/lib/active_admin/views/components/status_tag.rb +3 -2
  111. data/lib/active_admin/views/components/table_for.rb +2 -1
  112. data/lib/active_admin/views/index_as_table.rb +2 -2
  113. data/lib/active_admin/views/pages/base.rb +4 -0
  114. data/lib/active_admin/views/pages/show.rb +1 -1
  115. data/lib/generators/active_admin/assets/assets_generator.rb +1 -1
  116. data/lib/generators/active_admin/assets/templates/{active_admin.css.scss → active_admin.scss} +0 -0
  117. data/lib/generators/active_admin/devise/devise_generator.rb +7 -19
  118. data/lib/generators/active_admin/install/templates/active_admin.rb.erb +29 -0
  119. data/lib/generators/active_admin/page/templates/page.rb +1 -1
  120. data/lib/generators/active_admin/resource/resource_generator.rb +6 -0
  121. data/lib/generators/active_admin/resource/templates/admin.rb +34 -13
  122. data/spec/rails_helper.rb +6 -2
  123. data/spec/requests/memory_spec.rb +1 -3
  124. data/spec/support/active_admin_request_helpers.rb +27 -0
  125. data/spec/support/detect_rails_version.rb +1 -1
  126. data/spec/support/rails_template.rb +7 -0
  127. data/spec/unit/application_spec.rb +29 -4
  128. data/spec/unit/batch_actions/resource_spec.rb +5 -0
  129. data/spec/unit/belongs_to_spec.rb +14 -0
  130. data/spec/unit/comments_spec.rb +24 -2
  131. data/spec/unit/controller_filters_spec.rb +25 -28
  132. data/spec/unit/dsl_spec.rb +1 -1
  133. data/spec/unit/filters/humanized_spec.rb +56 -0
  134. data/spec/unit/filters/resource_spec.rb +1 -1
  135. data/spec/unit/form_builder_spec.rb +71 -11
  136. data/spec/unit/generators/install_spec.rb +3 -2
  137. data/spec/unit/pretty_format_spec.rb +15 -1
  138. data/spec/unit/resource_collection_spec.rb +17 -0
  139. data/spec/unit/resource_controller_spec.rb +2 -2
  140. data/spec/unit/resource_registration_spec.rb +3 -3
  141. data/spec/unit/resource_spec.rb +53 -2
  142. data/spec/unit/view_factory_spec.rb +0 -2
  143. data/spec/unit/view_helpers/display_name_spec.rb +6 -4
  144. data/spec/unit/views/components/{batch_action_popover_spec.rb → batch_action_selector_spec.rb} +9 -13
  145. data/spec/unit/views/components/columns_spec.rb +17 -0
  146. data/spec/unit/views/components/paginated_collection_spec.rb +16 -2
  147. data/spec/unit/views/components/panel_spec.rb +1 -5
  148. data/spec/unit/views/components/sidebar_section_spec.rb +21 -0
  149. data/spec/unit/views/components/status_tag_spec.rb +15 -1
  150. data/spec/unit/views/components/table_for_spec.rb +45 -0
  151. data/tasks/parallel_tests.rake +1 -1
  152. data/tasks/test.rake +4 -4
  153. metadata +29 -30
  154. data/app/assets/javascripts/active_admin/lib/popover.js.coffee +0 -68
  155. data/app/assets/stylesheets/active_admin/components/_popovers.scss +0 -122
  156. data/app/assets/stylesheets/active_admin/mixins/_icons.scss +0 -20
  157. data/lib/active_admin/batch_actions/views/batch_action_popover.rb +0 -28
  158. data/lib/active_admin/iconic.rb +0 -53
  159. data/lib/active_admin/iconic/icons.rb +0 -142
  160. data/lib/active_admin/view_helpers/icon_helper.rb +0 -12
  161. data/lib/active_admin/views/components/action_list_popover.rb +0 -29
  162. data/lib/active_admin/views/components/popover.rb +0 -27
  163. data/spec/javascripts/coffeescripts/jquery.aa.popover-spec.js.coffee +0 -82
  164. data/spec/support/integration_example_group.rb +0 -31
  165. data/spec/unit/event_spec.rb +0 -47
  166. data/spec/unit/views/components/action_list_popover_spec.rb +0 -40
  167. data/spec/unit/views/components/popover_spec.rb +0 -33
@@ -8,7 +8,7 @@ module ActiveAdmin
8
8
  extend UrlHelpers
9
9
 
10
10
  def self.default_url_options
11
- Rails.application.config.action_mailer.default_url_options || {}
11
+ Rails.application.routes.default_url_options || {}
12
12
  end
13
13
  end
14
14
  end
@@ -9,6 +9,7 @@ module ActiveAdmin
9
9
 
10
10
  autoload :Base
11
11
  autoload :StringInput
12
+ autoload :DatePickerInput
12
13
  autoload :DateRangeInput
13
14
  autoload :NumericInput
14
15
  autoload :SelectInput
@@ -0,0 +1,13 @@
1
+ module ActiveAdmin
2
+ module Inputs
3
+ module Filters
4
+ class DatePickerInput < ::Formtastic::Inputs::DatePickerInput
5
+ include Base
6
+
7
+ def input_html_options
8
+ super.merge(class: "datepicker")
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -27,7 +27,7 @@ module ActiveAdmin
27
27
  current_value = @object.public_send input_name
28
28
  { size: 12,
29
29
  class: "datepicker",
30
- max: 10,
30
+ maxlength: 10,
31
31
  value: current_value.respond_to?(:strftime) ? current_value.strftime("%Y-%m-%d") : "" }
32
32
  end
33
33
  end
@@ -27,6 +27,7 @@ module ActiveAdmin
27
27
  def [](id)
28
28
  @children[normalize_id(id)]
29
29
  end
30
+
30
31
  def []=(id, child)
31
32
  @children[normalize_id(id)] = child
32
33
  end
@@ -79,7 +79,7 @@ module ActiveAdmin
79
79
  true
80
80
  end
81
81
 
82
- # Returns an array of the ancestory of this menu item.
82
+ # Returns an array of the ancestry of this menu item.
83
83
  # The first item is the immediate parent of the item.
84
84
  def ancestors
85
85
  parent ? [parent, parent.ancestors].flatten : []
@@ -49,7 +49,7 @@ module ActiveAdmin
49
49
  reset_menu!
50
50
 
51
51
  # Dispatch a registration event
52
- ActiveAdmin::Event.dispatch ActiveAdmin::Resource::RegisterEvent, config
52
+ ActiveSupport::Notifications.publish ActiveAdmin::Resource::RegisterEvent, config
53
53
 
54
54
  # Return the config
55
55
  config
@@ -110,13 +110,13 @@ module ActiveAdmin
110
110
  # Add a callback to be ran when we build the menu
111
111
  #
112
112
  # @param [Symbol] name The name of the menu. Default: :default
113
- # @param [Proc] block The block to be ran when the menu is built
113
+ # @yield [ActiveAdmin::Menu] The block to be ran when the menu is built
114
114
  #
115
115
  # @return [void]
116
- def build_menu(name = DEFAULT_MENU, &block)
116
+ def build_menu(name = DEFAULT_MENU)
117
117
  @menus.before_build do |menus|
118
118
  menus.menu name do |menu|
119
- block.call(menu)
119
+ yield menu
120
120
  end
121
121
  end
122
122
  end
@@ -157,7 +157,7 @@ module ActiveAdmin
157
157
  def build_menu_collection
158
158
  @menus = MenuCollection.new
159
159
 
160
- @menus.on_build do |menus|
160
+ @menus.on_build do
161
161
  build_default_utility_nav
162
162
 
163
163
  resources.each do |resource|
@@ -7,6 +7,7 @@ require 'active_admin/orm/active_record/comments/resource_helper'
7
7
  ActiveAdmin::Application.inheritable_setting :comments, true
8
8
  ActiveAdmin::Application.inheritable_setting :show_comments_in_menu, true
9
9
  ActiveAdmin::Application.inheritable_setting :comments_registration_name, 'Comment'
10
+ ActiveAdmin::Application.inheritable_setting :comments_order, "created_at ASC"
10
11
 
11
12
  # Insert helper modules
12
13
  ActiveAdmin::Namespace.send :include, ActiveAdmin::Comments::NamespaceHelper
@@ -20,7 +21,7 @@ ActiveAdmin.autoload :Comment, 'active_admin/orm/active_record/comments/comment'
20
21
  ActiveAdmin.after_load do |app|
21
22
  app.namespaces.each do |namespace|
22
23
  namespace.register ActiveAdmin::Comment, as: namespace.comments_registration_name do
23
- actions :index, :show, :create
24
+ actions :index, :show, :create, :destroy
24
25
 
25
26
  menu false unless namespace.comments && namespace.show_comments_in_menu
26
27
 
@@ -60,6 +61,13 @@ ActiveAdmin.after_load do |app|
60
61
  redirect_to :back
61
62
  end
62
63
  end
64
+
65
+ def destroy
66
+ destroy! do |success, failure|
67
+ success.html { redirect_to :back }
68
+ failure.html { redirect_to :back }
69
+ end
70
+ end
63
71
  end
64
72
  end
65
73
 
@@ -74,6 +82,7 @@ ActiveAdmin.after_load do |app|
74
82
  column I18n.t('active_admin.comments.resource'), :resource
75
83
  column I18n.t('active_admin.comments.author'), :author
76
84
  column I18n.t('active_admin.comments.body'), :body
85
+ column I18n.t('active_admin.comments.created_at'), :created_at
77
86
  actions
78
87
  end
79
88
  end
@@ -29,7 +29,7 @@ module ActiveAdmin
29
29
  resource_type: resource_type(resource),
30
30
  resource_id: resource_id_cast(resource),
31
31
  namespace: namespace.to_s
32
- ).order('created_at ASC')
32
+ ).order(ActiveAdmin.application.namespaces[namespace.to_sym].comments_order)
33
33
  end
34
34
 
35
35
  def self.resource_id_type
@@ -35,6 +35,9 @@ module ActiveAdmin
35
35
  comment.author ? auto_link(comment.author) : I18n.t('active_admin.comments.author_missing')
36
36
  end
37
37
  span pretty_format comment.created_at
38
+ if authorized?(ActiveAdmin::Auth::DESTROY, comment)
39
+ text_node link_to I18n.t('active_admin.comments.delete'), comments_url(comment.id), method: :delete, data: { confirm: I18n.t('active_admin.comments.delete_confirmation') }
40
+ end
38
41
  end
39
42
  div class: 'active_admin_comment_body' do
40
43
  simple_format comment.body
@@ -46,6 +49,14 @@ module ActiveAdmin
46
49
  span I18n.t('active_admin.comments.no_comments_yet'), class: 'empty'
47
50
  end
48
51
 
52
+ def comments_url(*args)
53
+ parts = []
54
+ parts << active_admin_namespace.name unless active_admin_namespace.root?
55
+ parts << active_admin_namespace.comments_registration_name.underscore
56
+ parts << 'path'
57
+ send parts.join('_'), *args
58
+ end
59
+
49
60
  def comment_form_url
50
61
  parts = []
51
62
  parts << active_admin_namespace.name unless active_admin_namespace.root?
@@ -144,14 +144,20 @@ module ActiveAdmin
144
144
  end
145
145
 
146
146
  def find_resource(id)
147
- resource = resource_class.public_send(method_for_find, id)
147
+ resource = resource_class.public_send *method_for_find(id)
148
148
  decorator_class ? decorator_class.new(resource) : resource
149
149
  end
150
150
 
151
151
  private
152
152
 
153
- def method_for_find
154
- resources_configuration[:self][:finder] || :"find_by_#{resource_class.primary_key}"
153
+ def method_for_find(id)
154
+ if finder = resources_configuration[:self][:finder]
155
+ [finder, id]
156
+ elsif Rails::VERSION::MAJOR >= 4
157
+ [:find_by, { resource_class.primary_key => id }]
158
+ else
159
+ [:"find_by_#{resource_class.primary_key}", id]
160
+ end
155
161
  end
156
162
 
157
163
  def default_csv_builder
@@ -55,21 +55,31 @@ module ActiveAdmin
55
55
 
56
56
  # Adds the default action items to each resource
57
57
  def add_default_action_items
58
- # New link on index
58
+ add_default_new_action_item
59
+ add_default_edit_action_item
60
+ add_default_show_action_item
61
+ end
62
+
63
+ # Adds the default New link on index
64
+ def add_default_new_action_item
59
65
  add_action_item :new, only: :index do
60
66
  if controller.action_methods.include?('new') && authorized?(ActiveAdmin::Auth::CREATE, active_admin_config.resource_class)
61
67
  link_to I18n.t('active_admin.new_model', model: active_admin_config.resource_label), new_resource_path
62
68
  end
63
69
  end
70
+ end
64
71
 
65
- # Edit link on show
72
+ # Adds the default Edit link on show
73
+ def add_default_edit_action_item
66
74
  add_action_item :edit, only: :show do
67
75
  if controller.action_methods.include?('edit') && authorized?(ActiveAdmin::Auth::UPDATE, resource)
68
76
  link_to I18n.t('active_admin.edit_model', model: active_admin_config.resource_label), edit_resource_path(resource)
69
77
  end
70
78
  end
79
+ end
71
80
 
72
- # Destroy link on show
81
+ # Adds the default Destroy link on show
82
+ def add_default_show_action_item
73
83
  add_action_item :destroy, only: :show do
74
84
  if controller.action_methods.include?('destroy') && authorized?(ActiveAdmin::Auth::DESTROY, resource)
75
85
  link_to I18n.t('active_admin.delete_model', model: active_admin_config.resource_label), resource_path(resource),
@@ -20,8 +20,12 @@ module ActiveAdmin
20
20
 
21
21
  # Returns the target resource class or raises an exception if it doesn't exist
22
22
  def target
23
- key = @target_name.to_s.camelize
24
- namespace.resources[key] or raise TargetNotFound.new key, namespace
23
+ resource or raise TargetNotFound.new (@options[:class_name] || @target_name.to_s.camelize), namespace
24
+ end
25
+
26
+ def resource
27
+ namespace.resources[@options[:class_name]] ||
28
+ namespace.resources[@target_name.to_s.camelize]
25
29
  end
26
30
 
27
31
  def namespace
@@ -6,6 +6,9 @@ module ActiveAdmin
6
6
  # The default number of records to display per page
7
7
  attr_accessor :per_page
8
8
 
9
+ # The default number of records to display per page
10
+ attr_accessor :max_per_page
11
+
9
12
  # Enable / disable pagination (defaults to true)
10
13
  attr_accessor :paginate
11
14
 
@@ -13,6 +16,7 @@ module ActiveAdmin
13
16
  super
14
17
  @paginate = true
15
18
  @per_page = namespace.default_per_page
19
+ @max_per_page = namespace.max_per_page
16
20
  end
17
21
  end
18
22
  end
@@ -33,7 +33,9 @@ module ActiveAdmin
33
33
  # Finds a resource based on the resource name, resource class, or base class.
34
34
  def find_resource(obj)
35
35
  resources.detect do |r|
36
- r.resource_name.to_s == obj.to_s || r.resource_class.to_s == obj.to_s
36
+ r.resource_name.to_s == obj.to_s
37
+ end || resources.detect do |r|
38
+ r.resource_class.to_s == obj.to_s
37
39
  end ||
38
40
  if obj.respond_to? :base_class
39
41
  resources.detect{ |r| r.resource_class.to_s == obj.base_class.to_s }
@@ -277,14 +277,17 @@ module ActiveAdmin
277
277
  def collection_applies(options = {})
278
278
  only = Array(options.fetch(:only, COLLECTION_APPLIES))
279
279
  except = Array(options.fetch(:except, []))
280
- COLLECTION_APPLIES && only - except
280
+
281
+ # see #4074 for code reasons
282
+ COLLECTION_APPLIES.select { |applier| only.include? applier }
283
+ .reject { |applier| except.include? applier }
281
284
  end
282
285
 
283
286
  def per_page
284
287
  if active_admin_config.paginate
285
288
  dynamic_per_page || configured_per_page
286
289
  else
287
- max_per_page
290
+ active_admin_config.max_per_page
288
291
  end
289
292
  end
290
293
 
@@ -293,15 +296,7 @@ module ActiveAdmin
293
296
  end
294
297
 
295
298
  def configured_per_page
296
- if active_admin_config.per_page.is_a?(Array)
297
- active_admin_config.per_page[0]
298
- else
299
- active_admin_config.per_page
300
- end
301
- end
302
-
303
- def max_per_page
304
- 10_000
299
+ Array(active_admin_config.per_page).first
305
300
  end
306
301
 
307
302
  end
@@ -68,7 +68,7 @@ module ActiveAdmin
68
68
  ::Class.new parent do
69
69
  delegate :reorder, :page, :current_page, :total_pages, :limit_value,
70
70
  :total_count, :num_pages, :to_key, :group_values, :except,
71
- :find_each
71
+ :find_each, :ransack
72
72
 
73
73
  define_singleton_method(:name) { name }
74
74
  end
@@ -160,8 +160,14 @@ module ActiveAdmin
160
160
  delegate :before_destroy, :after_destroy, to: :controller
161
161
 
162
162
  # Standard rails filters
163
- delegate :before_filter, :skip_before_filter, :after_filter, :skip_after_filter, :around_filter, :skip_filter,
164
- to: :controller
163
+ delegate :before_filter, :skip_before_filter, to: :controller
164
+ delegate :after_filter, :skip_after_filter, to: :controller
165
+ delegate :around_filter, :skip_filter, to: :controller
166
+ if Rails::VERSION::MAJOR == 4
167
+ delegate :before_action, :skip_before_action, to: :controller
168
+ delegate :after_action, :skip_after_action, to: :controller
169
+ delegate :around_action, :skip_action, to: :controller
170
+ end
165
171
 
166
172
  # Specify which actions to create in the controller
167
173
  #
@@ -6,31 +6,23 @@ module ActiveAdmin
6
6
  attr_accessor :name, :options, :block
7
7
 
8
8
  def initialize(name, options = {}, &block)
9
- @name, @options, @block = name, options, block
9
+ @name, @options, @block = name.to_s, options, block
10
10
  normalize_display_options!
11
11
  end
12
12
 
13
13
  # The id gets used for the div in the view
14
14
  def id
15
- "#{name.to_s.downcase.underscore}_sidebar_section".parameterize
16
- end
17
-
18
- def icon?
19
- !!options[:icon]
20
- end
21
-
22
- def icon
23
- options[:icon] if icon?
15
+ "#{name.downcase.underscore}_sidebar_section".parameterize
24
16
  end
25
17
 
26
18
  # The title gets displayed within the section in the view
27
19
  def title
28
- I18n.t("active_admin.sidebars.#{name.to_s}", default: name.to_s.titlecase)
20
+ I18n.t("active_admin.sidebars.#{name}", default: name.titlecase)
29
21
  end
30
22
 
31
23
  # If a block is not passed in, the name of the partial to render
32
24
  def partial_name
33
- options[:partial] || "#{name.to_s.downcase.tr(' ', '_')}_sidebar"
25
+ options[:partial] || "#{name.downcase.tr(' ', '_')}_sidebar"
34
26
  end
35
27
 
36
28
  def custom_class
@@ -1,3 +1,3 @@
1
1
  module ActiveAdmin
2
- VERSION = '1.0.0.pre1'
2
+ VERSION = '1.0.0.pre2'
3
3
  end
@@ -13,8 +13,7 @@ module ActiveAdmin
13
13
  header: ActiveAdmin::Views::Header,
14
14
  footer: ActiveAdmin::Views::Footer,
15
15
  index_scopes: ActiveAdmin::Views::Scopes,
16
- blank_slate: ActiveAdmin::Views::BlankSlate,
17
- action_list_popover: ActiveAdmin::Views::ActionListPopover
16
+ blank_slate: ActiveAdmin::Views::BlankSlate
18
17
 
19
18
  # Register All The Pages
20
19
  register index_page: ActiveAdmin::Views::Pages::Index,
@@ -8,7 +8,6 @@ module ActiveAdmin
8
8
  include AutoLinkHelper
9
9
  include BreadcrumbHelper
10
10
  include DisplayHelper
11
- include IconHelper
12
11
  include MethodOrProcHelper
13
12
  include SidebarHelper
14
13
  include FormHelper
@@ -15,7 +15,7 @@ module ActiveAdmin
15
15
  # Attempts to call any known display name methods on the resource.
16
16
  # See the setting in `application.rb` for the list of methods and their priority.
17
17
  def display_name(resource)
18
- render_in_context resource, display_name_method_for(resource) if resource
18
+ render_in_context resource, display_name_method_for(resource) unless resource.nil?
19
19
  end
20
20
 
21
21
  # Looks up and caches the first available display name method.
@@ -43,10 +43,10 @@ module ActiveAdmin
43
43
  # Attempts to create a human-readable string for any object
44
44
  def pretty_format(object)
45
45
  case object
46
- when String, Numeric, Arbre::Element
46
+ when String, Numeric, Symbol, Arbre::Element
47
47
  object.to_s
48
48
  when Date, Time
49
- localize object, format: :long
49
+ localize object, format: active_admin_application.localize_format
50
50
  else
51
51
  if defined?(::ActiveRecord) && object.is_a?(ActiveRecord::Base) ||
52
52
  defined?(::Mongoid) && object.class.include?(Mongoid::Document)
@@ -56,7 +56,6 @@ module ActiveAdmin
56
56
  end
57
57
  end
58
58
  end
59
-
60
59
  end
61
60
  end
62
61
  end
@@ -76,11 +76,11 @@ module MethodOrProcHelper
76
76
  end
77
77
  end
78
78
 
79
- # This method is different from the others in that it calls `instance_exec` on the reciever,
80
- # passing it the proc. This evaluates the proc in the context of the reciever, thus changing
79
+ # This method is different from the others in that it calls `instance_exec` on the receiver,
80
+ # passing it the proc. This evaluates the proc in the context of the receiver, thus changing
81
81
  # what `self` means inside the proc.
82
82
  def render_in_context(context, obj, *args)
83
- context ||= self # default to `self`
83
+ context = self if context.nil? # default to `self` only when nil
84
84
  case obj
85
85
  when Proc
86
86
  context.instance_exec *args, &obj