- content_for :javascript do :javascript $(function() { $(document).on('click', '.destroy_stock_change', function() { $(this).prev('input').val('1').parent().hide(); return false; }); $(document).on('click', '.remove_new_stock_change', function() { $(this).parent().remove(); return false; }); }); = simple_form_for [@supplier, @delivery], validate: true do |f| = f.hidden_field :supplier_id #stock_changes = f.fields_for :stock_changes do |stock_change_form| %p = stock_change_form.select :stock_article_id, stock_articles_for_select(@supplier) Menge = stock_change_form.text_field :quantity, size: 5, autocomplete: 'off' = stock_change_form.hidden_field :_destroy = link_to t('.remove_article'), "#", class: 'destroy_stock_change' %p = link_to t('.add_article'), {action: 'add_stock_change', supplier_id: @supplier.id}, remote: true %p %small= t('.note_new_article', new_link: link_to(t('.note_new_article_link'), new_stock_article_path)).html_safe %hr/ = f.input :delivered_on, as: :date_picker = f.input :note, input_html: {size: '35x4'} .form-actions = f.submit class: 'btn btn-primary' = link_to t('ui.or_cancel'), supplier_deliveries_path(@supplier) / TODO: Fix this!! .span6 %h2= t '.new_article.title' %p = t('.new_article.search', supplier: @supplier.name).html_safe + ': ' = text_field_tag 'article_name' %hr/ #stock_article_form = render 'stock_article_form', stock_article: @supplier.stock_articles.build