Mercurial > libervia-web
comparison src/pages/tickets/new/page_meta.py @ 971:6e966ef8d69f
page(tickets/new): use string instead of textbox for labels, and use comma to split them
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 09 Nov 2017 08:02:49 +0100 |
parents | bc28b9068f91 |
children | 2e75dc986e03 |
comparison
equal
deleted
inserted
replaced
970:bc28b9068f91 | 971:6e966ef8d69f |
---|---|
20 schema = yield self.host.bridge.ticketsSchemaGet(service.full(), node, profile) | 20 schema = yield self.host.bridge.ticketsSchemaGet(service.full(), node, profile) |
21 data['schema'] = schema | 21 data['schema'] = schema |
22 # following fields are handled in backend | 22 # following fields are handled in backend |
23 ignore = ('reporter', 'created', 'updated', 'comments_uri', 'status') | 23 ignore = ('reporter', 'created', 'updated', 'comments_uri', 'status') |
24 xmlui_obj = template_xmlui.create(self.host, schema, ignore=ignore) | 24 xmlui_obj = template_xmlui.create(self.host, schema, ignore=ignore) |
25 try: | |
26 # small trick to get a one line text input instead of the big textarea | |
27 xmlui_obj.widgets[u'labels'].type = u'string' | |
28 except KeyError: | |
29 pass | |
25 request.template_data[u'new_ticket_xmlui'] = xmlui_obj | 30 request.template_data[u'new_ticket_xmlui'] = xmlui_obj |
26 | 31 |
27 @defer.inlineCallbacks | 32 @defer.inlineCallbacks |
28 def on_data_post(self, request): | 33 def on_data_post(self, request): |
29 data = self.getRData(request) | 34 data = self.getRData(request) |
30 service = data['service'] | 35 service = data['service'] |
31 node = data['node'] | 36 node = data['node'] |
32 posted_data = self.getAllPostedData(request) | 37 posted_data = self.getAllPostedData(request) |
33 if not posted_data['title']: | 38 if not posted_data['title']: |
34 self.pageError(request, C.HTTP_BAD_REQUEST) | 39 self.pageError(request, C.HTTP_BAD_REQUEST) |
40 try: | |
41 posted_data['labels'] = [l.strip() for l in posted_data['labels'][0].split(',')] | |
42 except (KeyError, IndexError): | |
43 pass | |
35 profile = self.getProfile(request) | 44 profile = self.getProfile(request) |
36 yield self.host.bridge.ticketsSet(service.full(), node, posted_data, u'', u'', {}, profile) | 45 yield self.host.bridge.ticketsSet(service.full(), node, posted_data, u'', u'', {}, profile) |
37 # we don't want to redirect to creation page on success, but to tickets list | 46 # we don't want to redirect to creation page on success, but to tickets list |
38 data['post_redirect_page'] = (self.getPageByName(u'tickets_list'), | 47 data['post_redirect_page'] = (self.getPageByName(u'tickets_list'), |
39 service.full(), | 48 service.full(), |