Reduce page title duplication in Admin networking

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 networks and routers views.

Change-Id: Ie725775d8ac9279f9abe21e3afa47854064b6512
Partial-Bug: 1413749
This commit is contained in:
Sam Betts 2015-02-10 13:31:13 +00:00
parent 673bfed6c8
commit 6fdd220d67
12 changed files with 6 additions and 38 deletions

View File

@ -28,12 +28,12 @@ from openstack_dashboard.dashboards.admin.networks.agents \
class AddView(forms.ModalFormView):
form_class = project_forms.AddDHCPAgent
form_id = "add_dhcp_agent_form"
modal_header = _("Add DHCP Agent")
template_name = 'admin/networks/agents/add.html'
success_url = 'horizon:admin:networks:detail'
failure_url = 'horizon:admin:networks:detail'
submit_label = _("Add DHCP Agent")
submit_url = "horizon:admin:networks:adddhcpagent"
title_and_label = _("Add DHCP Agent")
submit_label = modal_header = page_title = title_and_label
def get_success_url(self):
return reverse(self.success_url,

View File

@ -32,6 +32,7 @@ class CreateView(forms.ModalFormView):
template_name = 'admin/networks/ports/create.html'
success_url = 'horizon:admin:networks:detail'
failure_url = 'horizon:admin:networks:detail'
page_title = _("Create Port")
def get_success_url(self):
return reverse(self.success_url,

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Add DHCP Agent" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Add DHCP Agent") %}
{% endblock page_header %}
{% block main %}
{% include "admin/networks/agents/_add.html" %}
{% endblock %}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Create Network" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Create Network") %}
{% endblock page_header %}
{% block main %}
{% include "admin/networks/_create.html" %}
{% endblock %}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Networks" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Networks") %}
{% endblock page_header %}
{% block main %}
<div id="networks">
{{ networks_table.render }}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Create Port" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Create Port") %}
{% endblock page_header %}
{% block main %}
{% include "admin/networks/ports/_create.html" %}
{% endblock %}

View File

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

View File

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

View File

@ -39,6 +39,7 @@ from openstack_dashboard.dashboards.admin.networks \
class IndexView(tables.DataTableView):
table_class = networks_tables.NetworksTable
template_name = 'admin/networks/index.html'
page_title = _("Networks")
@memoized.memoized_method
def _get_tenant_list(self):
@ -94,6 +95,7 @@ class CreateView(forms.ModalFormView):
form_class = project_forms.CreateNetwork
template_name = 'admin/networks/create.html'
success_url = reverse_lazy('horizon:admin:networks:index')
page_title = _("Create Network")
class DetailView(tables.MultiTableView):
@ -101,6 +103,7 @@ class DetailView(tables.MultiTableView):
ports_tables.PortsTable,
agents_tables.DHCPAgentsTable)
template_name = 'project/networks/detail.html'
page_title = _("Network Details: {{ network.name }}")
def get_subnets_data(self):
try:

View File

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

View File

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

View File

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