Sha256: 8df73e86ea9d31edb5d28e2b6d59f45f1ce8d4cc60725615f1f5021854d6e937

Contents?: true

Size: 1.37 KB

Versions: 75

Compression:

Stored size: 1.37 KB

Contents

module Pageflow
  module WidgetsHelper
    include RenderJsonHelper

    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

    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

    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

    def widgets_json_seeds(entry)
      render_json_seed(entry.resolve_widgets(include_placeholders: true))
    end
  end
end

Version data entries

75 entries across 75 versions & 1 rubygems

Version Path
pageflow-17.0.4 app/helpers/pageflow/widgets_helper.rb
pageflow-17.0.3 app/helpers/pageflow/widgets_helper.rb
pageflow-17.0.2 app/helpers/pageflow/widgets_helper.rb
pageflow-17.0.1 app/helpers/pageflow/widgets_helper.rb
pageflow-17.0.0 app/helpers/pageflow/widgets_helper.rb
pageflow-16.2.0 app/helpers/pageflow/widgets_helper.rb
pageflow-16.1.0 app/helpers/pageflow/widgets_helper.rb
pageflow-16.0.0 app/helpers/pageflow/widgets_helper.rb
pageflow-15.8.0 app/helpers/pageflow/widgets_helper.rb
pageflow-14.5.2 app/helpers/pageflow/widgets_helper.rb
pageflow-15.7.1 app/helpers/pageflow/widgets_helper.rb
pageflow-15.7.0 app/helpers/pageflow/widgets_helper.rb
pageflow-15.6.1 app/helpers/pageflow/widgets_helper.rb
pageflow-15.6.0 app/helpers/pageflow/widgets_helper.rb
pageflow-15.5.0 app/helpers/pageflow/widgets_helper.rb
pageflow-15.4.0 app/helpers/pageflow/widgets_helper.rb
pageflow-15.3.0 app/helpers/pageflow/widgets_helper.rb
pageflow-15.2.2 app/helpers/pageflow/widgets_helper.rb
pageflow-15.2.1 app/helpers/pageflow/widgets_helper.rb
pageflow-15.2.0 app/helpers/pageflow/widgets_helper.rb