4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'app/helpers/visual_condition_builder/application_helper.rb', line 4
def build_conditions(dictionary, *args)
dictionary_name = get_dictionary_name(dictionary)
dictionary_klass = get_dictionary_klass(dictionary)
container_name = "#{dictionary_name}_condition_container"
hArgs = (args ||= []).reduce(Hash.new, :merge)
hArgs = normalize_placeholder_label(hArgs)
builder_options = {
dictionary: dictionary_klass.dictionary(get_dictionary_context(dictionary), self.request)
}.deep_merge(hArgs)
capture do
concat(content_tag(:div, nil, id: container_name))
concat(javascript_tag(" $(document).ready(function () {\n $('#\#{container_name}').conditionBuilder(\#{builder_options.to_json});\n });\n"
))
end
end
|