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-15.1.2 app/helpers/pageflow/widgets_helper.rb
pageflow-15.1.1 app/helpers/pageflow/widgets_helper.rb
pageflow-15.1.0 app/helpers/pageflow/widgets_helper.rb
pageflow-15.1.0.rc0 app/helpers/pageflow/widgets_helper.rb
pageflow-15.1.0.beta6 app/helpers/pageflow/widgets_helper.rb
pageflow-15.1.0.beta5 app/helpers/pageflow/widgets_helper.rb
pageflow-15.1.0.beta4 app/helpers/pageflow/widgets_helper.rb
pageflow-15.1.0.beta3 app/helpers/pageflow/widgets_helper.rb
pageflow-15.1.0.beta2 app/helpers/pageflow/widgets_helper.rb
pageflow-15.1.0.beta1 app/helpers/pageflow/widgets_helper.rb
pageflow-15.0.2 app/helpers/pageflow/widgets_helper.rb
pageflow-15.0.1 app/helpers/pageflow/widgets_helper.rb
pageflow-15.0.0 app/helpers/pageflow/widgets_helper.rb
pageflow-14.5.1 app/helpers/pageflow/widgets_helper.rb
pageflow-14.5.0 app/helpers/pageflow/widgets_helper.rb
pageflow-15.0.0.rc2 app/helpers/pageflow/widgets_helper.rb
pageflow-15.0.0.rc1 app/helpers/pageflow/widgets_helper.rb
pageflow-15.0.0.beta4 app/helpers/pageflow/widgets_helper.rb
pageflow-15.0.0.beta3 app/helpers/pageflow/widgets_helper.rb
pageflow-14.4.0 app/helpers/pageflow/widgets_helper.rb