AIRAVATA-2228 Update button spinner when using ajax
Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/f98e8f84 Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/f98e8f84 Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/f98e8f84 Branch: refs/heads/develop Commit: f98e8f840541d4d21ccbde313ce41fc61ab356ee Parents: a1143c1 Author: Marcus Christie <[email protected]> Authored: Mon Nov 21 10:50:46 2016 -0500 Committer: Marcus Christie <[email protected]> Committed: Mon Nov 21 10:50:46 2016 -0500 ---------------------------------------------------------------------- public/css/bootstrap.min.css | 22 +++++++++++++++++++++- public/js/sharing/share.js | 5 ++++- 2 files changed, 25 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f98e8f84/public/css/bootstrap.min.css ---------------------------------------------------------------------- diff --git a/public/css/bootstrap.min.css b/public/css/bootstrap.min.css index fa46029..c2a9f00 100644 --- a/public/css/bootstrap.min.css +++ b/public/css/bootstrap.min.css @@ -107,4 +107,24 @@ body{ .slimScrollBar{ width: 7px; position: absolute; top: 0px; opacity: 0.4; display: none; border-radius: 7px; z-index: 99; right: 1px; height: 195.925px; background: rgb(0, 0, 0); } -.slimScrollRail{width: 7px; height: 100%; position: absolute; top: 0px; display: none; border-radius: 7px; opacity: 0.2; z-index: 90; right: 1px; background: rgb(51, 51, 51);} \ No newline at end of file +.slimScrollRail{width: 7px; height: 100%; position: absolute; top: 0px; display: none; border-radius: 7px; opacity: 0.2; z-index: 90; right: 1px; background: rgb(51, 51, 51);} + +.btn-spinner { + position: relative; + /* 12px = regular padding; 20px = spinner width; 5px = spacing */ + padding-left: calc(12px + 20px + 5px); +} +.btn-spinner::after { + content: ''; + background-image: url(../assets/ajax-loader.gif); + background-size: 20px 20px; + background-repeat: no-repeat; + display: block; + width: 20px; + height: 20px; + position: absolute; + left: 12px; + /* center vertically */ + top: 50%; + margin-top: -10px; +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f98e8f84/public/js/sharing/share.js ---------------------------------------------------------------------- diff --git a/public/js/sharing/share.js b/public/js/sharing/share.js index 8de122b..581b8c0 100755 --- a/public/js/sharing/share.js +++ b/public/js/sharing/share.js @@ -283,7 +283,7 @@ $(function() { }; var ajaxUpdateSharing = function(url, share_settings, callback) { - // TODO: add spinner to button and disable and remove when ajax request completes + $('#share-box-button').addClass('btn-spinner').attr('disabled', 'disabled'); $.ajax({ url: url, method: 'post', @@ -307,6 +307,9 @@ $(function() { + 'Error occurred: ' + status + '</div>' ).appendTo('#share-box-error-message'); + }, + complete: function(xhr, status) { + $('#share-box-button').removeClass('btn-spinner').removeAttr('disabled'); } }); };
