digest: Fix the styling of /digest page.

This adds a proper template for the /digest page, making it a
reasonable way to view the digest email content for development and
debugging.

Fixes: #11016.
This commit is contained in:
Shoumorup 2019-01-06 23:57:53 +05:30 committed by Tim Abbott
parent c6352c4d9d
commit 2afdbb139d
4 changed files with 59 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -7,6 +7,13 @@ body {
position: fixed;
}
.digest-address-link {
margin-top: 10px;
color: rgb(153, 153, 153);
font-size: 12px;
text-align: center;
}
.container-fluid {
padding: 0px;
min-height: 100%;
@ -118,6 +125,23 @@ body {
display: block;
}
.digest-container {
padding-top: 100px;
}
.digest-email-container {
display: block;
margin: 0 auto !important;
max-width: 500px;
padding-bottom: 30px;
}
.digest-email-html {
padding: 20px;
background-color: hsl(0, 0%, 100%);
border-radius: 5px;
}
.help .app-main {
padding: 0;
margin-top: 59px;
@ -371,6 +395,10 @@ li div.codehilite {
margin-bottom: 60px;
}
#digest-page-title {
text-align: center;
}
.lead {
font-weight: bold;
}

View File

@ -0,0 +1,26 @@
{% extends "zerver/base.html" %}
{% block porticocustomhead %}
{{ render_bundle('portico') }}
{% endblock %}
{% block content %}
<body>
<div class="portico-wrap">
{% include 'zerver/portico-header.html' %}
</div>
<div class="digest-container">
<div class="digest-email-container">
<div class="portico-page" id="digest-page-title">
<h1> Zulip Digest </h1>
</div>
<div class="digest-email-html">
{% include 'zerver/emails/compiled/digest.html' %}
<img id="digest-footer" src="/static/images/emails/footer.png"/>
</div>
<div class="digest-address-link"> {{physical_address}}</div>
</div>
{% include 'zerver/footer.html' %}
</div>
</body>
{% endblock %}

View File

@ -2,6 +2,8 @@ import time
from django.http import HttpRequest, HttpResponse
from django.shortcuts import render
from django.utils.timezone import now as timezone_now
from django.conf import settings
from zerver.lib.digest import handle_digest_email, DIGEST_CUTOFF
from zerver.decorator import zulip_login_required
from datetime import timedelta
@ -11,4 +13,6 @@ def digest_page(request: HttpRequest) -> HttpResponse:
user_profile_id = request.user.id
cutoff = time.mktime((timezone_now() - timedelta(days=DIGEST_CUTOFF)).timetuple())
context = handle_digest_email(user_profile_id, cutoff, render_to_web=True)
return render(request, 'zerver/emails/compiled/digest.html', context=context)
if context:
context.update({'physical_address': settings.PHYSICAL_ADDRESS})
return render(request, 'zerver/digest_base.html', context=context)