Made image detail status translatable

The "status" label on the Image Details panel in both the Project
and Admin dashboards is currently untranslatable.  This patch
fixes that issue and allows that status to be translated.

Change-Id: Ia3c4c7004e152b7036bad59ca125c2bfb1c67418
Partial-Bug: #1441366
This commit is contained in:
Lucas Palm 2015-08-17 14:44:25 -05:00
parent a2f0157d30
commit b4bd53262d
2 changed files with 8 additions and 1 deletions

View File

@ -109,6 +109,13 @@ class DetailView(tabs.TabView):
context["image"] = image
context["url"] = self.get_redirect_url()
context["actions"] = table.render_row_actions(image)
status_label = [label for (value, label) in
project_tables.ImagesTable.STATUS_DISPLAY_CHOICES
if value.lower() == (image.status or '').lower()]
if status_label:
image.status_label = status_label[0]
else:
image.status_label = image.status
return context
@staticmethod

View File

@ -17,7 +17,7 @@
<dt>{% trans "Owner" %}</dt>
<dd>{{ image.owner }}</dd>
<dt>{% trans "Status" %}</dt>
<dd>{{ image.status|default:_("Unknown")|title }}</dd>
<dd>{{ image.status_label|default:_("Unknown")|title }}</dd>
<dt>{% trans "Public" %}</dt>
<dd>{{ image.is_public|yesno|capfirst }}</dd>
<dt>{% trans "Protected" %}</dt>