Merge pull request #2312 from okriuchykhin/ok_SCI_4237

Improve user experience for repository saving and fix checklist saving [SCI-4237]
This commit is contained in:
Alex Kriuchykhin 2020-01-15 16:36:40 +01:00 committed by GitHub
commit 967acb0af3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 11 deletions

View file

@ -94,16 +94,15 @@ var RepositoryDatatableRowEditor = (function() {
let $table = $(TABLE.table().node());
$table.on('ajax:success', '.repository-row-edit-form', function(ev, data) {
TABLE.ajax.reload();
HelperModule.flashAlertMsg(data.flash, 'success');
TABLE.ajax.reload(() => {
animateSpinner(null, false);
HelperModule.flashAlertMsg(data.flash, 'success');
});
});
$table.on('ajax:error', '.repository-row-edit-form', function(ev, data) {
HelperModule.flashAlertMsg(data.responseJSON.flash, 'danger');
});
$table.on('ajax:complete', '.repository-row-edit-form', function() {
animateSpinner(null, false);
HelperModule.flashAlertMsg(data.responseJSON.flash, 'danger');
});
}

View file

@ -44,11 +44,9 @@ class RepositoryChecklistValue < ApplicationRecord
def self.new_with_payload(payload, attributes)
value = new(attributes)
value.repository_cell
.repository_column
.repository_checklist_items.where(id: JSON.parse(payload)).find_each do |item|
value.repository_checklist_items_values.new(repository_checklist_item: item)
end
value.repository_checklist_items = value.repository_cell
.repository_column
.repository_checklist_items.where(id: JSON.parse(payload))
value
end
end