Commit 73bf850f by kevalbhatt

ATLAS-3711 : UI: Classification/Term modal should close after…

ATLAS-3711 : UI: Classification/Term modal should close after create/update/delete response #2 loader improvement for cancel button
parent 076d83c3
...@@ -630,17 +630,18 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', ...@@ -630,17 +630,18 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
superTypes = []; superTypes = [];
var getData = function(data, collection) { var getData = function(data, collection) {
superTypes = superTypes.concat(data.superTypes); if (data) {
superTypes = superTypes.concat(data.superTypes);
if (data.superTypes && data.superTypes.length) { if (data.superTypes && data.superTypes.length) {
_.each(data.superTypes, function(superTypeName) { _.each(data.superTypes, function(superTypeName) {
if (collection.fullCollection) { if (collection.fullCollection) {
var collectionData = collection.fullCollection.findWhere({ name: superTypeName }).toJSON(); var collectionData = collection.fullCollection.findWhere({ name: superTypeName }).toJSON();
} else { } else {
var collectionData = collection.findWhere({ name: superTypeName }).toJSON(); var collectionData = collection.findWhere({ name: superTypeName }).toJSON();
} }
return getData(collectionData, collection); getData(collectionData, collection);
}); });
}
} }
} }
getData(data, collection); getData(data, collection);
...@@ -887,9 +888,11 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', ...@@ -887,9 +888,11 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
} }
$.fn.showButtonLoader = function() { $.fn.showButtonLoader = function() {
$(this).attr("disabled", "true").addClass('button-loader'); $(this).attr("disabled", "true").addClass('button-loader');
$(this).siblings("button.cancel").prop("disabled", true);
} }
$.fn.hideButtonLoader = function() { $.fn.hideButtonLoader = function() {
$(this).removeClass('button-loader').removeAttr("disabled"); $(this).removeClass('button-loader').removeAttr("disabled");
$(this).siblings("button.cancel").prop("disabled", false);
} }
return Utils; return Utils;
}); });
\ No newline at end of file
...@@ -103,7 +103,6 @@ define(['require', ...@@ -103,7 +103,6 @@ define(['require',
}).open(); }).open();
this.modal.$el.find('button.ok').attr("disabled", true); this.modal.$el.find('button.ok').attr("disabled", true);
this.modal.on('ok', function(e) { this.modal.on('ok', function(e) {
that.modal.$el.find('button.cancel').attr("disabled", true);
that.modal.$el.find('button.ok').showButtonLoader(); that.modal.$el.find('button.ok').showButtonLoader();
that.okButton(); that.okButton();
}); });
...@@ -788,7 +787,6 @@ define(['require', ...@@ -788,7 +787,6 @@ define(['require',
editVisiblityOfEntitySelectionBox: true editVisiblityOfEntitySelectionBox: true
}); });
that.modal.$el.find('button.ok').hideButtonLoader(); that.modal.$el.find('button.ok').hideButtonLoader();
that.modal.$el.find('button.cancel').attr("disabled", false);
} }
}); });
......
...@@ -677,17 +677,18 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', ...@@ -677,17 +677,18 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
superTypes = []; superTypes = [];
var getData = function(data, collection) { var getData = function(data, collection) {
superTypes = superTypes.concat(data.superTypes); if (data) {
superTypes = superTypes.concat(data.superTypes);
if (data.superTypes && data.superTypes.length) { if (data.superTypes && data.superTypes.length) {
_.each(data.superTypes, function(superTypeName) { _.each(data.superTypes, function(superTypeName) {
if (collection.fullCollection) { if (collection.fullCollection) {
var collectionData = collection.fullCollection.findWhere({ name: superTypeName }).toJSON(); var collectionData = collection.fullCollection.findWhere({ name: superTypeName }).toJSON();
} else { } else {
var collectionData = collection.findWhere({ name: superTypeName }).toJSON(); var collectionData = collection.findWhere({ name: superTypeName }).toJSON();
} }
return getData(collectionData, collection); getData(collectionData, collection);
}); });
}
} }
} }
getData(data, collection); getData(data, collection);
...@@ -935,9 +936,11 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', ...@@ -935,9 +936,11 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
} }
$.fn.showButtonLoader = function() { $.fn.showButtonLoader = function() {
$(this).attr("disabled", "true").addClass('button-loader'); $(this).attr("disabled", "true").addClass('button-loader');
$(this).siblings("button.cancel").prop("disabled", true);
} }
$.fn.hideButtonLoader = function() { $.fn.hideButtonLoader = function() {
$(this).removeClass('button-loader').removeAttr("disabled"); $(this).removeClass('button-loader').removeAttr("disabled");
$(this).siblings("button.cancel").prop("disabled", false);
} }
return Utils; return Utils;
}); });
\ No newline at end of file
...@@ -103,7 +103,6 @@ define(['require', ...@@ -103,7 +103,6 @@ define(['require',
}).open(); }).open();
this.modal.$el.find('button.ok').attr("disabled", true); this.modal.$el.find('button.ok').attr("disabled", true);
this.modal.on('ok', function(e) { this.modal.on('ok', function(e) {
that.modal.$el.find('button.cancel').attr("disabled", true);
that.modal.$el.find('button.ok').showButtonLoader(); that.modal.$el.find('button.ok').showButtonLoader();
that.okButton(); that.okButton();
}); });
...@@ -794,7 +793,6 @@ define(['require', ...@@ -794,7 +793,6 @@ define(['require',
editVisiblityOfEntitySelectionBox: true editVisiblityOfEntitySelectionBox: true
}); });
that.modal.$el.find('button.ok').hideButtonLoader(); that.modal.$el.find('button.ok').hideButtonLoader();
that.modal.$el.find('button.cancel').attr("disabled", false);
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment