Add i18n for any/all

This commit is contained in:
Ernie Miller 2011-06-05 15:01:53 -04:00
parent 1c41a3ea2c
commit da6d4aa4aa
3 changed files with 12 additions and 3 deletions

View File

@ -128,15 +128,22 @@ module Ransack
end
def combinator_select(options = {}, html_options = {})
choices = Nodes::Condition === object ? [:or, :and] : [:and, :or]
@template.collection_select(
@object_name, :m, choices.map {|o| [o.to_s, Translate.word(o)]}, :first, :last,
@object_name, :m, combinator_choices, :first, :last,
objectify_options(options), @default_options.merge(html_options)
)
end
private
def combinator_choices
if Nodes::Condition === object
[['or', Translate.word(:any)], ['and', Translate.word(:all)]]
else
[['and', Translate.word(:all)], ['or', Translate.word(:any)]]
end
end
def association_array(obj, prefix = nil)
([prefix] + case obj
when Array

View File

@ -4,6 +4,8 @@ en:
predicate: "predicate"
and: "and"
or: "or"
any: "any"
all: "all"
combinator: "combinator"
attribute: "attribute"
value: "value"

View File

@ -1,3 +1,3 @@
module Ransack
VERSION = "0.4.0"
VERSION = "0.4.1"
end