Skip to content

Commit 23a3155

Browse files
committed
Add PLURAL_MANY_COUNT constant
1 parent 5e919fb commit 23a3155

File tree

5 files changed

+12
-3
lines changed

5 files changed

+12
-3
lines changed

lib/active_admin.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
require 'arbre'
1414
require 'active_admin/engine'
1515

16+
require 'active_admin/helpers/i18n'
17+
1618
module ActiveAdmin
1719

1820
autoload :VERSION, 'active_admin/version'

lib/active_admin/form_builder.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def has_many(assoc, options = {}, &block)
9090
html = without_wrapper do
9191
unless builder_options.key?(:heading) && !builder_options[:heading]
9292
form_buffers.last << template.content_tag(:h3) do
93-
builder_options[:heading] || object.class.reflect_on_association(assoc).klass.model_name.human(count: 1.1)
93+
builder_options[:heading] || object.class.reflect_on_association(assoc).klass.model_name.human(count: ::ActiveAdmin::Helpers::I18n::PLURAL_MANY_COUNT)
9494
end
9595
end
9696

lib/active_admin/helpers/i18n.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module ActiveAdmin
2+
module Helpers
3+
module I18n
4+
PLURAL_MANY_COUNT = 2.1
5+
end
6+
end
7+
end

lib/active_admin/resource/naming.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def resource_label
2222

2323
# Returns the plural version of this resource such as "Bank Accounts"
2424
def plural_resource_label(options = {})
25-
resource_name.translate ({:count => 3, :default => resource_label.pluralize.titleize}).merge(options)
25+
resource_name.translate ({:count => ::ActiveAdmin::Helpers::I18n::PLURAL_MANY_COUNT, :default => resource_label.pluralize.titleize}).merge(options)
2626
end
2727
end
2828

lib/active_admin/view_helpers/breadcrumb_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def breadcrumb_links(path = request.path)
1616
config = parent && parent.resource_name.route_key == parts[index-1] ? parent : active_admin_config
1717
name = display_name config.find_resource part
1818
end
19-
name ||= I18n.t "activerecord.models.#{part.singularize}", :count => 1.1, :default => part.titlecase
19+
name ||= I18n.t "activerecord.models.#{part.singularize}", :count => ::ActiveAdmin::Helpers::I18n::PLURAL_MANY_COUNT, :default => part.titlecase
2020

2121
link_to name, '/' + parts[0..index].join('/')
2222
end

0 commit comments

Comments
 (0)