Sha256: cac476ebd428db0e81315aa9b48df75fe012b28c64de33762de71b9803c725cb

Contents?: true

Size: 1.92 KB

Versions: 3

Compression:

Stored size: 1.92 KB

Contents

<% card_color ||= 'danger' %>
<% default_field = {name: :id_eq, attrs: {label: false, required: false, placeholder: 'ID', wrapper: false}} %>
<% received_field = defined?(main_field) ? main_field : {} %>
<% main_field = default_field.deep_merge(received_field)  %>
<%= search_form_for @q, url: url do |f| %>
  <div class="card card-outline card-<%= card_color %>" data-controller='filtering'>
    <div class="card-header with-bormainder">
      <div class="input-group">
        <div class="input-group-prepend">
          <button type="button" class="btn btn-<%= card_color %>" data-action="click->filtering#toggle">
            <i class="fa fa-angle-right" data-filtering-target='icon'></i>
            <span class="d-none d-sm-inline-block">
              Filtrar
            </span>
          </button>
        </div>
        <%= f.input (main_field&.dig(:name) || :id_eq), main_field&.dig(:attrs) %>
        <div class="input-group-append">
          <%= button_tag type: "submit", class: "btn btn-#{card_color}" do %>
            <i class="fa fa-search"></i>
            <span class="d-none d-sm-inline-block">
              Buscar
            </span>
          <% end %>
        </div>
      </div>
      <div class="row">
        <div class="col-md-12 active-filters" data-filtering-target='filters'></div>
      </div>
    </div>
    <div class="card-body" style='display: none;' data-filtering-target='body'>
      <div class="row">
        <% search_fields ||= [] %>
        <% search_fields.each do |sf| %>
          <% default_attrs = {required: false, wrapper_html: {class: "col-md-3"}} %>
          <% received_attrs = sf.dig(:attrs) || {} %>
          <% attrs = default_attrs.deep_merge(received_attrs) %>
          <%= f.input sf.dig(:name), attrs %>
        <% end %>
      </div>
      <%= button_tag type: "submit", class: "btn btn-#{card_color}" do %>
        <i class="fa fa-search"></i> Buscar
      <% end %>
    </div>
  </div>
<% end %>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
zutils-3.0.3 app/views/shared/_search_form.html.erb
zutils-3.0.2 app/views/shared/_search_form.html.erb
zutils-3.0.1 app/views/shared/_search_form.html.erb