diff options
author | Radomir Dopieralski <openstack@sheep.art.pl> | 2013-10-23 09:57:12 +0200 |
---|---|---|
committer | Radomir Dopieralski <openstack@sheep.art.pl> | 2013-10-23 09:57:12 +0200 |
commit | 851ff4fa4c62e5085e6efe0d83e8095eb945e245 (patch) | |
tree | 553cbd391b8f817dda697137b9b5508a5095144a | |
parent | 887e7459fd9117b6d734f605d19b18e099e34b7d (diff) | |
download | tuskar-ui-851ff4fa4c62e5085e6efe0d83e8095eb945e245.tar.gz |
Make the WorkflowView use tuskar's base template
Make our own WorkflowView that uses our base template, so that
our custom CSS and JS is included. This way the workflows look and
behave correctly when middle-clicked or when JS is disabled.
Change-Id: Iea3b831f461793ce3f41644ca1e1dbb6bab5d309
Closes-bug: #1242624
5 files changed, 24 insertions, 8 deletions
diff --git a/tuskar_ui/infrastructure/resource_management/racks/tests.py b/tuskar_ui/infrastructure/resource_management/racks/tests.py index 5de8f238..b04f3d1f 100644 --- a/tuskar_ui/infrastructure/resource_management/racks/tests.py +++ b/tuskar_ui/infrastructure/resource_management/racks/tests.py @@ -44,7 +44,7 @@ class RackViewTests(test.BaseAdminViewTests): self.assertEqual(rack.status_code, 200) self.assertTemplateUsed(rack, - 'horizon/common/_workflow_base.html') + 'infrastructure/_workflow_base.html') # FIXME (mawagner) - After moving EditRack to use workflows, we need # to circle back and fix these tests. @@ -120,7 +120,7 @@ class RackViewTests(test.BaseAdminViewTests): 'resource_management:racks:edit', args=[1]) res = self.client.get(url) self.assertEqual(res.status_code, 200) - self.assertTemplateUsed(res, 'horizon/common/_workflow_base.html') + self.assertTemplateUsed(res, 'infrastructure/_workflow_base.html') @test.create_stubs({tuskar.Rack: ('get', 'list', 'update', 'list_nodes'), tuskar.ResourceClass: ('list',)}) diff --git a/tuskar_ui/infrastructure/resource_management/racks/views.py b/tuskar_ui/infrastructure/resource_management/racks/views.py index fe506e5b..1a557349 100644 --- a/tuskar_ui/infrastructure/resource_management/racks/views.py +++ b/tuskar_ui/infrastructure/resource_management/racks/views.py @@ -28,19 +28,19 @@ from django.views import generic from horizon import exceptions from horizon import forms as horizon_forms from horizon import tabs as horizon_tabs -from horizon import workflows as horizon_workflows from tuskar_ui import api as tuskar from tuskar_ui.infrastructure.resource_management.racks import forms from tuskar_ui.infrastructure.resource_management.racks import tables from tuskar_ui.infrastructure.resource_management.racks import tabs from tuskar_ui.infrastructure.resource_management.racks import workflows +from tuskar_ui import workflows as tuskar_workflows LOG = logging.getLogger(__name__) -class CreateView(horizon_workflows.WorkflowView): +class CreateView(tuskar_workflows.WorkflowView): workflow_class = workflows.CreateRack def get_initial(self): @@ -60,7 +60,7 @@ class UploadView(horizon_forms.ModalFormView): return context -class EditView(horizon_workflows.WorkflowView): +class EditView(tuskar_workflows.WorkflowView): workflow_class = workflows.EditRack def get_initial(self): diff --git a/tuskar_ui/infrastructure/resource_management/resource_classes/views.py b/tuskar_ui/infrastructure/resource_management/resource_classes/views.py index cafd6a08..3c66151f 100644 --- a/tuskar_ui/infrastructure/resource_management/resource_classes/views.py +++ b/tuskar_ui/infrastructure/resource_management/resource_classes/views.py @@ -26,7 +26,6 @@ from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms as horizon_forms from horizon import tabs as horizon_tabs -from horizon import workflows as horizon_workflows from tuskar_ui import api as tuskar @@ -34,19 +33,20 @@ from tuskar_ui.infrastructure.resource_management.resource_classes import forms from tuskar_ui.infrastructure.resource_management.resource_classes import tabs from tuskar_ui.infrastructure.resource_management.resource_classes\ import workflows +from tuskar_ui import workflows as tuskar_workflows LOG = logging.getLogger(__name__) -class CreateView(horizon_workflows.WorkflowView): +class CreateView(tuskar_workflows.WorkflowView): workflow_class = workflows.CreateResourceClass def get_initial(self): pass -class UpdateView(horizon_workflows.WorkflowView): +class UpdateView(tuskar_workflows.WorkflowView): workflow_class = workflows.UpdateResourceClass def get_context_data(self, **kwargs): diff --git a/tuskar_ui/infrastructure/templates/infrastructure/_workflow_base.html b/tuskar_ui/infrastructure/templates/infrastructure/_workflow_base.html new file mode 100644 index 00000000..5aa1a050 --- /dev/null +++ b/tuskar_ui/infrastructure/templates/infrastructure/_workflow_base.html @@ -0,0 +1,11 @@ +{% extends 'infrastructure/base.html' %} +{% load i18n %} +{% block title %}{% trans workflow.name %}{% endblock %} + +{% block page_header %} + {% include "horizon/common/_page_header.html" with title=workflow.name %} +{% endblock page_header %} + +{% block main %} + {% include 'horizon/common/_workflow.html' %} +{% endblock %} diff --git a/tuskar_ui/workflows.py b/tuskar_ui/workflows.py index 240dafab..62237998 100644 --- a/tuskar_ui/workflows.py +++ b/tuskar_ui/workflows.py @@ -23,6 +23,11 @@ import horizon.workflows LOG = logging.getLogger(__name__) +# A WorkflowView that uses tuskar's base template with additional CSS and JS +class WorkflowView(horizon.workflows.WorkflowView): + template_name = 'infrastructure/_workflow_base.html' + + # FIXME: TableStep class TableStep(horizon.workflows.Step): """ |