compose: Extract the 'Sending...' from template to be added with Js.

In this we change the way 'Sending...' is displayed. Instead of
hardcoding it into the template we make change the paradigm so
that we can have a flexible message about what's happening
rather than just always saying 'Sending...'. For eg. this will
help in the upcoming feature of Scheduled Messages by having this
message say 'Scheduling...'.
This commit is contained in:
Aditya Bansal
2018-01-05 02:58:25 +05:30
committed by showell
parent f46d098558
commit b71ed33e64
2 changed files with 10 additions and 2 deletions

View File

@@ -47,6 +47,14 @@ exports.clear_all_everyone_warnings = function () {
$("#compose-send-status").hide();
};
function show_sending_indicator(whats_happening) {
if (whats_happening === undefined) {
whats_happening = 'Sending...';
}
$("#sending-indicator").html(i18n.t(whats_happening));
$("#sending-indicator").show();
}
function show_announce_warnings() {
var stream_count = stream_data.get_subscriber_count(compose_state.stream_name()) || 0;
@@ -537,7 +545,7 @@ function validate_private_message() {
exports.validate = function () {
$("#compose-send-button").attr('disabled', 'disabled').blur();
$("#sending-indicator").show();
show_sending_indicator();
if (/^\s*$/.test(compose_state.message_content())) {
compose_error(i18n.t("You have nothing to send!"), $("#compose-textarea"));