From b9b024dbc1c008ea163b76cb64ec7056b1e65d48 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Tue, 28 Jun 2011 01:03:36 -0400 Subject: [PATCH] Updated document page view to display zoom level and rotation degrees in the title --- apps/documents/views.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/apps/documents/views.py b/apps/documents/views.py index 4b814d092f..fcad1c407b 100644 --- a/apps/documents/views.py +++ b/apps/documents/views.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + import os import zipfile import urlparse @@ -830,11 +832,23 @@ def document_page_view(request, document_page_id): rotation = int(request.GET.get('rotation', 0)) document_page_form = DocumentPageForm(instance=document_page, zoom=zoom, rotation=rotation) + base_title = _(u'details for: %s') % document_page + + if zoom != 100: + zoom_text = u'(%d%%)' % zoom + else: + zoom_text = u'' + + if rotation != 0 and rotation != 360: + rotation_text = u'(%d°)' % rotation + else: + rotation_text = u'' + return render_to_response('generic_detail.html', { 'object': document_page, 'web_theme_hide_menus': True, 'form': document_page_form, - 'title': _(u'details for: %s') % document_page, + 'title': u' '.join([base_title, zoom_text, rotation_text]) }, context_instance=RequestContext(request))