Sha256: 3b0f6f2114fd64413f73d2fb36c8b0b16f00101553d46811c2ee4b585f4db988

Contents?: true

Size: 874 Bytes

Versions: 3

Compression:

Stored size: 874 Bytes

Contents

# frozen_string_literal: true

require "pakyow/support/extension"

module Pakyow
  class Plugin
    module Helpers
      module Rendering
        extend Support::Extension

        prepend_methods do
          def render(view_path = nil, as: nil, modes: [:default])
            super(File.join(@connection.app.class.mount_path, view_path), as: as, modes: modes)
          rescue Presenter::UnknownPage
            # Try rendering the view from the app.
            #
            connection = @connection.app.parent.isolated(:Connection).from_connection(
              @connection, :@app => @connection.app.parent
            )

            connection.app.isolated(:Renderer).render(
              connection,
              view_path: view_path,
              presenter_path: as,
              modes: modes
            )
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pakyow-presenter-1.0.0.rc5 lib/pakyow/plugin/helpers/rendering.rb
pakyow-presenter-1.0.0.rc4 lib/pakyow/plugin/helpers/rendering.rb
pakyow-presenter-1.0.0.rc3 lib/pakyow/plugin/helpers/rendering.rb