From 36bfdf64d0e04b5b981627678db2cefe7df9230e Mon Sep 17 00:00:00 2001 From: Alice Date: Wed, 7 Sep 2016 01:28:42 +0000 Subject: [PATCH] Fix mising page titles --- ccvpn/views.py | 3 ++- lambdainst/views.py | 2 +- templates/layout.html | 6 +++++- tickets/views.py | 23 ++++++++++++++++++++--- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/ccvpn/views.py b/ccvpn/views.py index 7b801ae..ff969bc 100644 --- a/ccvpn/views.py +++ b/ccvpn/views.py @@ -25,7 +25,8 @@ def chat(request): username = request.user.username + '|cc' else: username = "cc?" - return render(request, 'ccvpn/chat.html', dict(username=username)) + ctx = dict(username=username, title=_("Live Chat")) + return render(request, 'ccvpn/chat.html', ctx) def set_lang(request): diff --git a/lambdainst/views.py b/lambdainst/views.py index a94a557..87d1416 100644 --- a/lambdainst/views.py +++ b/lambdainst/views.py @@ -284,7 +284,7 @@ def logs(request): @login_required def config(request): return render(request, 'lambdainst/config.html', dict( - titla=_("Config"), + title=_("Config"), config_os=openvpn.CONFIG_OS, config_countries=(c for _, c in get_locations()), config_protocols=openvpn.PROTOCOLS, diff --git a/templates/layout.html b/templates/layout.html index 397eef6..0b35716 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -4,7 +4,11 @@ - {{ title | default:'CCrypto VPN' }} + {% if title %} + {{ title }} - CCrypto VPN + {% else %} + CCrypto VPN + {% endif %} diff --git a/tickets/views.py b/tickets/views.py index e9a600e..4d0a98b 100644 --- a/tickets/views.py +++ b/tickets/views.py @@ -3,6 +3,7 @@ from django.contrib.auth.decorators import login_required from django.http.response import HttpResponseNotFound from django.utils import timezone from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger +from django.utils.translation import ugettext as _ from .models import Ticket, TicketMessage from .forms import NewTicketForm, ReplyForm, StaffReplyForm @@ -45,7 +46,12 @@ def index(request, f=None, all=False): except EmptyPage: tickets = paginator.page(paginator.num_pages) - context = dict(tickets=tickets, filter=f, single_user=single_user) + context = dict( + tickets=tickets, + filter=f, + single_user=single_user, + title=_("Tickets"), + ) context.update(common_context(request)) if not f: return render(request, 'tickets/index.html', context) @@ -56,6 +62,7 @@ def index(request, f=None, all=False): @login_required def new(request): context = common_context(request) + context['title'] = _("New Ticket") if request.method != 'POST': context['form'] = NewTicketForm() return render(request, 'tickets/new.html', context) @@ -105,7 +112,12 @@ def view(request, id): else: form = ReplyForm() - ctx = dict(ticket=ticket, ticket_messages=messages, form=form) + ctx = dict( + ticket=ticket, + ticket_messages=messages, + form=form, + title=_("Ticket:") + " " + ticket.subject, + ) ctx.update(common_context(request)) return render(request, 'tickets/view.html', ctx) @@ -130,7 +142,12 @@ def view(request, id): form = ReplyForm(request.POST) if not form.is_valid(): - ctx = dict(ticket=ticket, ticket_messages=messages, form=form) + ctx = dict( + ticket=ticket, + ticket_messages=messages, + form=form, + title=_("Ticket:") + " " + ticket.subject, + ) ctx.update(common_context(request)) return render(request, 'tickets/view.html', ctx)