Sha256: 1591f5edabf5bc20b8753661b7f90dfbf845bcec99fec451a6f5ff8c691e2cf2

Contents?: true

Size: 809 Bytes

Versions: 3

Compression:

Stored size: 809 Bytes

Contents

module ViewModels
  module Helpers
    module Mapping
      
      # The Collection view_model helper has the purpose of presenting presentable collections.
      # * Render as list
      # * Render as table
      # * Render as collection
      # * Render a pagination
      #
      class Collection
        private
          
          # Helper method that renders a partial in the context of the context instance.
          #
          # Example:
          #   If the collection view_model helper has been instantiated in the context
          #   of a controller, render will be called in the controller.
          #
          def render_partial name, locals
            @context.instance_eval { render "view_models/collection/_#{name}", :locals => locals }
          end
      end
      
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
view_models-2.0.1 lib/padrino/lib/helpers/collection.rb
view_models-2.0.0.ruby19 lib/padrino/lib/helpers/collection.rb
view_models-2.0.0 lib/padrino/lib/helpers/collection.rb