changeset 973:2e75dc986e03

pages (tickets): URLs for list and new are set in the template for the whole subhierarchy
author Goffi <goffi@goffi.org>
date Fri, 10 Nov 2017 13:32:57 +0100
parents c4e58c4dba75
children 4aa38c49bff7
files src/pages/tickets/new/page_meta.py src/pages/tickets/page_meta.py
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/pages/tickets/new/page_meta.py	Fri Nov 10 11:10:15 2017 +0100
+++ b/src/pages/tickets/new/page_meta.py	Fri Nov 10 13:32:57 2017 +0100
@@ -8,6 +8,7 @@
 log = getLogger('pages/ticket')
 """ticket handling pages"""
 
+name = u'tickets_new'
 access = C.PAGES_ACCESS_PROFILE
 template = u"ticket/create.html"
 
@@ -15,6 +16,7 @@
 @defer.inlineCallbacks
 def prepare_render(self, request):
     data = self.getRData(request)
+    template_data = request.template_data
     service, node = data.get(u'service', u''), data.get(u'node', u'')
     profile = self.getProfile(request)
     schema = yield self.host.bridge.ticketsSchemaGet(service.full(), node, profile)
@@ -27,7 +29,7 @@
         xmlui_obj.widgets[u'labels'].type = u'string'
     except KeyError:
         pass
-    request.template_data[u'new_ticket_xmlui'] = xmlui_obj
+    template_data[u'new_ticket_xmlui'] = xmlui_obj
 
 @defer.inlineCallbacks
 def on_data_post(self, request):
--- a/src/pages/tickets/page_meta.py	Fri Nov 10 11:10:15 2017 +0100
+++ b/src/pages/tickets/page_meta.py	Fri Nov 10 13:32:57 2017 +0100
@@ -42,10 +42,12 @@
             node = u''
 
     data = self.getRData(request)
-
     data['service'] = service
     data['node'] = node
 
+    template_data = request.template_data
+    template_data[u'url_tickets_list'] = self.getPageByName('tickets_list').getURL(service.full(), node or u'@')
+    template_data[u'url_tickets_new'] = u'/' + ('/'.join(request.prepath + ['new']).decode('utf-8'))
 
 @defer.inlineCallbacks
 def prepare_render(self, request):