Module: Pageflow::WidgetsHelper
Constant Summary
RenderJsonHelper::ESCAPED_CHARS, RenderJsonHelper::ESCAPED_CHARS_REGEX
Instance Method Summary
collapse
#render_html_partial, #render_json, #render_json_partial, #render_json_seed, #sanitize_json
Instance Method Details
23
24
25
26
27
|
# File 'app/helpers/pageflow/widgets_helper.rb', line 23
def present_widgets_css_class(entry)
entry.resolve_widgets.map do |widget|
"widget_#{widget.widget_type.name}_present"
end.push('widgets_present').join(' ')
end
|
5
6
7
8
9
10
11
12
13
|
# File 'app/helpers/pageflow/widgets_helper.rb', line 5
def render_widget_head_fragments(entry, options = {})
fragments = entry.resolve_widgets(options).map do |widget|
widget.widget_type.render_head_fragment_with_configuration(self,
entry,
widget.configuration)
end
safe_join(fragments)
end
|
15
16
17
18
19
20
21
|
# File 'app/helpers/pageflow/widgets_helper.rb', line 15
def render_widgets(entry, options = {})
fragments = entry.resolve_widgets(options).map do |widget|
widget.widget_type.render_with_configuration(self, entry, widget.configuration)
end
safe_join(fragments)
end
|
29
30
31
32
33
34
35
36
37
38
39
|
# File 'app/helpers/pageflow/widgets_helper.rb', line 29
def widget_types_json_seeds(config)
config.widget_types.each_with_object({}) do |widget_type, result|
widget_type.roles.each do |role|
result[role] ||= []
result[role] << {
name: widget_type.name,
translationKey: widget_type.translation_key
}
end
end.to_json.html_safe
end
|
41
42
43
|
# File 'app/helpers/pageflow/widgets_helper.rb', line 41
def widgets_json_seeds(entry)
render_json_seed(entry.resolve_widgets(include_placeholders: true))
end
|