Sha256: 20c8c07c94c74fc9a574551cf029a8dbc305a51e527607d93f36746159bf0f82
Contents?: true
Size: 920 Bytes
Versions: 5
Compression:
Stored size: 920 Bytes
Contents
$ -> $('.js-command-button').on 'ajax:send', -> setButtonState $(this).find('input[type="submit"]'), 'loading' false $('.js-command-button').on 'ajax:success', -> setButtonState $(this).find('input[type="submit"]'), 'success' false $('.js-command-button').on 'ajax:error', -> setButtonState $(this).find('input[type="submit"]'), 'failed' false setButtonState = (button, state) -> if state == 'loading' button.val('Processing...').prop 'disabled', true else if state == 'success' button.val('Success!').attr 'data-command-button-state', 'success' restoreButton(button) else if state == 'failed' button.val('Failed!').attr 'data-command-button-state', 'failed' restoreButton(button) restoreButton = (button) -> setTimeout -> button.val(button.data('command')).prop('disabled', false).removeAttr('data-command-button-state') ,1500
Version data entries
5 entries across 5 versions & 1 rubygems