reminders: Add alert message for set reminder success or failure.

This commit is contained in:
Aditya Bansal 2018-01-16 05:42:12 +05:30 committed by showell
parent 0f71a7ecca
commit 7d8d7f7f9b
4 changed files with 27 additions and 8 deletions

View File

@ -242,8 +242,9 @@ $(function () {
$("body").on("click", ".copy_message", function (e) {
var row = $(this).closest(".message_row");
message_edit.end(row);
row.find(".alert-copied").css("display", "block");
row.find(".alert-copied").delay(1000).fadeOut(300);
row.find(".alert-msg").text(i18n.t("Copied!"));
row.find(".alert-msg").css("display", "block");
row.find(".alert-msg").delay(1000).fadeOut(300);
e.preventDefault();
e.stopPropagation();
});

View File

@ -227,7 +227,24 @@ function do_set_reminder(msgid, timestamp) {
reminder_message.reply_to = recipient;
reminder_message.private_message_recipient = recipient;
reminder_message.to_user_ids = people.email_list_to_user_ids_string(emails);
compose.schedule_message(reminder_message);
var row = $("[zid='" + msgid + "']");
function success() {
row.find(".alert-msg")
.text(i18n.t("Reminder set!"))
.css("display", "block")
.delay(1000).fadeOut(300);
}
function error() {
row.find(".alert-msg")
.text(i18n.t("Setting reminder failed!"))
.css("display", "block")
.delay(1000).fadeOut(300);
}
compose.schedule_message(reminder_message, success, error);
}
exports.render_actions_remind_popover = function (element, id) {
@ -688,7 +705,8 @@ exports.register_click_handlers = function () {
popovers.hide_actions_popover();
var id = $(this).attr("data-message-id");
var row = $("[zid='" + id + "']");
row.find(".alert-copied")
row.find(".alert-msg")
.text(i18n.t("Copied!"))
.css("display", "block")
.delay(1000).fadeOut(300);

View File

@ -649,7 +649,7 @@ td.pointer {
/* The way this overrides the menus with a background-color and a high
z-index is kinda hacky, and requires some annoying color-matching,
but it works. */
.alert-copied {
.alert-msg {
position: absolute;
right: -110px;
font-size: 14px;
@ -662,11 +662,11 @@ td.pointer {
display: none;
}
.private-message .alert-copied {
.private-message .alert-msg {
background-color: hsl(192, 19%, 95%);
}
.include-sender .alert-copied {
.include-sender .alert-msg {
top: -3px;
}

View File

@ -33,7 +33,7 @@
{{/if}}
{{/include_sender}}
</span>
<span class="alert-copied pull-right">{{t 'Copied!' }}</span>
<span class="alert-msg pull-right"></span>
<span class="message_time{{#if msg.locally_echoed}} notvisible{{/if}}{{#if status_message}} status-time{{/if}}">{{timestr}}</span>
{{#if_and last_edit_timestr include_sender}}
{{#unless status_message}}