Sha256: 5778a24217bb1a783027c9ec4d0734519abc58718e17fb9e210c07707900e2b2

Contents?: true

Size: 740 Bytes

Versions: 4

Compression:

Stored size: 740 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, :_prefixes, :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

4 entries across 4 versions & 1 rubygems

Version Path
presenting-3.0.0 lib/presentation/base.rb
presenting-2.1.0 lib/presentation/base.rb
presenting-2.0.3 lib/presentation/base.rb
presenting-2.0.2 lib/presentation/base.rb