Sha256: ff08cbe1c3ccb51d21af92a913e52fc432ad3e4561fa32a1e816851c77e7f96d

Contents?: true

Size: 955 Bytes

Versions: 7

Compression:

Stored size: 955 Bytes

Contents

# frozen_string_literal: true

require "pakyow/support/extension"

module Pakyow
  class Plugin
    module Helpers
      module Presenter
        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 Pakyow::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
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pakyow-presenter-1.0.6 lib/pakyow/plugin/helpers/presenter/rendering.rb
pakyow-presenter-1.0.5 lib/pakyow/plugin/helpers/presenter/rendering.rb
pakyow-presenter-1.0.4 lib/pakyow/plugin/helpers/presenter/rendering.rb
pakyow-presenter-1.0.3 lib/pakyow/plugin/helpers/presenter/rendering.rb
pakyow-presenter-1.0.2 lib/pakyow/plugin/helpers/presenter/rendering.rb
pakyow-presenter-1.0.1 lib/pakyow/plugin/helpers/presenter/rendering.rb
pakyow-presenter-1.0.0 lib/pakyow/plugin/helpers/presenter/rendering.rb