Sha256: 87b958fd4075d49a827faf33596742e3cba9c479ab8beff6f76e18150758b4fd

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

<%
stimulus_controller = 'fields--date'

form ||= current_fields_form
options ||= {}
options[:id] ||= form.field_id(method)
options[:class] = "form-control single-daterange w-full border-slate-300 dark:bg-slate-800 dark:border-slate-900 #{options[:class]}".strip
options[:value] = form.object.send(method)&.strftime(t('global.formats.date'))
options = options.merge({ data: {"#{stimulus_controller}-target": 'field' }})
other_options ||= {}

%>

<%= render 'shared/fields/field', form: form, method: method, options: options, other_options: other_options do %>
  <% content_for :field do %>
    <div class="date-input relative" data-controller="<%= stimulus_controller %>">
      <%= form.text_field method, options %>
      <% unless options[:disabled] %>
      <button type="button" class="clear py-2 px-3 border border-transparent inline-flex items-center whitespace-nowrap absolute rounded-md top-1 md:top-0.5 right-0.5"
        data-<%= stimulus_controller %>-target="clearButton"
        data-action="<%= stimulus_controller %>#clearDate"
      >
        <i class="leading-4 text-lg ti ti-trash dark:text-blue-500"></i>
      </button>
      <% end %>
    </div>
  <% end %>
<% end %>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bullet_train-themes-tailwind_css-1.3.1 app/views/themes/tailwind_css/fields/_date_field.html.erb
bullet_train-themes-tailwind_css-1.3.0 app/views/themes/tailwind_css/fields/_date_field.html.erb