Sha256: 3c9d6f898769234b41b8cd3a6d9ac3ba93bdefc67cceb2610daa51213715502f

Contents?: true

Size: 529 Bytes

Versions: 5

Compression:

Stored size: 529 Bytes

Contents

# Allows to render global partials, for example.
#
#   render partial: "../views/shared/container"
module Cell::ViewModel::Partial
  def process_options!(options)
    super
    return unless partial = options[:partial]

    parts     = partial.split("/")
    view      = parts.pop
    view      = "_#{view}"
    view     += ".#{options[:formats].first}" if options[:formats]
    prefixes  = self.class.view_paths.collect { |path| parts.unshift(path).join("/") }

    options.merge!(:view => view, :prefixes => prefixes)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cells-4.0.0 lib/cell/partial.rb
cells-4.0.0.rc1 lib/cell/partial.rb
cells-4.0.0.beta6 lib/cell/partial.rb
cells-4.0.0.beta5 lib/cell/partial.rb
cells-4.0.0.beta4 lib/cell/partial.rb