Sha256: 08fff3bf1370d16717d851b1fd7253cada7f7109ee802dbee77663a40bab5bbc

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

<%
  base_class = "text-input".freeze

  # Optional props
  autocomplete = local_assigns.fetch(:autocomplete, false)
  autofocus = local_assigns.fetch(:autofocus, false)
  id = local_assigns.fetch(:id, false)
  disabled = local_assigns.fetch(:disabled, false)
  label = local_assigns.fetch(:label, false)
  min = local_assigns.fetch(:min, false)
  placeholder = local_assigns.fetch(:placeholder, false)
  required = local_assigns.fetch(:required, false)
  small = local_assigns.fetch(:small, false)
  type = local_assigns.fetch(:type, :text)
  value = local_assigns.fetch(:value, '')

  # Classes
  class_names = [base_class]
  class_names.push("#{base_class}--small") if small
  class_names = class_names.join(" ")
%>

<div class="<%= class_names %>">
  <% if label %>
    <label
      <% if id %>
        for="<%= id %>"
      <% end %>
    >
      <%= label %>:
    </label>
  <% end %>

  <input
    name="<%= name %>"
    type="<%= type %>"
    value="<%= value %>"
    <% if autocomplete%>
      autocomplete="<%= autocomplete %>"
    <% end %>
    <% if id %>
      id="<%= id %>"
    <% end %>
    <% if min %>
      min="<%= min %>"
    <% end %>
    <% if placeholder %>
      placeholder="<%= placeholder %>"
    <% end %>
    <%= autofocus ? "autofocus" : "" %>
    <%= disabled ? "disabled" : "" %>
    <%= required ? "required" : "" %>
  >
</div>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_starter_frontend-0.1.0 app/views/spree/components/forms/inputs/_text.html.erb