!
- end
-
- def nested_fields(form, key, index, klass, child)
- nested_html = ""
- form.fields_for("#{key}[#{index}]", klass.new(child)) do |ff|
- klass::KEYS.each do |k|
- nested_html << field(ff, k)
- end
- end
-
- nested_html
- end
-
- def append_and_remove_links
- %Q!
#{icon('fa-plus')} ! +
- %Q!
#{icon('fa-minus')} !
- end
-
- def child_data(form, key)
- form.object.class.children[key]
- end
-
- def enum_field(html, form, key, opts = {})
- html << h(form.label(key))
- html << " " # NOTE: Adding space for padding
- html << form.select(key, form.object.list_of(key), opts, { class: "enum" })
- end
-
- def bool_field(html, form, key, opts = {})
- html << form.check_box(key, {}, "true", "false")
- html << " " # NOTE: Adding space for padding
- html << h(form.label(key))
- end
-
- def other_field(html, form, key, opts = {})
- return unless form.object.respond_to?(key)
- html << h(form.label(key))
- html << form.text_field(key, class: "form-control")
- end
-
- def owned_plugin_type_field(form, key, plugin_type)
- registry_type = case plugin_type
- when :parse
- "PARSER_REGISTRY"
- when :format
- "FORMATTER_REGISTRY"
- end
- plugin_registry = Fluent::Plugin.const_get("#{registry_type}")
- html = '
'
- html << form.label(key)
- html << " " # NOTE: Adding space for padding
- html << form.select(key, plugin_registry.map.keys, {}, { class: "owned" })
- html << '
'
- html
- end
-end