Sha256: 4cf0e43d835e97ae5f2b9dca2c3d3a3ffa1a63d05d16e09f52483d01908dc9bc

Contents?: true

Size: 1.85 KB

Versions: 1

Compression:

Stored size: 1.85 KB

Contents

<%= form_with(model: active_field, scope: :active_field, url: active_field.persisted? ? active_field_path(active_field) : active_fields_path) do |f| %>
  <% if active_field.errors.any? %>
    <div style="color: red">
      <h2><%= pluralize(active_field.errors.count, "error") %> prohibited this record from being saved:</h2>

      <ul>
        <% active_field.errors.each do |error| %>
          <li><%= error.full_message %></li>
        <% end %>
      </ul>
    </div>
  <% end %>

  <div>
    <%= f.label :type %>
    <%=
      f.text_field :type,
        name: "type",
        value: active_field.type_name,
        disabled: active_field.persisted?,
        readonly: active_field.new_record?
    %>
  </div>

  <div>
    <%= f.label :customizable_type %>
    <%= f.select :customizable_type, ["TODO: add allowed customizable model names"], {}, { disabled: active_field.persisted? } %>
  </div>

  <div>
    <%= f.label :name %>
    <%= f.text_field :name %>
  </div>

  <div>
    <%= f.label :min_size %>
    <%= f.number_field :min_size, disabled: active_field.persisted? %>
  </div>

  <div>
    <%= f.label :max_size %>
    <%= f.number_field :max_size, disabled: active_field.persisted? %>
  </div>

  <div>
    <%= f.label :min %>
    <%= f.number_field :min, step: "any", disabled: active_field.persisted? %>
  </div>

  <div>
    <%= f.label :max %>
    <%= f.number_field :max, step: "any", disabled: active_field.persisted? %>
  </div>

  <div>
    <%= f.label :precision %>
    <%= f.number_field :precision, min: 0, disabled: active_field.persisted? %>
  </div>

  <div>
    <%= f.label :default_value %>
    <%=
      render_array_field(
        form: f,
        name: :default_value,
        value: active_field.default_value,
        field_method: :number_field,
        field_opts: { step: "any" },
      )
    %>
  </div>

  <div>
    <%= f.submit %>
  </div>
<% end %>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_fields-1.1.0 lib/generators/active_fields/scaffold/templates/views/active_fields/forms/_decimal_array.html.erb