From b4bd53262d1f73ea3ecab8dd3ed9714d78caf4d6 Mon Sep 17 00:00:00 2001 From: Lucas Palm Date: Mon, 17 Aug 2015 14:44:25 -0500 Subject: [PATCH] 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 --- .../dashboards/project/images/images/views.py | 7 +++++++ .../images/templates/images/images/_detail_overview.html | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/openstack_dashboard/dashboards/project/images/images/views.py b/openstack_dashboard/dashboards/project/images/images/views.py index 67ea6fff0f..d803168662 100644 --- a/openstack_dashboard/dashboards/project/images/images/views.py +++ b/openstack_dashboard/dashboards/project/images/images/views.py @@ -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 diff --git a/openstack_dashboard/dashboards/project/images/templates/images/images/_detail_overview.html b/openstack_dashboard/dashboards/project/images/templates/images/images/_detail_overview.html index d09576c08d..9999a42cd2 100644 --- a/openstack_dashboard/dashboards/project/images/templates/images/images/_detail_overview.html +++ b/openstack_dashboard/dashboards/project/images/templates/images/images/_detail_overview.html @@ -17,7 +17,7 @@
{% trans "Owner" %}
{{ image.owner }}
{% trans "Status" %}
-
{{ image.status|default:_("Unknown")|title }}
+
{{ image.status_label|default:_("Unknown")|title }}
{% trans "Public" %}
{{ image.is_public|yesno|capfirst }}
{% trans "Protected" %}