Skip to content
This repository has been archived by the owner on Aug 30, 2019. It is now read-only.

Commit

Permalink
fix(js): add spinner for form submit action
Browse files Browse the repository at this point in the history
  • Loading branch information
hypeJunction committed Aug 23, 2016
1 parent c6d8832 commit 1d4dc44
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions views/default/forms/attachments/upload.js
Expand Up @@ -4,8 +4,10 @@ define(function (require) {
var $ = require('jquery');
require('jquery.form');
var lightbox = require('elgg/lightbox');
var spinner = require('elgg/spinner');

$(document).on('submit', '#colorbox .elgg-form-attachments-upload', function (e) {

e.preventDefault();
var $form = $(this);

Expand All @@ -17,9 +19,11 @@ define(function (require) {
},
beforeSend: function () {
$form.find('[type="submit"]').prop('disabled', true).addClass('elgg-state-disabled');
spinner.start();
},
complete: function () {
$form.find('[type="submit"]').prop('disabled', false).removeClass('elgg-state-disabled');
spinner.stop();
},
success: function (data) {
if (data.status >= 0) {
Expand Down

0 comments on commit 1d4dc44

Please sign in to comment.