Sha256: 491b5db58883e8e1cc3b290e3a890ac10f4c1f33bc94df642484ba5622d66554
Contents?: true
Size: 1.67 KB
Versions: 7
Compression:
Stored size: 1.67 KB
Contents
<% # headmin/filters/flatpickr # # ==== Options # * +name</tt> - Name of the filter parameter # * +label</tt> - Display name # # ==== Examples # Basic version # <%= render "headmin/filters/flatpickr", 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', 'flatpickr-target': 'input', 'action': 'change->filters#update', 'flatpickr-options': { defaultDate: params[name] } } } %> <%= 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" data-controller="flatpickr"> <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" data-controller="flatpickr"> <span class="input-group-text"> <%= bootstrap_icon('calendar') %> </span> <%= date_field_tag(name, params[name], input_options) %> </div> <% end %> <% end %> <% end %>
Version data entries
7 entries across 7 versions & 1 rubygems