Sha256: 0b5ccc4550f93aaa30628dd5c369d4024f5aeebce7cb4018c753e39f186853f0

Contents?: true

Size: 867 Bytes

Versions: 4

Compression:

Stored size: 867 Bytes

Contents

<%
  # headmin/blocks
  #
  # ==== Options
  # * +blockable</tt> - Object with blocks association
  # * +path</tt> - Directory where to look for block templates
  #
  # ==== Examples
  #   Basic version. This will only look for blocks in 'website/blocks'
  #   <%= render "headmin/blocks", blockable: @page %#>
  #
  #   Define the path to look for block templates like this:
  #   <%= render "headmin/blocks", blockable: @page, path: 'website/pages/blocks' %#>

  blockable = local_assigns.has_key?(:blockable) ? blockable : nil
  path = local_assigns.has_key?(:path) ? path : nil
%>

<% if blockable && blockable.respond_to?(:blocks) %>
  <% blockable.blocks.order(:position).each do |block| %>
    <% view_path = BlockService.frontend_view(block.name, path: path).gsub('/_', '/').split('.').first %>
    <%= render view_path, block: block %>
  <% end %>
<% end %>

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
headmin-0.3.4 app/views/headmin/_blocks.html.erb
headmin-0.3.3 app/views/headmin/_blocks.html.erb
headmin-0.3.2 app/views/headmin/_blocks.html.erb
headmin-0.3.1 app/views/headmin/_blocks.html.erb