Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable submit and show spinner while editing channels #398

Merged
merged 2 commits into from
Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion omeroweb/webclient/static/webclient/css/dusty.css
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,31 @@ button::-moz-focus-inner {
left: 2%;
}


/* Channel edit form */
#channel_names_edit button {
height: 20px;
}
.confirmButtons {
display: none;
}
#channel_names_edit.in_progress button[type='submit'] {
/* Show a spinner while saving channels */
background: url('../../webgateway/img/spinner.gif') center center no-repeat;
color: transparent;
}

#channel_names_edit.in_progress button[type='reset'] {
/* Don't show Cancel button during Save as it does nothing */
visibility: hidden;
}

.channel_rename_spinner {
height: 12px;
vertical-align: middle;
/* hide initially */
display: none;
}


/*
------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,22 @@
<!-- hidden input for 'apply to dataset' options -->
<input type="text" name="parentId" size=5 style="display:none" />
<!-- buttons -->
<span class="originalButtons">
<button name="save" type="submit" value="save" title="Save channel names">Save</button>
<button name="apply" title="Save and apply to all images">Apply to All</button>
</span>
<span class="confirmButtons" style="display:none">
<div>Update channel names for all images
<div class="buttons">
<button class="originalButtons" name="save" type="submit" value="save" title="Save channel names">
Save
</button>
<button class="originalButtons" name="apply" title="Save and apply to all images">
Apply to All
</button>
<div class="confirmButtons">Update channel names for all images
in the <span class="ptype"></span>? <br />This cannot be undone.</div>
<button name="confirm_apply" type="submit" value="apply" title="Save and apply to all Images">Continue</button>
</span>
<button type="reset" name="cancel" title="Cancel">Cancel</button>
<button class="confirmButtons" name="confirm_apply" type="submit" value="apply" title="Save and apply to all Images">
Continue
</button>
<button type="reset" name="cancel" title="Cancel">
Cancel
</button>
</div>
</form>
{% if image.canEdit %}
<button id="editChannelNames" class="btn silver btn_edit"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@
$chNameForm.find(".confirmButtons").hide();
$("#channel_names_display").show();
$("#editChannelNames").show();
$("button[type='submit']", $chNameForm).removeAttr('disabled');
$chNameForm.removeClass("in_progress"); // hide spinner
$chNameForm.hide();
}
// Workflow starts by displaying the form
Expand All @@ -321,6 +323,10 @@
// Form handled by AJAX
$chNameForm.ajaxForm({
dataType: 'json',
beforeSubmit: function() {
$("button[type='submit']", $chNameForm).attr('disabled', true);
$chNameForm.addClass("in_progress"); // shows spinner
},
success: function(data) {
var cnames = data.channelNames;
// update the channel names, and ititial values in form
Expand Down