Sha256: 9837cc2523fb31315ddb77bef164582b741413129e1e2952c32dcbc8b0ae4506

Contents?: true

Size: 728 Bytes

Versions: 1

Compression:

Stored size: 728 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.1 lib/presentation/base.rb