Merge pull request #213 from piton/translate-common-attributes
I18n common attributes and Translate.attribute_name
This commit is contained in:
parent
1b9bbb8dcf
commit
f536007960
|
@ -68,11 +68,12 @@ module Ransack
|
|||
:"ransack.attributes.#{associated_class.model_name.singular}.#{attr_name}" :
|
||||
:"ransack.attributes.#{context.klass.model_name.singular}.#{attr_name}"
|
||||
),
|
||||
:default => [
|
||||
default: [
|
||||
(associated_class ?
|
||||
:"#{associated_class.i18n_scope}.attributes.#{associated_class.model_name.singular}.#{attr_name}" :
|
||||
:"#{context.klass.i18n_scope}.attributes.#{context.klass.model_name.singular}.#{attr_name}"
|
||||
),
|
||||
:".attributes.#{attr_name}",
|
||||
attr_name.humanize
|
||||
]
|
||||
)
|
||||
|
|
|
@ -48,11 +48,17 @@ module Ransack
|
|||
end
|
||||
|
||||
describe '#sort_link' do
|
||||
subject { @f.sort_link :name, :controller => 'people' }
|
||||
it 'sort_link for ransack attribute' do
|
||||
sort_link = @f.sort_link :name, :controller => 'people'
|
||||
sort_link.should match /people\?q%5Bs%5D=name\+asc/
|
||||
sort_link.should match /sort_link/
|
||||
sort_link.should match /Full Name<\/a>/
|
||||
end
|
||||
|
||||
it { should match /people\?q%5Bs%5D=name\+asc/}
|
||||
it { should match /sort_link/}
|
||||
it { should match /Full Name<\/a>/}
|
||||
it 'sort_link for common attribute' do
|
||||
sort_link = @f.sort_link :id, :controller => 'people'
|
||||
sort_link.should match /id<\/a>/
|
||||
end
|
||||
end
|
||||
|
||||
describe '#submit' do
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
en:
|
||||
attributes:
|
||||
id: 'id'
|
||||
ransack:
|
||||
attributes:
|
||||
person:
|
||||
name: Full Name
|
||||
name: Full Name
|
||||
|
|
Loading…
Reference in New Issue