Sha256: 67ce85b4cb9de1444ffe27fd6da128d5fb3173f308a661fbb2fbac1aef66f7cc

Contents?: true

Size: 1.49 KB

Versions: 8

Compression:

Stored size: 1.49 KB

Contents

<%
  # headmin/filters/date
  #
  # ==== Options
  # * <tt>name</tt> - Name of the filter parameter
  # * <tt>label</tt> - Display name
  #
  # ==== Examples
  #   Basic version
  #   <%= render "headmin/filters/date", name: :created_at, label: 'Created at' %#>

  label = local_assigns.has_key?(:label) ? label : nil
  name = local_assigns.has_key?(:name) ? name : nil

  input_options = {
    placeholder: 'dd/mm/yyyy',
    class: "form-control flatpickr",
    required: true,
    'data-filters-target': 'input',
    'data-action': "change->filters#update"
  }
%>

<%= content_for :filters_menu do %>
  <%= render 'headmin/filters/filter/menu_item', name: name, label: label %>
<% end %>

<%= content_for :filters_templates do %>
  <%= render 'headmin/filters/filter/template', name: name, label: label do %>
    <div class="input-group">
      <span class="input-group-text">
        <%= bootstrap_icon('calendar') %>
      </span>
      <%= date_field_tag(name, nil, input_options) %>
    </div>
  <% end %>
<% end %>

<%= content_for :filters_buttons do %>
  <% if filter_param_exists?(name) %>
    <% value_formatted = Date.parse(params[name]).strftime('%d/%m/%Y') %>
    <%= render 'headmin/filters/filter/button', name: name, label: label, value: value_formatted do %>
      <div class="input-group">
        <span class="input-group-text">
          <%= bootstrap_icon('calendar') %>
        </span>
        <%= date_field_tag(name, params[name], input_options) %>
      </div>
    <% end %>
  <% end %>
<% end %>

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
headmin-0.2.7 app/views/headmin/filters/_date.html.erb
headmin-0.2.6 app/views/headmin/filters/_date.html.erb
headmin-0.2.5 app/views/headmin/filters/_date.html.erb
headmin-0.2.4 app/views/headmin/filters/_date.html.erb
headmin-0.2.3 app/views/headmin/filters/_date.html.erb
headmin-0.2.2 app/views/headmin/filters/_date.html.erb
headmin-0.2.1 app/views/headmin/filters/_date.html.erb
headmin-0.2.0 app/views/headmin/filters/_date.html.erb