diff --git a/app/assets/javascripts/forms.js b/app/assets/javascripts/forms.js index d350510..ead688e 100644 --- a/app/assets/javascripts/forms.js +++ b/app/assets/javascripts/forms.js @@ -1,13 +1,13 @@ $( document ).on('turbolinks:load', function() { // Removes Sample fields from Projects Form - $('form').on('click', '.destroy_fields', function() { + $('form').on('click', '.destroy_fields', function(event) { $(this).prev('input[type=hidden]').val('1') $(this).closest('.fieldset').hide() event.preventDefault() }) // Adds Test fields to Samples form - $('form').on('click', '.add_fields', function() { + $('form').on('click', '.add_fields', function(event) { time = new Date().getTime() regex = new RegExp($(this).data('id'), 'g') $(this).before($(this).data('fields').replace(regex, time)) @@ -22,19 +22,21 @@ $( document ).on('turbolinks:load', function() { }) // Remove Table Rows from Batch - $('table').on('click', '.destroy_row', function() { - $('#available_tests_section').show() + $('table').on('click', '.destroy_row', function(event) { + $('#available_tests_section').show(); var row = $(this).parents('tr:first'); - $(this).prev('input[type=hidden]').val('nil') - $('#append_to_unbatched').append(row) - $(row).find('a').attr('class', 'add_test_to_batch') - $(row).find('i').attr("aria-hidden", "true") - $(row).find('i').attr("class", "fa fa-plus") - event.preventDefault() + $(this).prev('input[type=hidden]').val('nil'); + $('#append_to_unbatched').append(row); + $(row).find('a').attr('class', 'add_test_to_batch'); + $(row).find('i').attr("aria-hidden", "true"); + $(row).find('i').attr("class", "fa fa-plus"); + event.preventDefault(); + console.log("return false") + return false; }) // Add Table Rows to Batch - $('table').on('click', '#add_test', function() { + $('table').on('click', '#add_test', function(event) { var row = $(this).parents('tr:first'); $('#append_to_batch').append(row) $(row).find('a').attr('class', 'destroy_row') diff --git a/app/views/batches/edit.html.erb b/app/views/batches/edit.html.erb index cc7bb10..640c887 100644 --- a/app/views/batches/edit.html.erb +++ b/app/views/batches/edit.html.erb @@ -2,7 +2,7 @@
- <%= form_for @batch do |batch| %> + <%= form_for @batch, remote: true do |batch| %> @@ -14,7 +14,7 @@ - <%= batch.fields_for :tests, remote: true do |test| %> + <%= batch.fields_for :tests do |test| %> @@ -39,11 +39,7 @@ <%= p.label :pipet_id, "Pipet", class: 'field-label' %>
- <%= - p.select :pipet_id, options_for_select(@pipets, selected: @selected), - {include_blank: true}, - {} - %> + <%= p.select :pipet_id, options_for_select(@pipets, selected: @selected) %>
<% end %> diff --git a/db/schema.rb b/db/schema.rb index 8271de5..ae0f714 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -70,7 +70,6 @@ t.string "reference_method" t.integer "turn_around_time" t.integer "detection_limit" - t.integer "batch_id" t.string "unit" t.datetime "created_at", null: false t.datetime "updated_at", null: false
<%= test.object.sample.project.user.company %> <%= test.object.sample.project.description %>