Add a tiny visual indicator that the message is sending.

This fixes Trac #1035.

(imported from commit f8d179f6f5e59922fdc5391624c6efb3da59395d)
This commit is contained in:
Waseem Daher
2013-03-06 11:40:51 -05:00
parent 569c9dbdc1
commit 932aeb86b5
3 changed files with 11 additions and 0 deletions

View File

@@ -49,6 +49,7 @@
</div> </div>
</div> </div>
<div id="tab-enter-message"> <div id="tab-enter-message">
<span id="sending-indicator">Sending...</span>
<label class="pull-right">Press Enter to send&nbsp; <label class="pull-right">Press Enter to send&nbsp;
<input type="checkbox" id="enter_sends" name="enter_sends" value="ender_sends" /> <input type="checkbox" id="enter_sends" name="enter_sends" value="ender_sends" />
</label> </label>

View File

@@ -198,6 +198,7 @@ function compose_error(error_text, bad_input) {
.stop(true).fadeTo(0, 1); .stop(true).fadeTo(0, 1);
$('#error-msg').html(error_text); $('#error-msg').html(error_text);
$("#compose-send-button").removeAttr('disabled'); $("#compose-send-button").removeAttr('disabled');
$("#sending-indicator").hide();
bad_input.focus().select(); bad_input.focus().select();
} }
@@ -240,6 +241,7 @@ function send_message() {
is_composing_message = false; is_composing_message = false;
compose.hide(); compose.hide();
$("#compose-send-button").removeAttr('disabled'); $("#compose-send-button").removeAttr('disabled');
$("#sending-indicator").hide();
}, },
error: function (xhr, error_type) { error: function (xhr, error_type) {
if (error_type !== 'timeout' && reload.is_pending()) { if (error_type !== 'timeout' && reload.is_pending()) {
@@ -367,6 +369,7 @@ function check_stream_for_send(stream_name) {
ui.report_error("Error checking subscription", xhr, $("#home-error")); ui.report_error("Error checking subscription", xhr, $("#home-error"));
$("#stream").focus(); $("#stream").focus();
$("#compose-send-button").removeAttr('disabled'); $("#compose-send-button").removeAttr('disabled');
$("#sending-indicator").hide();
} }
return result; return result;
@@ -423,6 +426,7 @@ function validate_private_message() {
exports.validate = function () { exports.validate = function () {
$("#compose-send-button").attr('disabled', 'disabled').blur(); $("#compose-send-button").attr('disabled', 'disabled').blur();
$("#sending-indicator").show();
if (exports.message_content() === "") { if (exports.message_content() === "") {
compose_error("You have nothing to send!", $("#new_message_content")); compose_error("You have nothing to send!", $("#new_message_content"));

View File

@@ -1026,3 +1026,9 @@ table.floating_recipient {
.emoji { .emoji {
height: 1.4em; height: 1.4em;
} }
#sending-indicator {
float: left;
font-weight: bold;
display: none;
}