Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1#!/usr/local/bin/python
2# encoding: utf-8
3"""
4*A form to add a new comment to an object ticket in the PESSTO Marshall*
6:Author:
7 David Young
8"""
9import sys
10import os
11import khufu
13def add_new_comment_to_object_form(
14 log,
15 request,
16 transientBucketId
17):
18 """add_new_comment_to_object_form
20 **Key Arguments**
22 - ``log`` -- the logger
23 - ``request`` -- the pyramid request
24 - ``transientBucketId`` -- the transientBucketId of the object
27 **Return**
29 - ``newCommentForm`` -- the new comment form
31 """
32 commentInput = khufu.textarea(
33 rows=1,
34 span=11,
35 placeholder="add a new comment",
36 htmlId="comment" % locals(),
37 required=True
38 )
40 addButton = khufu.button(
41 buttonText='add',
42 # [ default | primary | info | success | warning | danger | inverse | link ]
43 buttonStyle='info',
44 buttonSize='default', # [ large | default | small | mini ]
45 submit=True
46 )
47 transientBucketInput = khufu.formInput(
48 # [ text | password | datetime | datetime-local | date | month | time | week | number | email | url | search | tel | color ]
49 ttype='number',
50 placeholder='',
51 span=2,
52 htmlId='transientBucketId',
53 hidden=True,
54 defaultValue=transientBucketId
55 )
57 commentInput = khufu.controlRow(
58 inputList=[commentInput, transientBucketInput, addButton]
59 )
60 commentCG = khufu.horizontalFormControlGroup(
61 content=commentInput,
62 validationLevel=False
63 )
65 href = request.route_path(
66 'transients_element_comments', elementId=transientBucketId, _query={'method': 'post'})
67 newCommentForm = khufu.form(
68 # list of control groups
69 content="""%(commentCG)s""" % locals(),
70 # [ "inline" | "horizontal" | "search" | "navbar-form" | "navbar-search" ]
71 formType='inline',
72 postToScript=href,
73 redirectUrl=request.path_qs
74 )
76 return newCommentForm