Fix bug with update protocol from repository and modal disable button [SCI-3284] (#1631)

* Fix bug with update protocol from repository and modal disable button
This commit is contained in:
aignatov-bio 2019-04-03 09:18:18 +02:00 committed by GitHub
parent b679eb4a58
commit e034a0c055
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 2 deletions

View file

@ -133,6 +133,7 @@ function initCopyToRepository() {
})
.on("ajax:error", function(e2, data2) {
// Display errors in form
submitBtn[0].disabled = false;
if (data2.status === 422) {
$(this).renderFormErrors("protocol", data2.responseJSON);
} else {

View file

@ -464,7 +464,7 @@ class ProtocolsController < ApplicationController
# Everything good, display flash & render 200
log_activity(:update_protocol_in_task_from_repository,
@protocol.my_module.experiment.project,
my_module: @my_module.id,
my_module: @protocol.my_module.id,
protocol_repository: @protocol.parent.id)
flash[:success] = t(
'my_modules.protocols.update_from_parent_flash'

View file

@ -704,7 +704,7 @@ class Protocol < ApplicationRecord
def destroy_contents(current_user)
# Calculate total space taken by the protocol
st = self.space_taken
steps.pluck(:id) do |id|
steps.pluck(:id).each do |id|
unless Step.find(id).destroy(current_user)
raise ActiveRecord::RecordNotDestroyed
end