Reduce title duplication, concatenation in Project Shares
Set the page title in the view, performing concatenation as needed in a translatable way. This parallels fixes made in horizon to bugs 1394573 and 1413749
This commit is contained in:
@@ -32,6 +32,7 @@ class UpdateView(forms.ModalFormView):
|
||||
template_name = "project/shares/security_services/update.html"
|
||||
form_class = sec_services_forms.Update
|
||||
success_url = 'horizon:project:shares:index'
|
||||
page_title = _('Edit Security Service')
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse(self.success_url)
|
||||
@@ -65,6 +66,7 @@ class CreateView(forms.ModalFormView):
|
||||
template_name = ('project/shares/security_services'
|
||||
'/create_security_service.html')
|
||||
success_url = 'horizon:project:shares:index'
|
||||
page_title = _('Create a Security Service')
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse(self.success_url)
|
||||
@@ -75,6 +77,7 @@ class AddSecurityServiceView(forms.ModalFormView):
|
||||
template_name = ('project/shares/security_services'
|
||||
'/add_security_service.html')
|
||||
success_url = 'horizon:project:shares:index'
|
||||
page_title = _('Add Security Service')
|
||||
|
||||
def get_object(self):
|
||||
if not hasattr(self, "_object"):
|
||||
@@ -110,6 +113,9 @@ class Detail(tabs.TabView):
|
||||
context["sec_service"] = sec_service
|
||||
sec_service_display_name = sec_service.name or sec_service.id
|
||||
context["sec_service_display_name"] = sec_service_display_name
|
||||
context["page_title"] = _("Security Service Details: "
|
||||
"%(service_display_name)s") % \
|
||||
{'service_display_name': sec_service_display_name}
|
||||
return context
|
||||
|
||||
def get_data(self):
|
||||
|
@@ -36,6 +36,7 @@ class Update(workflows.WorkflowView):
|
||||
workflow_class = share_net_workflows.UpdateShareNetworkWorkflow
|
||||
template_name = "project/shares/share_networks/share_network_update.html"
|
||||
success_url = 'horizon:project:shares:index'
|
||||
page_title = _('Update Share Network')
|
||||
|
||||
def get_initial(self):
|
||||
return {'id': self.kwargs["share_network_id"]}
|
||||
@@ -50,6 +51,7 @@ class Create(forms.ModalFormView):
|
||||
form_class = share_net_forms.Create
|
||||
template_name = 'project/shares/share_networks/create_share_network.html'
|
||||
success_url = 'horizon:project:shares:index'
|
||||
page_title = _('Create Share Network')
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse(self.success_url)
|
||||
@@ -65,6 +67,9 @@ class Detail(tabs.TabView):
|
||||
share_network_display_name = share_network.name or share_network.id
|
||||
context["share_network"] = share_network
|
||||
context["share_network_display_name"] = share_network_display_name
|
||||
context["page_title"] = _("Share Network Details: "
|
||||
"%(network_display_name)s") % \
|
||||
{'network_display_name': share_network_display_name}
|
||||
return context
|
||||
|
||||
def get_data(self):
|
||||
|
@@ -64,6 +64,9 @@ class DetailView(tabs.TabView):
|
||||
share_display_name = share.name or share.id
|
||||
context["share"] = share
|
||||
context["share_display_name"] = share_display_name
|
||||
context["page_title"] = _("Share Details: "
|
||||
"%(share_display_name)s") % \
|
||||
{'share_display_name': share_display_name}
|
||||
return context
|
||||
|
||||
@memoized.memoized_method
|
||||
@@ -88,6 +91,7 @@ class CreateView(forms.ModalFormView):
|
||||
form_class = share_form.CreateForm
|
||||
template_name = 'project/shares/shares/create.html'
|
||||
success_url = reverse_lazy("horizon:project:shares:index")
|
||||
page_title = _('Create a Share')
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(CreateView, self).get_context_data(**kwargs)
|
||||
@@ -102,6 +106,7 @@ class UpdateView(forms.ModalFormView):
|
||||
form_class = share_form.UpdateForm
|
||||
template_name = 'project/shares/shares/update.html'
|
||||
success_url = reverse_lazy("horizon:project:shares:index")
|
||||
page_title = _('Edit Share')
|
||||
|
||||
def get_object(self):
|
||||
if not hasattr(self, "_object"):
|
||||
@@ -130,6 +135,7 @@ class UpdateMetadataView(forms.ModalFormView):
|
||||
form_class = share_form.UpdateMetadataForm
|
||||
template_name = 'project/shares/shares/update_metadata.html'
|
||||
success_url = reverse_lazy("horizon:project:shares:index")
|
||||
page_title = _('Edit Share Metadata')
|
||||
|
||||
def get_object(self):
|
||||
if not hasattr(self, "_object"):
|
||||
@@ -156,6 +162,7 @@ class UpdateMetadataView(forms.ModalFormView):
|
||||
class AddRuleView(forms.ModalFormView):
|
||||
form_class = share_form.AddRule
|
||||
template_name = 'project/shares/shares/rule_add.html'
|
||||
page_title = _('Add Rule')
|
||||
|
||||
def get_object(self):
|
||||
if not hasattr(self, "_object"):
|
||||
@@ -193,6 +200,9 @@ class ManageRulesView(tables.DataTableView):
|
||||
share = manila.share_get(self.request, self.kwargs['share_id'])
|
||||
context['share_display_name'] = share.name or share.id
|
||||
context["share"] = self.get_data()
|
||||
context["page_title"] = _("Share Rules: "
|
||||
"%(share_display_name)s") % \
|
||||
{'share_display_name': context['share_display_name']}
|
||||
return context
|
||||
|
||||
@memoized.memoized_method
|
||||
|
@@ -40,6 +40,9 @@ class SnapshotDetailView(tabs.TabView):
|
||||
snapshot_display_name = snapshot.name or snapshot.id
|
||||
context["snapshot"] = snapshot
|
||||
context["snapshot_display_name"] = snapshot_display_name
|
||||
context["page_title"] = _("Snapshot Details: "
|
||||
"%(snapshot_display_name)s") % \
|
||||
{'snapshot_display_name': snapshot_display_name}
|
||||
return context
|
||||
|
||||
@memoized.memoized_method
|
||||
@@ -65,6 +68,7 @@ class CreateSnapshotView(forms.ModalFormView):
|
||||
form_class = snapshot_forms.CreateSnapshotForm
|
||||
template_name = 'project/shares/snapshots/create_snapshot.html'
|
||||
success_url = reverse_lazy("horizon:project:shares:index")
|
||||
page_title = _('Create Share Snapshot')
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(CreateSnapshotView, self).get_context_data(**kwargs)
|
||||
|
@@ -2,10 +2,6 @@
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Shares" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Shares") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
|
@@ -2,10 +2,6 @@
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Create Security Service" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Add Security Service") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{% include 'project/shares/security_services/_add_security_service.html' %}
|
||||
{% endblock %}
|
||||
|
@@ -2,10 +2,6 @@
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Create Security Service" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Create a Security Service") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{% include 'project/shares/security_services/_create_security_service.html' %}
|
||||
{% endblock %}
|
||||
|
@@ -2,10 +2,6 @@
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Security Service Details" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Security Service Details: ")|add:sec_service_display_name|default:_("Security Service Details:") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
|
@@ -2,10 +2,6 @@
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Edit Security Service" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Edit Security Service") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{% include 'project/shares/security_services/_update.html' %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@@ -2,10 +2,6 @@
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Create Share Network" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Create Share Network") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{% include 'project/shares/share_networks/_create_share_network.html' %}
|
||||
{% endblock %}
|
||||
|
@@ -2,10 +2,6 @@
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Share Details" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Share Network Details: ")|add:share_network_display_name|default:_("Share Network Details:") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
|
@@ -2,10 +2,6 @@
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Update share network" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Update Share Network") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{% include 'horizon/common/_workflow.html' %}
|
||||
{% endblock %}
|
||||
|
@@ -2,10 +2,6 @@
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Create Share" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Create a Share") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{% include 'project/shares/shares/_create.html' %}
|
||||
{% endblock %}
|
||||
|
@@ -2,10 +2,6 @@
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Share Details" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Share Details: ")|add:share_display_name|default:_("Share Details:") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
|
@@ -2,10 +2,6 @@
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Share Rules" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Share Rules: ")|add:share_display_name|default:_("Share Details:") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{{ table.render }}
|
||||
{% endblock %}
|
||||
|
@@ -2,10 +2,6 @@
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Add Rule" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Add Rule") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{% include 'project/shares/shares/_rule_add.html' %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@@ -2,10 +2,6 @@
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Edit Share" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Edit Share") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{% include 'project/shares/shares/_update.html' %}
|
||||
{% endblock %}
|
||||
|
@@ -2,10 +2,6 @@
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Edit Share Metadata" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Edit Share Metadata") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{% include 'project/shares/shares/_update_metadata.html' %}
|
||||
{% endblock %}
|
||||
|
@@ -2,10 +2,6 @@
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Create Share Snapshot" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Create Share Snapshot") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{% include 'project/shares/snapshots/_create_snapshot.html' %}
|
||||
{% endblock %}
|
||||
|
@@ -2,10 +2,6 @@
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Snapshot Details" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Snapshot Details: ")|add:snapshot_display_name|default:_("Snapshot Details:") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
|
@@ -18,7 +18,7 @@
|
||||
Views for managing shares.
|
||||
"""
|
||||
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from horizon import tabs
|
||||
|
||||
from manila_ui.dashboards.project.shares.security_services \
|
||||
@@ -43,3 +43,4 @@ class ShareTabs(tabs.TabGroup):
|
||||
class IndexView(tabs.TabbedTableView):
|
||||
tab_group_class = ShareTabs
|
||||
template_name = "project/shares/index.html"
|
||||
page_title = _("Shares")
|
||||
|
Reference in New Issue
Block a user