scheduled_messages_overlay_ui: Use CSS to display no scheduled messages.

This commit is contained in:
Aman Agrawal 2023-05-01 11:36:35 +00:00 committed by Tim Abbott
parent 1b60019c60
commit eb5f679121
2 changed files with 13 additions and 13 deletions

View File

@ -64,19 +64,15 @@ export function launch() {
url: "/json/scheduled_messages", url: "/json/scheduled_messages",
success(data) { success(data) {
hide_loading_indicator(); hide_loading_indicator();
if (data.scheduled_messages.length === 0) { // Saving formatted data is helpful when user is trying to edit a scheduled message.
$(".no-overlay-messages").show(); scheduled_messages.override_scheduled_messages_data(
} else { format(data.scheduled_messages),
// Saving formatted data is helpful when user is trying to edit a scheduled message. );
scheduled_messages.override_scheduled_messages_data( const rendered_list = render_scheduled_message({
format(data.scheduled_messages), scheduled_messages_data: scheduled_messages.scheduled_messages_data,
); });
const rendered_list = render_scheduled_message({ const $messages_list = $("#scheduled_messages_overlay .overlay-messages-list");
scheduled_messages_data: scheduled_messages.scheduled_messages_data, $messages_list.append(rendered_list);
});
const $messages_list = $("#scheduled_messages_overlay .overlay-messages-list");
$messages_list.append(rendered_list);
}
}, },
error(xhr) { error(xhr) {
hide_loading_indicator(); hide_loading_indicator();

View File

@ -12,5 +12,9 @@
.no-overlay-messages { .no-overlay-messages {
display: none; display: none;
&:only-child {
display: block;
}
} }
} }