Sha256: 8c239778be32adf7449a2db29bbe60b6e9c44449e830eb19d911ef3a9a62de0f

Contents?: true

Size: 1.32 KB

Versions: 7

Compression:

Stored size: 1.32 KB

Contents

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

  name = local_assigns.has_key?(:name) ? name.to_sym : nil
  label = local_assigns.has_key?(:label) ? label : name.to_s.humanize

  input_options = {
    placeholder: 'dd/mm/yyyy',
    class: "form-control",
    required: true,
    data: {
      'filters-target': 'input',
      '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">
      <%= 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">
        <%= date_field_tag(name, params[name], input_options) %>
      </div>
    <% end %>
  <% end %>
<% end %>

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
headmin-0.4.2 app/views/headmin/filters/_date.html.erb
headmin-0.4.1 app/views/headmin/filters/_date.html.erb
headmin-0.4.0 app/views/headmin/filters/_date.html.erb
headmin-0.3.4 app/views/headmin/filters/_date.html.erb
headmin-0.3.3 app/views/headmin/filters/_date.html.erb
headmin-0.3.2 app/views/headmin/filters/_date.html.erb
headmin-0.3.1 app/views/headmin/filters/_date.html.erb