Sha256: b73dd3f34feabc5f5558be9b77cb02e5fbf18a52f82657e0b0f3891bc51ebb8b

Contents?: true

Size: 521 Bytes

Versions: 13

Compression:

Stored size: 521 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| ([path] + parts).join("/") }

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

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
cells-4.1.8 lib/cell/partial.rb
cells-4.1.7 lib/cell/partial.rb
cells-4.1.6 lib/cell/partial.rb
cells-4.1.5 lib/cell/partial.rb
cells-4.1.4 lib/cell/partial.rb
cells-4.1.3 lib/cell/partial.rb
cells-4.1.2 lib/cell/partial.rb
cells-4.1.1 lib/cell/partial.rb
cells-4.1.0 lib/cell/partial.rb
cells-4.1.0.rc1 lib/cell/partial.rb
cells-4.0.5 lib/cell/partial.rb
cells-4.0.4 lib/cell/partial.rb
cells-4.0.3 lib/cell/partial.rb