12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/breezy_template/handler.rb', line 12
def self.call(template)
%{__already_defined = defined?(json); json||=::BreezyTemplate.new(self);json._filter_by_path(breezy_filter) if defined?(breezy_filter); json._set_request_url(request.path);#{template.source}
if !(__already_defined && __already_defined != "method")
json.merge!({data: json._found! || json.empty! })
json.set! :update_joints, true
json.set! :screen, '#{self.template_id(template)}'
if defined?(breezy) && breezy
breezy.each do |k, v|
json.set! k, v
end
end
if protect_against_forgery?
json.csrf_token form_authenticity_token
end
__sprockets_assets = (::BreezyTemplate.configuration.track_sprockets_assets || []).map do |asset|
asset_path(asset)
end
__pack_assets = []
if defined?(asset_pack_path)
__pack_assets = (::BreezyTemplate.configuration.track_pack_assets || []).map do |asset|
asset_pack_path(asset)
end
end
if __sprockets_assets.any? || __pack_assets.any?
json.assets (__sprockets_assets + __pack_assets)
end
if defined?(breezy_filter) && !!breezy_filter
json.action 'graft'
json.path breezy_filter
end
json.joints ::BreezyTemplate::Var.new('joints')
json.defers ::BreezyTemplate::Var.new('defers')
json.target!
end
}
end
|