Reduce page title duplication in Admin volumes

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 volumes views.

Change-Id: I19f76941a4364261b4d8a067f246919e1ba237de
Partial-Bug: 1413749
This commit is contained in:
Sam Betts 2015-02-10 13:32:49 +00:00
parent 1934a7eaa8
commit 68e59e1f7d
13 changed files with 12 additions and 38 deletions

View File

@ -32,6 +32,7 @@ class UpdateStatusView(forms.ModalFormView):
form_class = vol_snapshot_forms.UpdateStatus
template_name = 'admin/volumes/snapshots/update_status.html'
success_url = reverse_lazy("horizon:admin:volumes:snapshots_tab")
page_title = _("Update Volume Snapshot Status")
@memoized.memoized_method
def get_object(self):

View File

@ -2,14 +2,10 @@
{% load i18n %}
{% block title %}{% trans "Volumes" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Volumes") %}
{% endblock page_header %}
{% block main %}
<div class="row">
<div class="col-sm-12">
{{ tab_group.render }}
</div>
</div>
{% endblock %}
{% endblock %}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Update Volume Snapshot Status" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Update Volume Snapshot Status") %}
{% endblock page_header %}
{% block main %}
{% include 'admin/volumes/snapshots/_update_status.html' %}
{% endblock %}
{% endblock %}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Associate QoS Spec" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Associate QoS Spec with Volume Type") %}
{% endblock page_header %}
{% block main %}
{% include 'admin/volumes/volume_types/qos_specs/_associate_qos_spec.html' %}
{% endblock %}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Create QoS Spec" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Create a QoS Spec") %}
{% endblock page_header %}
{% block main %}
{% include 'admin/volumes/volume_types/_create_qos_spec.html' %}
{% endblock %}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Create Volume Type" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Create a Volume Type") %}
{% endblock page_header %}
{% block main %}
{% include 'admin/volumes/volume_types/_create_volume_type.html' %}
{% endblock %}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Create Encrypted Volume Type" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Create an Encrypted Volume Type") %}
{% endblock page_header %}
{% block main %}
{% include 'admin/volumes/volume_types/_create_volume_type_encryption.html' %}
{% endblock %}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Edit QoS Spec Consumer" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Edit QoS Spec Consumer") %}
{% endblock page_header %}
{% block main %}
{% include 'admin/volumes/volume_types/_edit_qos_spec_consumer.html' %}
{% endblock %}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Volume Type Encryption Details" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Volume Type Encryption Details") %}
{% endblock page_header %}
{% block main %}
<div class="row-fluid">
<div class="col-sm-12">

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Update Volume Status" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Update Volume Status") %}
{% endblock page_header %}
{% block main %}
{% include 'admin/volumes/volumes/_update_status.html' %}
{% endblock %}

View File

@ -15,6 +15,7 @@
"""
Admin views for managing volumes and snapshots.
"""
from django.utils.translation import ugettext_lazy as _
from horizon import tabs
@ -25,3 +26,4 @@ from openstack_dashboard.dashboards.admin.volumes \
class IndexView(tabs.TabbedTableView):
tab_group_class = volumes_tabs.VolumesGroupTabs
template_name = 'admin/volumes/index.html'
page_title = _("Volumes")

View File

@ -34,6 +34,7 @@ class CreateVolumeTypeView(forms.ModalFormView):
form_class = volumes_forms.CreateVolumeType
template_name = 'admin/volumes/volume_types/create_volume_type.html'
success_url = 'horizon:admin:volumes:volume_types_tab'
page_title = _("Create a Volume Type")
def get_success_url(self):
return reverse(self.success_url)
@ -42,6 +43,7 @@ class CreateVolumeTypeView(forms.ModalFormView):
class VolumeTypeEncryptionDetailView(generic.TemplateView):
template_name = ("admin/volumes/volume_types"
"/volume_encryption_type_detail.html")
page_title = _("Volume Type Encryption Details")
def get_context_data(self, **kwargs):
context = super(VolumeTypeEncryptionDetailView, self).\
@ -76,6 +78,7 @@ class CreateVolumeTypeEncryptionView(forms.ModalFormView):
template_name = ("admin/volumes/volume_types/"
"create_volume_type_encryption.html")
success_url = reverse_lazy('horizon:admin:volumes:index')
page_title = _("Create an Encrypted Volume Type")
@memoized.memoized_method
def get_name(self):
@ -106,6 +109,7 @@ class CreateQosSpecView(forms.ModalFormView):
form_class = volumes_forms.CreateQosSpec
template_name = 'admin/volumes/volume_types/create_qos_spec.html'
success_url = 'horizon:admin:volumes:volume_types_tab'
page_title = _("Create a QoS Spec")
def get_success_url(self):
return reverse(self.success_url)
@ -115,6 +119,7 @@ class EditQosSpecConsumerView(forms.ModalFormView):
form_class = volume_types_forms.EditQosSpecConsumer
template_name = 'admin/volumes/volume_types/edit_qos_spec_consumer.html'
success_url = 'horizon:admin:volumes:volume_types_tab'
page_title = _("Edit QoS Spec Consumer")
def get_success_url(self):
return reverse(self.success_url)
@ -147,6 +152,7 @@ class ManageQosSpecAssociationView(forms.ModalFormView):
form_class = volume_types_forms.ManageQosSpecAssociation
template_name = 'admin/volumes/volume_types/associate_qos_spec.html'
success_url = 'horizon:admin:volumes:volume_types_tab'
page_title = _("Associate QoS Spec with Volume Type")
def get_success_url(self):
return reverse(self.success_url)

View File

@ -94,6 +94,7 @@ class UpdateStatusView(forms.ModalFormView):
form_class = volumes_forms.UpdateStatus
template_name = 'admin/volumes/volumes/update_status.html'
success_url = reverse_lazy('horizon:admin:volumes:index')
page_title = _("Update Volume Status")
def get_context_data(self, **kwargs):
context = super(UpdateStatusView, self).get_context_data(**kwargs)