-
-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1414 from bolt/feature/adding-spinners-on-certain…
…-buttons Adding spinners and disabling buttons to indicate the user might have to wait a few seconds
- Loading branch information
Showing
8 changed files
with
46 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import $ from 'jquery'; | ||
|
||
$('*[data-patience]').on('click', function() { | ||
const thisElement = $(this); | ||
const thisIcon = thisElement.find('i'); | ||
|
||
// Bootstrap padding / margin like `mx-2` or `pt-3` | ||
const addedPadding = thisIcon.attr('class').match(/[mp][tblrxy]-[0-5]/i); | ||
const newClass = | ||
'fas fa-w fa-cog fa-spin ' + (addedPadding ? addedPadding : ''); | ||
|
||
$(this).attr('data-original-class', thisIcon.attr('class')); | ||
thisIcon.attr('class', newClass); | ||
|
||
window.setTimeout(function() { | ||
thisElement.attr('disabled', true); | ||
}, 50); | ||
}); | ||
|
||
window.reEnablePatientButtons = function() { | ||
$('*[data-patience]').each(function() { | ||
const thisIcon = $(this).find('i'); | ||
|
||
$(this).attr('disabled', false); | ||
thisIcon.attr('class', $(this).attr('data-original-class')); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters