Sha256: 3f511ca73d8a476321c4b9e43ce094a1f597090471e1763ee89e1c3b3188783c
Contents?: true
Size: 1.87 KB
Versions: 4
Compression:
Stored size: 1.87 KB
Contents
<% # headmin/forms/flatpickr_range # # ==== Required parameters # * +form+ - Form object # * +start_attribute+ - Name of the start date attribute of the form model # * +end_attribute+ - Name of the end date attribute of the form model # # ==== Optional parameters # * +aria+ - Provide a hash to define all aria attributes # * +data+ - Optional HTML data attributes # * +disabled+ - Set to true if the input should be shown as disabled # * +end_label+ - Label for the end attribute # * +label+ - Text to show as label. Label will be hidden if value is false # * +readonly+ - Set to true if the value of the field can only be read and not be modified # * +start_label+ - Label for the start attribute # * +value+ - Overrides the value of the form # # ==== Extra parameters # Listed in 'headmin/forms/base' # # ==== Examples # Basic version # <%= render 'headmin/forms/flatpickr_range', form: form, start_attribute: :start_date, end_attribute: :end_date %#> start_attribute = local_assigns[:start_attribute] end_attribute = local_assigns[:end_attribute] options = local_assigns.merge( attribute: local_assigns[:attribute] || :period, data: { action: 'change->date-range#update', 'flatpickr-target': 'input', 'flatpickr-options': { mode: 'range', defaultDate: [ form.object&.send(start_attribute)&.strftime('%d/%m/%Y'), form.object&.send(end_attribute)&.strftime('%d/%m/%Y'), ] } } ) %> <div data-controller="flatpickr"> <div data-controller="date-range"> <%= render 'headmin/forms/hidden', form: form, attribute: start_attribute, data: { 'date-range-target': 'startDateInput' } %> <%= render 'headmin/forms/hidden', form: form, attribute: end_attribute, data: { 'date-range-target': 'endDateInput' } %> <%= render 'headmin/forms/date', options %> </div> </div>
Version data entries
4 entries across 4 versions & 1 rubygems