Sha256: 7fa80f630aaecf6f282e0ad2db34a54f49c651816e2c52d3806323d9b6599a48

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

module Scrivito

class LayoutTags < Struct.new(:view)
  def client_config(obj, resource)
    if view.scrivito_user
      editing_context = EditingContextMiddleware.from_request(view.request)
      config = ClientConfig.new(obj, editing_context, view.lookup_context,
        resource: resource,
        return_to: view.params[:return_to]
      ).to_json
      view.content_tag(:div, '', 'data-scrivito-private-config' => config, style: 'display:none')
    end
  end

  def editing_auth_warning
    view.render('scrivito/editing_auth_warning') unless Configuration.editing_auth_callback
  end

  def generator_meta_tag
    content = 'Scrivito by Infopark AG (scrivito.com)'
    content << "; Version #{GemInfo.version}" if view.scrivito_user
    view.tag(:meta, name: 'generator', content: content)
  end

  def reset_stylesheet_tag
    view.content_tag(:style, %{
      *[data-scrivito-field-type="widget"],
      *[data-scrivito-private-widget-id] { position: relative; }
    }.squish, {type: 'text/css'}, false)
  end
end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scrivito_sdk-0.30.0 lib/scrivito/layout_tags.rb
scrivito_sdk-0.30.0.rc1 lib/scrivito/layout_tags.rb