Sha256: f7fca81426826d79881fb6c6906173903dedcbc3667efa3ab6f52dd55617991e

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

<% yield %>

<%
stimulus_controller = 'fields--date'

form ||= current_fields_form
options ||= {}
options[:id] ||= form.field_id(method)
options[:class] = "form-control single-daterange w-full border-gray-300 dark:bg-darkPrimary-800 dark:border-darkPrimary-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"
        style="top: 2px; right: 2px;"
        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.0.16 app/views/themes/tailwind_css/fields/_date_field.html.erb
bullet_train-themes-tailwind_css-1.0.15 app/views/themes/tailwind_css/fields/_date_field.html.erb