Add i18n for any/all
This commit is contained in:
parent
1c41a3ea2c
commit
da6d4aa4aa
|
@ -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
|
||||
|
|
|
@ -4,6 +4,8 @@ en:
|
|||
predicate: "predicate"
|
||||
and: "and"
|
||||
or: "or"
|
||||
any: "any"
|
||||
all: "all"
|
||||
combinator: "combinator"
|
||||
attribute: "attribute"
|
||||
value: "value"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
module Ransack
|
||||
VERSION = "0.4.0"
|
||||
VERSION = "0.4.1"
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue