mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			45 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
$(() => {
 | 
						|
    // This code will be executed when the user visits /emails in
 | 
						|
    // development mode and email_log.html is rendered.
 | 
						|
    $('#toggle').change(() => {
 | 
						|
        if ($('.email-text').css('display') === 'none') {
 | 
						|
            $(".email-text").each(function () {
 | 
						|
                $(this).css("display", "block");
 | 
						|
            });
 | 
						|
            $(".email-html").each(function () {
 | 
						|
                $(this).css("display", "none");
 | 
						|
            });
 | 
						|
        } else {
 | 
						|
            $(".email-text").each(function () {
 | 
						|
                $(this).css("display", "none");
 | 
						|
            });
 | 
						|
            $(".email-html").each(function () {
 | 
						|
                $(this).css("display", "block");
 | 
						|
            });
 | 
						|
        }
 | 
						|
    });
 | 
						|
    $('input[type=radio][name=forward]').on('change', function () {
 | 
						|
        if ($(this).val() === "enabled") {
 | 
						|
            $("#forward_address_sections").show();
 | 
						|
        } else {
 | 
						|
            $("#forward_address_sections").hide();
 | 
						|
        }
 | 
						|
    });
 | 
						|
    $("#save_smptp_details").on("click", () => {
 | 
						|
        const address = $('input[name=forward]:checked').val() === "enabled" ? $("#address").val() : "";
 | 
						|
        const csrf_token = $('input[name="csrfmiddlewaretoken"]').attr('value');
 | 
						|
        const data = {forward_address: address, csrfmiddlewaretoken: csrf_token};
 | 
						|
 | 
						|
        channel.post({
 | 
						|
            url: "/emails/",
 | 
						|
            data: data,
 | 
						|
            success: function () {
 | 
						|
                $("#smtp_form_status").show();
 | 
						|
                setTimeout(() => {
 | 
						|
                    $("#smtp_form_status").hide();
 | 
						|
                }, 3000);
 | 
						|
            },
 | 
						|
        });
 | 
						|
    });
 | 
						|
});
 |