Skip to content

Commit

Permalink
IP array field partials
Browse files Browse the repository at this point in the history
  • Loading branch information
Exterm1nate committed Nov 26, 2024
1 parent cab08a2 commit 4d20d35
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
50 changes: 50 additions & 0 deletions spec/dummy/app/views/active_fields/forms/_ip_array.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<%= form_with(model: active_field, scope: :active_field, url: active_field.persisted? ? active_field_path(active_field) : active_fields_path) do |f| %>
<%= render partial: "shared/form_errors", locals: { record: active_field } %>

<div class="form-input">
<%= 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 class="form-input">
<%= f.label :customizable_type %>
<%= f.select :customizable_type, %w[Author Post], {}, { disabled: active_field.persisted? } %>
</div>

<div class="form-input">
<%= f.label :name %>
<%= f.text_field :name %>
</div>

<div class="form-input">
<%= f.label :min_size %>
<%= f.number_field :min_size, disabled: active_field.persisted? %>
</div>

<div class="form-input">
<%= f.label :max_size %>
<%= f.number_field :max_size, disabled: active_field.persisted? %>
</div>

<div class="form-input">
<%= f.label :default_value %>
<%=
render_array_field(
form: f,
name: :default_value,
value: active_field.default_value,
field_method: :text_field,
)
%>
</div>

<div class="form-input">
<%= f.submit %>
</div>
<% end %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<div class="form-input">
<%= form.label :value, active_field.name %>
<%=
render_array_field(
form: form,
name: :value,
value: active_value.value,
field_method: :text_field,
)
%>
</div>

0 comments on commit 4d20d35

Please sign in to comment.