Reduce page title duplication in databases

Patch https://review.openstack.org/#/c/142802 adds a method of
reducing duplication of page title logic, this patch applies that change
to the project databases and database backups views.

Change-Id: I06f512f0bea34c5f70106a9f3c13a0279fcd2aac
Partial-Bug: 1413749
This commit is contained in:
Sam Betts 2015-02-10 13:41:24 +00:00
parent 1934a7eaa8
commit a1ffe755ee
8 changed files with 8 additions and 26 deletions

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Backup Database" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Backup Database") %}
{% endblock page_header %}
{% block main %}
{% include 'horizon/common/_workflow.html' %}
{% endblock %}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Database Backups" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Backups") %}
{% endblock page_header %}
{% block main %}
{{ table.render }}
{% endblock %}

View File

@ -32,6 +32,7 @@ from openstack_dashboard.dashboards.project.database_backups import workflows
class IndexView(horizon_tables.DataTableView):
table_class = tables.BackupsTable
template_name = 'project/database_backups/index.html'
page_title = _("Backups")
def _get_extra_data(self, backup):
"""Apply extra info to the backup."""
@ -65,6 +66,7 @@ class IndexView(horizon_tables.DataTableView):
class BackupView(horizon_workflows.WorkflowView):
workflow_class = workflows.CreateBackup
template_name = "project/database_backups/backup.html"
page_title = _("Backup Database")
def get_context_data(self, **kwargs):
context = super(BackupView, self).get_context_data(**kwargs)

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Instances" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Instances") %}
{% endblock page_header %}
{% block main %}
{{ table.render }}
{% endblock %}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Launch Instance" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Launch Database") %}
{% endblock page_header %}
{% block main %}
{% include 'horizon/common/_workflow.html' %}
{% endblock %}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Resize Database Instance" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Resize Database Instance") %}
{% endblock %}
{% block main %}
{% include "project/databases/_resize_instance.html" %}
{% endblock %}
{% endblock %}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Resize Database Volume" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Resize Database Volume") %}
{% endblock %}
{% block main %}
{% include "project/databases/_resize_volume.html" %}
{% endblock %}
{% endblock %}

View File

@ -45,6 +45,7 @@ LOG = logging.getLogger(__name__)
class IndexView(horizon_tables.DataTableView):
table_class = tables.InstancesTable
template_name = 'project/databases/index.html'
page_title = _("Instances")
def has_more_data(self, table):
return self._more
@ -85,6 +86,7 @@ class IndexView(horizon_tables.DataTableView):
class LaunchInstanceView(horizon_workflows.WorkflowView):
workflow_class = workflows.LaunchInstance
template_name = "project/databases/launch.html"
page_title = _("Launch Database")
def get_initial(self):
initial = super(LaunchInstanceView, self).get_initial()
@ -140,6 +142,7 @@ class ResizeVolumeView(horizon_forms.ModalFormView):
form_class = forms.ResizeVolumeForm
template_name = 'project/databases/resize_volume.html'
success_url = reverse_lazy('horizon:project:databases:index')
page_title = _("Resize Database Volume")
@memoized.memoized_method
def get_object(self, *args, **kwargs):
@ -166,6 +169,7 @@ class ResizeInstanceView(horizon_forms.ModalFormView):
form_class = forms.ResizeInstanceForm
template_name = 'project/databases/resize_instance.html'
success_url = reverse_lazy('horizon:project:databases:index')
page_title = _("Resize Database Instance")
@memoized.memoized_method
def get_object(self, *args, **kwargs):