Sha256: cda4b3da24154b64c822378e39e36c17ec1f27248e6169c8795e4d809ad4fbe7

Contents?: true

Size: 823 Bytes

Versions: 7

Compression:

Stored size: 823 Bytes

Contents

# frozen_string_literal: true

require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'app', 'drops', 'scribo', 'action_dispatch', 'request_drop.rb'))

module ActionViewHelpers
  def layout_with_scribo(layout_name, yield_content)
    options = { request: request, uri: URI.parse(request.original_url), host: request.host, path: URI.parse(request.original_url).path }
    site = Scribo::SiteFindService.new(options).call

    application_js = content_for?(:js) && content_for(:js)

    content = site.contents.new(kind: 'text', data: yield_content, properties: { layout: layout_name })

    registers = { controller: controller, application_assets: scribo_application_assets, application_js: application_js }
    Scribo::ContentRenderService.new(content, self, registers: registers).call.html_safe
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
scribo-1.0.44 lib/scribo/action_view_helpers.rb
scribo-1.0.43 lib/scribo/action_view_helpers.rb
scribo-1.0.42 lib/scribo/action_view_helpers.rb
scribo-1.0.41 lib/scribo/action_view_helpers.rb
scribo-1.0.40 lib/scribo/action_view_helpers.rb
scribo-1.0.39 lib/scribo/action_view_helpers.rb
scribo-1.0.38 lib/scribo/action_view_helpers.rb