Sha256: 989a49f4f62ae8de7c41bcee25664d44e9211b6f46da2f6b9034b89b9c096a16

Contents?: true

Size: 697 Bytes

Versions: 1

Compression:

Stored size: 697 Bytes

Contents

module Presentation
  class Base
    include Presenting::Configurable

    def render
      view.render :partial => "presentations/#{self.class.to_s.split('::').last.underscore}"
    end

    attr_accessor :presentable

    attr_accessor :controller
    delegate :request, :form_authenticity_token, :url_for, :params, :to => 'controller'

    protected

    # what the presentation is called in its templates
    def iname
      :presentation
    end

    # a reference to the view
    def view #:nodoc:
      @view ||= Presenting::View.new(ActionController::Base.view_paths, assigns_for_view, self)
    end

    def assigns_for_view
      {iname => self, :_request => request}
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
presenting-2.0.0 lib/presentation/base.rb