Added Quantity.primary to form
Fixed setting parent on Quantity form
This commit is contained in:
@@ -58,7 +58,8 @@ class QuantitiesController < ApplicationController
|
||||
:name,
|
||||
:description,
|
||||
:domain,
|
||||
:parent_id
|
||||
:parent_id,
|
||||
:primary
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
@@ -10,13 +10,17 @@
|
||||
<% end %>
|
||||
<p><%= f.text_field :name, size: 25, required: true %></p>
|
||||
<p><%= f.text_field :description, size: 200 %></p>
|
||||
<p><%= f.check_box :primary %></p>
|
||||
</div>
|
||||
|
||||
<%= javascript_tag do %>
|
||||
function domainChange() {
|
||||
$('[id^=parent_select_]').prop('disabled', true).hide();
|
||||
$('[id^=parent_select_] select').attr('name', 'placeholder');
|
||||
$('[id=parent_select_'+$('#quantity_domain option:selected').val()+']')
|
||||
.prop('disabled', false).show();
|
||||
$('[id=parent_select_'+$('#quantity_domain option:selected').val()+'] select')
|
||||
.attr('name', 'quantity[parent_id]');
|
||||
}
|
||||
$('#quantity-form').on('click', '#quantity_domain', domainChange);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user