4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/angular_sprinkles/helpers/element_helper.rb', line 4
def _element(opts = {}, &block)
options = opts.dup.symbolize_keys
scope_name = options.delete(:scope_name)
html_options = options.delete(:html) || {}
input_options = options
if block_given?
scope = Element::Scope.new({
base: scope_name,
object_wrapper: ObjectKeyWrapper,
bind_json_wrapper: JavaScript::NoOp,
call_json_wrapper: JavaScript::BindService
})
content = capture(scope, &block)
end
input = Element::Input.new(input_options)
html = Element::Html.new(html_options)
attributes = Element::Attributes.new([input, html], tag: html.tag, content: content)
content_tag(*attributes.to_content_tag)
end
|