Sha256: 5b7111f1f5fd41a2b656df910eb0f9e3b2237512de97d752abdf66f84d813391

Contents?: true

Size: 1.33 KB

Versions: 9

Compression:

Stored size: 1.33 KB

Contents

<%
  # headmin/forms/blocks
  #
  # ==== Required parameters
  # * +form</tt> - Form object
  # * +names</tt> - Names of block templates that can be added
  #
  # ==== Optional parameters
  # * +paths</tt> - Directories where to look for block templates
  #
  # ==== Examples
  #   Basic version. (looks in views/admin/blocks, views/blocks or views directory )
  #   <%= render "headmin/forms/blocks", form: form, names: %w(text image button) %#>
  #
  #   Define one ore more path where the templates could be located:
  #   <%= render "headmin/forms/blocks", form: form, names: %w(text image button), paths: %w(admin/pages/blocks) %#>
  #
  #   Limit the types of blocks
  #   <%= render "headmin/forms/blocks", form: form, names: %w(text text_image list) %#>

  blocks = Headmin::Form::BlocksView.new(local_assigns)
  @lookup_context.prefixes = @lookup_context.prefixes + blocks.prefixes
%>

<%= render "headmin/forms/repeater", blocks.repeater_options do |block_form, template| %>
  <% name = template || block_form.object.name %>

  <!-- Name input of the block -->
  <%= block_form.hidden_field :name, value: name %>

  <!-- Render block form fields -->
  <%= render name, form: block_form %>

  <!-- Label -->
  <span class="position-absolute top-0 end-0 badge bg-light text-dark">
    <%= t("blocks.#{name}", default: name).humanize %>
  </span>
<% end %>

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
headmin-0.5.9 app/views/headmin/forms/_blocks.html.erb
headmin-0.5.8 app/views/headmin/forms/_blocks.html.erb
headmin-0.5.7 app/views/headmin/forms/_blocks.html.erb
headmin-0.5.6 app/views/headmin/forms/_blocks.html.erb
headmin-0.5.5 app/views/headmin/forms/_blocks.html.erb
headmin-0.5.4 app/views/headmin/forms/_blocks.html.erb
headmin-0.5.3 app/views/headmin/forms/_blocks.html.erb
headmin-0.5.1 app/views/headmin/forms/_blocks.html.erb
headmin-0.5.0 app/views/headmin/forms/_blocks.html.erb