Sha256: 4f0d56ea4a00c9ea8faaf129c8d8373a35e097a027c2b0bfe5759c6aa3b208bf

Contents?: true

Size: 1.01 KB

Versions: 17

Compression:

Stored size: 1.01 KB

Contents

module Pageflow
  module WidgetsHelper
    def render_widget_head_fragments(entry, options = {})
      fragments = entry.resolve_widgets(options).map do |widget|
        widget.widget_type.render_head_fragment(self, entry)
      end

      safe_join(fragments)
    end

    def render_widgets(entry, options = {})
      fragments = entry.resolve_widgets(options).map do |widget|
        widget.widget_type.render(self, entry)
      end

      safe_join(fragments)
    end

    def present_widgets_css_class(entry)
      entry.resolve_widgets.map do |widget|
        "widget_#{widget.widget_type.name}_present"
      end.push('widgets_present').join(' ')
    end

    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
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
pageflow-12.0.4 app/helpers/pageflow/widgets_helper.rb
pageflow-12.0.3 app/helpers/pageflow/widgets_helper.rb
pageflow-12.0.2 app/helpers/pageflow/widgets_helper.rb
pageflow-12.0.1 app/helpers/pageflow/widgets_helper.rb
pageflow-12.0.0 app/helpers/pageflow/widgets_helper.rb
pageflow-12.0.0.rc7 app/helpers/pageflow/widgets_helper.rb
pageflow-12.0.0.rc6 app/helpers/pageflow/widgets_helper.rb
pageflow-0.11.4 app/helpers/pageflow/widgets_helper.rb
pageflow-12.0.0.rc5 app/helpers/pageflow/widgets_helper.rb
pageflow-12.0.0.rc4 app/helpers/pageflow/widgets_helper.rb
pageflow-12.0.0.rc3 app/helpers/pageflow/widgets_helper.rb
pageflow-12.0.0.rc2 app/helpers/pageflow/widgets_helper.rb
pageflow-12.0.0.rc1 app/helpers/pageflow/widgets_helper.rb
pageflow-0.11.3 app/helpers/pageflow/widgets_helper.rb
pageflow-0.11.2 app/helpers/pageflow/widgets_helper.rb
pageflow-0.11.1 app/helpers/pageflow/widgets_helper.rb
pageflow-0.11.0 app/helpers/pageflow/widgets_helper.rb