Improve document related views titles messages, improve pluralization.

This commit is contained in:
Roberto Rosario
2015-01-24 14:25:31 -04:00
parent 806b608177
commit febe21db1b
10 changed files with 50 additions and 39 deletions

View File

@@ -58,7 +58,7 @@ def checkout_info(request, document_pk):
return render_to_response('main/generic_template.html', {
'paragraphs': paragraphs,
'object': document,
'title': _('Document check out details')
'title': _('Check out details for document: %s') % document
}, context_instance=RequestContext(request))
@@ -91,7 +91,7 @@ def checkout_document(request, document_pk):
return render_to_response('main/generic_form.html', {
'form': form,
'object': document,
'title': _('Document check out')
'title': _('Check out document: %s') % document
}, context_instance=RequestContext(request))

View File

@@ -104,7 +104,7 @@ def comment_add(request, document_id):
return render_to_response('main/generic_form.html', {
'form': form,
'title': _('Add comment to document'),
'title': _('Add comment to document: %s') % document,
'next': next,
'object': document,
}, context_instance=RequestContext(request))
@@ -124,7 +124,7 @@ def comments_for_document(request, document_id):
return render_to_response('main/generic_list.html', {
'object': document,
'access_object': document,
'title': _('Document comments'),
'title': _('Comments for document: %s') % document,
'object_list': Comment.objects.for_model(document).order_by('-submit_date'),
'hide_link': True,
'hide_object': True,

View File

@@ -402,8 +402,8 @@ def document_index_list(request, document_id):
object_list.append(get_breadcrumbs(index_instance, single_link=True, include_count=True))
return render_to_response('main/generic_list.html', {
'title': _('Indexes containing this document'),
'object_list': object_list,
'object': document,
'hide_link': True,
'object': document
'title': _('Indexes containing document: %s') % document,
}, context_instance=RequestContext(request))

View File

@@ -68,10 +68,10 @@ def document_verify(request, document_pk):
)
return render_to_response('main/generic_template.html', {
'title': _('Document signature properties'),
'object': document,
'document': document,
'object': document,
'paragraphs': paragraphs,
'title': _('Signature properties for document: %s') % document,
}, context_instance=RequestContext(request))
@@ -103,11 +103,11 @@ def document_signature_upload(request, document_pk):
form = DetachedSignatureForm()
return render_to_response('main/generic_form.html', {
'title': _('Upload detached signature'),
'next': next,
'form': form,
'previous': previous,
'next': next,
'object': document,
'previous': previous,
'title': _('Upload detached signature for document: %s') % document,
}, context_instance=RequestContext(request))

View File

@@ -56,7 +56,7 @@ class DocumentWorkflowInstanceListView(SingleObjectListView):
{
'hide_link': True,
'object': self.get_document(),
'title': _('Document workflows'),
'title': _('Workflows for document: %s') % self.get_document(),
'list_object_variable_name': 'workflow_instance',
}
)

View File

@@ -128,7 +128,7 @@ def document_properties(request, document_id):
'form': document_properties_form,
'document': document,
'object': document,
'title': _('Document properties'),
'title': _('Properties for document: %s') % document,
}, context_instance=RequestContext(request))
@@ -149,7 +149,7 @@ def document_preview(request, document_id):
'form': preview_form,
'hide_labels': True,
'object': document,
'title': _('Document preview'),
'title': _('Preview of document: %s') % document,
}, context_instance=RequestContext(request))
@@ -170,7 +170,7 @@ def document_content(request, document_id):
'form': content_form,
'hide_labels': True,
'object': document,
'title': _('Document content'),
'title': _('Content of document: %s') % document,
}, context_instance=RequestContext(request))
@@ -258,7 +258,7 @@ def document_edit(request, document_id):
return render_to_response('main/generic_form.html', {
'form': form,
'object': document,
'title': _('Edit document properties'),
'title': _('Edit properties of document: %s') % document,
}, context_instance=RequestContext(request))
@@ -1111,10 +1111,6 @@ def document_version_list(request, document_pk):
document.add_as_recent_document_for_user(request.user)
context = {
'object_list': document.versions.order_by('-timestamp'),
'title': _('Document versions'),
'hide_object': True,
'object': document,
'access_object': document,
'extra_columns': [
{
@@ -1133,7 +1129,11 @@ def document_version_list(request, document_pk):
'name': _('Comment'),
'attribute': 'comment',
},
]
],
'hide_object': True,
'object': document,
'object_list': document.versions.order_by('-timestamp'),
'title': _('Versions of document: %s') % document,
}
return render_to_response('main/generic_list.html', context,

View File

@@ -8,7 +8,7 @@ from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ugettext_lazy as _, ungettext
from acls.models import AccessEntry
from acls.utils import apply_default_acls
@@ -191,9 +191,12 @@ def folder_add_document(request, document_id=None, document_id_list=None):
if len(documents) == 1:
context['object'] = documents[0]
context['title'] = _('Add document: %s to folder.') % documents[0]
elif len(documents) > 1:
context['title'] = _('Add documents: %s to folder.') % ', '.join([unicode(d) for d in documents])
context['title'] = ungettext(
'Add document to folder',
'Add documents to folder',
len(documents)
)
return render_to_response('main/generic_form.html', context,
context_instance=RequestContext(request))
@@ -208,9 +211,9 @@ def document_folder_list(request, document_id):
AccessEntry.objects.check_access(PERMISSION_DOCUMENT_VIEW, request.user, document)
context = {
'title': _('Folders containing this document'),
'object': document,
'hide_link': True,
'object': document,
'title': _('Folders containing document: %s') % document,
}
queryset = document.folders.all()

View File

@@ -77,9 +77,6 @@ def smart_link_instances_for_document(request, document_id):
context = {
'document': document,
'object': document,
'object_list': smart_links,
'title': _('Document smart links'),
'extra_columns': [
{'name': _('Indentifier'), 'attribute': encapsulate(lambda resolved_smart_link: resolved_smart_link.smart_link.get_dynamic_title(document))},
{'name': _('Documents'), 'attribute': encapsulate(lambda resolved_smart_link: resolved_smart_link.queryset.count())}
@@ -94,6 +91,9 @@ def smart_link_instances_for_document(request, document_id):
},
'hide_object': True,
'hide_link': True,
'object': document,
'object_list': smart_links,
'title': _('Smart links for document: %s') % document,
}
return render_to_response('main/generic_list.html', context,

View File

@@ -327,7 +327,7 @@ def metadata_view(request, document_id):
AccessEntry.objects.check_access(PERMISSION_METADATA_DOCUMENT_VIEW, request.user, document)
return render_to_response('main/generic_list.html', {
'title': _('Document metadata'),
'title': _('Metadata for document: %s') % document,
'object_list': document.metadata.all(),
'extra_columns': [
{'name': _('Value'), 'attribute': 'value'},

View File

@@ -171,13 +171,21 @@ def tag_delete(request, tag_id=None, tag_id_list=None):
'previous': previous,
'next': next,
}
if len(tags) == 1:
context = {
'form': form,
'previous': previous,
'message': _('Will be removed from all documents.'),
'next': next,
'title': ungettext(
'Are you sure you wish to delete the selected tag?',
'Are you sure you wish to delete the selected tags?',
len(tags)
)
}
if len(documents) == 1:
context['object'] = tags[0]
context['title'] = _('Are you sure you wish to delete the tag: %s?') % ', '.join([unicode(d) for d in tags])
context['message'] = _('Will be removed from all documents.')
elif len(tags) > 1:
context['title'] = _('Are you sure you wish to delete the tags: %s?') % ', '.join([unicode(d) for d in tags])
context['message'] = _('Will be removed from all documents.')
return render_to_response('main/generic_confirm.html', context,
context_instance=RequestContext(request))
@@ -222,7 +230,7 @@ class TagTaggedItemListView(DocumentListView):
def get_extra_context(self):
return {
'title': _('Documents with the tag "%s"') % self.get_tag(),
'title': _('Documents with the tag: %s') % self.get_tag(),
'hide_links': True,
'object': self.get_tag(),
}
@@ -239,7 +247,7 @@ def document_tags(request, document_id):
context = {
'object': document,
'document': document,
'title': _('Document tags'),
'title': _('Tags for document: %s') % document,
}
return tag_list(request, queryset=document.tags.all(), extra_context=context)