Reduce page title duplication in Stacks
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 stacks views. Change-Id: Icff6df155983adeedec59d3aacdd4a0b685cf9a3 Partial-Bug: 1413749
This commit is contained in:
parent
1934a7eaa8
commit
4e9c0c480f
|
@ -2,14 +2,10 @@
|
|||
{% load i18n %}
|
||||
{% block title %}{% trans "Resource Type Details" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Resource Type Details") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
{{ tab_group.render }}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -2,10 +2,6 @@
|
|||
{% load i18n %}
|
||||
{% block title %}{% trans "Resource Types" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Resource Types") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{{ table.render }}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -30,6 +30,7 @@ import openstack_dashboard.dashboards.project.stacks.resource_types.tabs \
|
|||
class ResourceTypesView(tables.DataTableView):
|
||||
table_class = project_tables.ResourceTypesTable
|
||||
template_name = 'project/stacks.resource_types/index.html'
|
||||
page_title = _("Resource Types")
|
||||
|
||||
def get_data(self):
|
||||
try:
|
||||
|
@ -45,6 +46,7 @@ class ResourceTypesView(tables.DataTableView):
|
|||
class DetailView(tabs.TabView):
|
||||
tab_group_class = project_tabs.ResourceTypeDetailsTabs
|
||||
template_name = 'project/stacks.resource_types/details.html'
|
||||
page_title = _("Resource Type Details")
|
||||
|
||||
def get_resource_type(self, request, **kwargs):
|
||||
try:
|
||||
|
|
|
@ -2,11 +2,6 @@
|
|||
{% load i18n %}
|
||||
{% block title %}{% trans "Change Template" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Change Template") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{% include 'project/stacks/_change_template.html' %}
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
@ -2,10 +2,6 @@
|
|||
{% load i18n %}
|
||||
{% block title %}{% trans "Launch Stack" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Launch Stack") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{% include 'project/stacks/_create.html' %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -2,12 +2,6 @@
|
|||
{% load i18n %}
|
||||
{% block title %}{% trans "Stacks" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Stacks") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{{ table.render }}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
|
|
@ -2,10 +2,6 @@
|
|||
{% load i18n %}
|
||||
{% block title %}{% trans "Select Template" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Select Template") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{% include 'project/stacks/_select_template.html' %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -2,10 +2,6 @@
|
|||
{% load i18n %}
|
||||
{% block title %}{% trans "Update Stack Parameters" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Update Stack") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{% include 'project/stacks/_update.html' %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -44,6 +44,7 @@ LOG = logging.getLogger(__name__)
|
|||
class IndexView(tables.DataTableView):
|
||||
table_class = project_tables.StacksTable
|
||||
template_name = 'project/stacks/index.html'
|
||||
page_title = _("Stacks")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(IndexView, self).__init__(*args, **kwargs)
|
||||
|
@ -87,6 +88,7 @@ class SelectTemplateView(forms.ModalFormView):
|
|||
form_class = project_forms.TemplateForm
|
||||
template_name = 'project/stacks/select_template.html'
|
||||
success_url = reverse_lazy('horizon:project:stacks:launch')
|
||||
page_title = _("Select Template")
|
||||
|
||||
def get_form_kwargs(self):
|
||||
kwargs = super(SelectTemplateView, self).get_form_kwargs()
|
||||
|
@ -98,6 +100,7 @@ class ChangeTemplateView(forms.ModalFormView):
|
|||
form_class = project_forms.ChangeTemplateForm
|
||||
template_name = 'project/stacks/change_template.html'
|
||||
success_url = reverse_lazy('horizon:project:stacks:edit_stack')
|
||||
page_title = _("Change Template")
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(ChangeTemplateView, self).get_context_data(**kwargs)
|
||||
|
@ -131,6 +134,7 @@ class CreateStackView(forms.ModalFormView):
|
|||
form_class = project_forms.CreateStackForm
|
||||
template_name = 'project/stacks/create.html'
|
||||
success_url = reverse_lazy('horizon:project:stacks:index')
|
||||
page_title = _("Launch Stack")
|
||||
|
||||
def get_initial(self):
|
||||
initial = {}
|
||||
|
@ -162,6 +166,7 @@ class EditStackView(CreateStackView):
|
|||
form_class = project_forms.EditStackForm
|
||||
template_name = 'project/stacks/update.html'
|
||||
success_url = reverse_lazy('horizon:project:stacks:index')
|
||||
page_title = _("Update Stack")
|
||||
|
||||
def get_initial(self):
|
||||
initial = super(EditStackView, self).get_initial()
|
||||
|
@ -244,14 +249,12 @@ class DetailView(tabs.TabView):
|
|||
class ResourceView(tabs.TabView):
|
||||
tab_group_class = project_tabs.ResourceDetailTabs
|
||||
template_name = 'project/stacks/resource.html'
|
||||
page_title = _("Resource Details: {{ resource.resource_name }}")
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(ResourceView, self).get_context_data(**kwargs)
|
||||
resource = self.get_data(self.request, **kwargs)
|
||||
context["resource"] = resource
|
||||
context["resource"] = self.get_data(self.request, **kwargs)
|
||||
context["metadata"] = self.get_metadata(self.request, **kwargs)
|
||||
context["page_title"] = _("Resource Details: %s") % \
|
||||
getattr(resource, 'resource_name')
|
||||
return context
|
||||
|
||||
@memoized.memoized_method
|
||||
|
|
Loading…
Reference in New Issue