Skip to content

Commit

Permalink
Merge pull request #7810 from fatmaBouchekoua/BOOM-2254
Browse files Browse the repository at this point in the history
Add a loading spinner into product page
  • Loading branch information
eternoendless committed Sep 21, 2017
2 parents 287f8a6 + dde65dc commit ba23b10
Show file tree
Hide file tree
Showing 8 changed files with 206 additions and 255 deletions.
16 changes: 14 additions & 2 deletions admin-dev/themes/default/js/bundle/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,20 @@
* Default layout instanciation
*/
$(document).ready(function() {
$('[data-toggle="tooltip"]').tooltip();
rightSidebar.init();
var $this = $(this);
var $ajaxSpinner = $('.ajax-spinner');
$('[data-toggle="tooltip"]').tooltip();
rightSidebar.init();
/** spinner loading */
$this.ajaxStart(function () {
$ajaxSpinner.show();
});
$this.ajaxStop(function () {
$ajaxSpinner.hide();
});
$this.ajaxError(function () {
$ajaxSpinner.hide();
});
});

var rightSidebar = (function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var combinations = (function() {
url: elem.attr('href'),
beforeSend: function() {
elem.attr('disabled', 'disabled');
$('#create-combinations, #apply-on-combinations, #submit, .btn-submit').attr('disabled', 'disabled');
},
success: function(response) {
combinationElem.remove();
Expand All @@ -32,6 +33,7 @@ var combinations = (function() {
},
complete: function() {
elem.removeAttr('disabled');
$('#create-combinations, #apply-on-combinations, #submit, .btn-submit').removeAttr('disabled');
supplierCombinations.refresh();
warehouseCombinations.refresh();
if ($('.js-combinations-list .combination').length <= 0) {
Expand Down
4 changes: 2 additions & 2 deletions admin-dev/themes/new-theme/js/product-page/combination.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export default function() {
url: $('#form_step3_attributes').attr('data-action'),
data: $('#attributes-generator input.attribute-generator, #form_id_product').serialize(),
beforeSend: function() {
$('#create-combinations').attr('disabled', 'disabled');
$('#create-combinations, #submit, .btn-submit').attr('disabled', 'disabled');
},
success: function(response) {
$('#accordion_combinations').append(response.form);
Expand All @@ -175,7 +175,7 @@ export default function() {
$('#combinations_thead').fadeIn();
},
complete: function() {
$('#create-combinations').removeAttr('disabled');
$('#create-combinations, #submit, .btn-submit').removeAttr('disabled');
supplierCombinations.refresh();
warehouseCombinations.refresh();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ export default function() {
'attribute-ids': combinationsIds
},
url: deletionURL,
beforeSend: function () {
$('#create-combinations, #apply-on-combinations, #submit, .btn-submit').attr('disabled', 'disabled');
},
success: function(response) {
showSuccessMessage(response.message);
combinationsIds.forEach((combinationId) => {
Expand All @@ -128,6 +131,9 @@ export default function() {
error: function(response) {
showErrorMessage(jQuery.parseJSON(response.responseText).message);
},
complete: function () {
$('#create-combinations, #apply-on-combinations, #submit, .btn-submit').removeAttr('disabled');
},
});
}
}).show();
Expand Down
103 changes: 44 additions & 59 deletions admin-dev/themes/new-theme/public/main.bundle.js

Large diffs are not rendered by default.

Loading

0 comments on commit ba23b10

Please sign in to comment.