From 73ad5ec1862418adcde86e3623c4997d8db6e862 Mon Sep 17 00:00:00 2001 From: Sam Betts Date: Tue, 10 Feb 2015 13:26:56 +0000 Subject: [PATCH] Reduce page title duplication in Admin views Patch https://review.openstack.org/#/c/142802 adds a method of reducing duplication of page title logic, this patch applies that change to the admin info, instances, metering and metadata_defs views. Change-Id: Ia30fee5318391283cb471a32547e75b1ecfb6de6 Partial-Bug: 1413749 --- .../dashboards/admin/info/templates/info/index.html | 4 ---- openstack_dashboard/dashboards/admin/info/views.py | 1 + .../dashboards/admin/instances/templates/instances/index.html | 4 ---- .../admin/instances/templates/instances/live_migrate.html | 4 ---- openstack_dashboard/dashboards/admin/instances/views.py | 2 ++ .../admin/metadata_defs/templates/metadata_defs/create.html | 4 ---- .../admin/metadata_defs/templates/metadata_defs/index.html | 4 ---- openstack_dashboard/dashboards/admin/metadata_defs/views.py | 2 ++ .../dashboards/admin/metering/templates/metering/daily.html | 4 ---- .../dashboards/admin/metering/templates/metering/index.html | 4 ---- openstack_dashboard/dashboards/admin/metering/views.py | 2 ++ 11 files changed, 7 insertions(+), 28 deletions(-) diff --git a/openstack_dashboard/dashboards/admin/info/templates/info/index.html b/openstack_dashboard/dashboards/admin/info/templates/info/index.html index bfe5578a11..ee7888acb9 100644 --- a/openstack_dashboard/dashboards/admin/info/templates/info/index.html +++ b/openstack_dashboard/dashboards/admin/info/templates/info/index.html @@ -2,10 +2,6 @@ {% load i18n %} {% block title %}{% trans "System Information" %}{% endblock %} -{% block page_header %} - {% include "horizon/common/_page_header.html" with title=_("System Information")%} -{% endblock page_header %} - {% block main %}
diff --git a/openstack_dashboard/dashboards/admin/info/views.py b/openstack_dashboard/dashboards/admin/info/views.py index 1f363d9403..5c1f57fc7b 100644 --- a/openstack_dashboard/dashboards/admin/info/views.py +++ b/openstack_dashboard/dashboards/admin/info/views.py @@ -29,6 +29,7 @@ from openstack_dashboard.dashboards.admin.info import tabs as project_tabs class IndexView(tabs.TabbedTableView): tab_group_class = project_tabs.SystemInfoTabs template_name = constants.INFO_TEMPLATE_NAME + page_title = _("System Information") def get_context_data(self, **kwargs): context = super(IndexView, self).get_context_data(**kwargs) diff --git a/openstack_dashboard/dashboards/admin/instances/templates/instances/index.html b/openstack_dashboard/dashboards/admin/instances/templates/instances/index.html index 43f9d1c9d5..24234bcf7a 100644 --- a/openstack_dashboard/dashboards/admin/instances/templates/instances/index.html +++ b/openstack_dashboard/dashboards/admin/instances/templates/instances/index.html @@ -2,10 +2,6 @@ {% load i18n %} {% block title %}{% trans "Instances" %}{% endblock %} -{% block page_header %} - {% include "horizon/common/_page_header.html" with title=_("All Instances") %} -{% endblock page_header %} - {% block main %} {{ table.render }} {% endblock %} diff --git a/openstack_dashboard/dashboards/admin/instances/templates/instances/live_migrate.html b/openstack_dashboard/dashboards/admin/instances/templates/instances/live_migrate.html index 749883b540..a7ffdd415f 100644 --- a/openstack_dashboard/dashboards/admin/instances/templates/instances/live_migrate.html +++ b/openstack_dashboard/dashboards/admin/instances/templates/instances/live_migrate.html @@ -2,10 +2,6 @@ {% load i18n %} {% block title %}{% trans "Live Migrate" %}{% endblock %} -{% block page_header %} - {% include "horizon/common/_page_header.html" with title=_("Live Migrate") %} -{% endblock page_header %} - {% block main %} {% include 'admin/instances/_live_migrate.html' %} {% endblock %} diff --git a/openstack_dashboard/dashboards/admin/instances/views.py b/openstack_dashboard/dashboards/admin/instances/views.py index f28cd0b972..e032192a0a 100644 --- a/openstack_dashboard/dashboards/admin/instances/views.py +++ b/openstack_dashboard/dashboards/admin/instances/views.py @@ -64,6 +64,7 @@ class AdminUpdateView(views.UpdateView): class AdminIndexView(tables.DataTableView): table_class = project_tables.AdminInstancesTable template_name = 'admin/instances/index.html' + page_title = _("All Instances") def has_more_data(self, table): return self._more @@ -152,6 +153,7 @@ class LiveMigrateView(forms.ModalFormView): template_name = 'admin/instances/live_migrate.html' context_object_name = 'instance' success_url = reverse_lazy("horizon:admin:instances:index") + page_title = _("Live Migrate") def get_context_data(self, **kwargs): context = super(LiveMigrateView, self).get_context_data(**kwargs) diff --git a/openstack_dashboard/dashboards/admin/metadata_defs/templates/metadata_defs/create.html b/openstack_dashboard/dashboards/admin/metadata_defs/templates/metadata_defs/create.html index 0f74ec0a78..3039f8481c 100644 --- a/openstack_dashboard/dashboards/admin/metadata_defs/templates/metadata_defs/create.html +++ b/openstack_dashboard/dashboards/admin/metadata_defs/templates/metadata_defs/create.html @@ -2,10 +2,6 @@ {% load i18n %} {% block title %}{% trans "Create a Metadata Namespace" %}{% endblock %} -{% block page_header %} - {% include "horizon/common/_page_header.html" with title=_("Create a Metadata Namespace") %} -{% endblock page_header %} - {% block main %} {% include 'admin/metadata_defs/_create.html' %} {% endblock %} diff --git a/openstack_dashboard/dashboards/admin/metadata_defs/templates/metadata_defs/index.html b/openstack_dashboard/dashboards/admin/metadata_defs/templates/metadata_defs/index.html index 1f0fdd2f4e..8616529976 100644 --- a/openstack_dashboard/dashboards/admin/metadata_defs/templates/metadata_defs/index.html +++ b/openstack_dashboard/dashboards/admin/metadata_defs/templates/metadata_defs/index.html @@ -2,10 +2,6 @@ {% load i18n %} {% block title %}{% trans "Metadata Definitions" %}{% endblock %} -{% block page_header %} - {% include "horizon/common/_page_header.html" with title=_("Metadata Definitions") %} -{% endblock page_header %} - {% block main %} {{ table.render }} {% endblock %} diff --git a/openstack_dashboard/dashboards/admin/metadata_defs/views.py b/openstack_dashboard/dashboards/admin/metadata_defs/views.py index f4d1c45940..305eb3ecc5 100644 --- a/openstack_dashboard/dashboards/admin/metadata_defs/views.py +++ b/openstack_dashboard/dashboards/admin/metadata_defs/views.py @@ -37,6 +37,7 @@ from openstack_dashboard.dashboards.admin.metadata_defs \ class AdminIndexView(tables.DataTableView): table_class = admin_tables.AdminNamespacesTable template_name = constants.METADATA_INDEX_TEMPLATE + page_title = _("Metadata Definitions") def has_prev_data(self, table): return self._prev @@ -82,6 +83,7 @@ class CreateView(forms.ModalFormView): template_name = constants.METADATA_CREATE_TEMPLATE context_object_name = 'namespace' success_url = reverse_lazy(constants.METADATA_INDEX_URL) + page_title = _("Create a Metadata Namespace") class DetailView(tabs.TabView): diff --git a/openstack_dashboard/dashboards/admin/metering/templates/metering/daily.html b/openstack_dashboard/dashboards/admin/metering/templates/metering/daily.html index 89a62ebe44..daa6609aea 100644 --- a/openstack_dashboard/dashboards/admin/metering/templates/metering/daily.html +++ b/openstack_dashboard/dashboards/admin/metering/templates/metering/daily.html @@ -2,10 +2,6 @@ {% load i18n %} {% block title %}{% trans "Modify Usage Report Parameters" %}{% endblock %} -{% block page_header %} - {% include "horizon/common/_page_header.html" with title=_("Modify Usage Report Parameters") %} -{% endblock page_header %} - {% block main %} {% include "admin/metering/_daily.html" %} {% endblock %} diff --git a/openstack_dashboard/dashboards/admin/metering/templates/metering/index.html b/openstack_dashboard/dashboards/admin/metering/templates/metering/index.html index 50d5f80ba4..807ff62918 100644 --- a/openstack_dashboard/dashboards/admin/metering/templates/metering/index.html +++ b/openstack_dashboard/dashboards/admin/metering/templates/metering/index.html @@ -2,10 +2,6 @@ {% load i18n %} {% block title %}{% trans "Resources Usage Overview" %}{% endblock %} -{% block page_header %} - {% include "horizon/common/_page_header.html" with title=_("Resources Usage Overview")%} -{% endblock page_header %} - {% block main %}
diff --git a/openstack_dashboard/dashboards/admin/metering/views.py b/openstack_dashboard/dashboards/admin/metering/views.py index 08d76a6eca..64b8af5666 100644 --- a/openstack_dashboard/dashboards/admin/metering/views.py +++ b/openstack_dashboard/dashboards/admin/metering/views.py @@ -38,12 +38,14 @@ LOG = logging.getLogger(__name__) class IndexView(tabs.TabbedTableView): tab_group_class = metering_tabs.CeilometerOverviewTabs template_name = 'admin/metering/index.html' + page_title = _("Resources Usage Overview") class CreateUsageReport(forms.ModalFormView): form_class = metering_forms.UsageReportForm template_name = 'admin/metering/daily.html' success_url = reverse_lazy('horizon:admin:metering:index') + page_title = _("Modify Usage Report Parameters") class SamplesView(django.views.generic.TemplateView):