Sha256: c98f380892889301da9fd37f6ca05ad3894da1bcf14b94ab8eacefc1d1dc4d5b

Contents?: true

Size: 476 Bytes

Versions: 3

Compression:

Stored size: 476 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  = [parts.join("/")]

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cells-4.0.0.beta3 lib/cell/partial.rb
cells-4.0.0.beta2 lib/cell/partial.rb
cells-4.0.0.beta1 lib/cell/partial.rb