Sha256: ffb4e33c4c0a72305f2ee9e4917f353fef296c2beac30ca9cca3a5e1f4bf448b

Contents?: true

Size: 1.79 KB

Versions: 20

Compression:

Stored size: 1.79 KB

Contents

<%= content_tag :div,
  class: classes,
  style: style,
  data: data do %>
  <%= content_tag :div, class: class_names("pt-4 flex self-start items-center flex-shrink-0 w-48 px-6 uppercase font-semibold text-gray-500 text-sm", @field.get_html(:classes, view: @view, element: :label), {
    "md:pt-4 md:w-full": stacked?,
    "h-full md:pt-0": !stacked?,
    "md:h-10 ": !stacked? && short?,
    "md:h-14 ": !stacked? && !short?,
    "md:w-48": compact?,
    "md:w-64": !compact?,
  }), data: {slot: "label"} do %>
    <% if @form.present? %>
      <%= @form.label label_for, label %>
    <% else %>
      <%= @field.name %>
    <% end %>
    <% if on_edit? && @field.is_required? %> <span class="text-red-600 ml-1">*</span> <% end %>
  <% end %>
  <%= content_tag :div, class: class_names("flex-1 flex flex-row md:min-h-inherit px-6",
    @field.get_html(:classes, view: @view, element: :content),
      {
        "pb-4": stacked?,
        "py-2": !compact?,
        "py-1": compact?,
      }), data: {slot: "value"} do %>
    <div class="self-center w-full <% unless full_width? || compact? || stacked? %> md:w-8/12 has-sidebar:w-full <% end %>">
      <% if on_show? %>
        <% if render_dash? %>
          —
        <% else %>
          <%= content %>
        <% end %>
      <% elsif on_edit? %>
        <%= content %>
        <% if record.present? and record.errors.include? @field.id %>
          <div class="text-red-600 mt-2 text-sm"><%= record.errors.full_messages_for(@field.id).to_sentence %></div>
        <% end %>
        <% if help.present? %>
          <div class="text-gray-600 mt-2 text-sm"><%= sanitize help %></div>
        <% end %>
      <% end %>
    </div>
  <% end %>
  <% if params[:avo_debug].present? %>
    <!-- Raw value: -->
    <!-- <%= sanitize @field.value.inspect %> -->
  <% end %>
<% end %>

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
avo-3.15.1 app/components/avo/field_wrapper_component.html.erb
avo-3.15.0 app/components/avo/field_wrapper_component.html.erb
avo-3.14.5 app/components/avo/field_wrapper_component.html.erb
avo-3.14.4 app/components/avo/field_wrapper_component.html.erb
avo-3.14.3 app/components/avo/field_wrapper_component.html.erb
avo-3.14.2 app/components/avo/field_wrapper_component.html.erb
avo-3.14.1 app/components/avo/field_wrapper_component.html.erb
avo-3.14.0 app/components/avo/field_wrapper_component.html.erb
avo-3.13.7 app/components/avo/field_wrapper_component.html.erb
avo-3.13.6 app/components/avo/field_wrapper_component.html.erb
avo-3.13.5 app/components/avo/field_wrapper_component.html.erb
avo-3.13.4 app/components/avo/field_wrapper_component.html.erb
avo-3.13.3 app/components/avo/field_wrapper_component.html.erb
avo-3.13.2 app/components/avo/field_wrapper_component.html.erb
avo-3.13.1 app/components/avo/field_wrapper_component.html.erb
avo-3.13.0 app/components/avo/field_wrapper_component.html.erb
avo-3.12.0 app/components/avo/field_wrapper_component.html.erb
avo-3.11.10 app/components/avo/field_wrapper_component.html.erb
avo-3.11.9 app/components/avo/field_wrapper_component.html.erb
avo-3.11.8 app/components/avo/field_wrapper_component.html.erb