1
0
This repository has been archived on 2023-12-07. You can view files and clone it, but cannot push or open issues or pull requests.
2019-09-12 23:28:16 +02:00

27 lines
862 B
Plaintext

<%= error_messages_for @quantity %>
<div class="box tabular">
<p><%= f.select :domain, domain_options, required: true %></p>
<% Quantity.domains.each_key do |d| %>
<div id="parent_select_<%= d %>" style="display: none">
<p><%= f.select :parent_id, parent_options(d),
{required: true, label: :field_parent_quantity} %></p>
</div>
<% end %>
<p><%= f.text_field :name, size: 25, required: true %></p>
<p><%= f.text_field :description, size: 200 %></p>
</div>
<%= javascript_tag do %>
function domainChange() {
$('[id^=parent_select_]').prop('disabled', true).hide();
$('[id=parent_select_'+$('#quantity_domain option:selected').val()+']')
.prop('disabled', false).show();
}
$('#quantity-form').on('click', '#quantity_domain', domainChange);
$(document).ready(function() {
domainChange();
});
<% end %>