def fields(self):
     fields = [
         ew.TextField(name='summary', label='Title',
             attrs={'style':'width: 425px','placeholder':'Title'},
             validator=fev.UnicodeString(not_empty=True, messages={'empty':"You must provide a Title"})),
         ffw.MarkdownEdit(label='Description',name='description',
                 attrs={'style':'width: 95%'}),
         ew.SingleSelectField(name='status', label='Status',
             options=lambda: c.app.globals.all_status_names.split()),
         ffw.ProjectUserSelect(name='assigned_to', label='Assigned To'),
         ffw.LabelEdit(label='Labels',name='labels', className='ticket_form_tags'),
         ew.Checkbox(name='private', label='Mark as Private', attrs={'class':'unlabeled'}),
         ew.InputField(name='attachment', label='Attachment', field_type='file', validator=fev.FieldStorageUploadConverter(if_missing=None)),
         ffw.MarkdownEdit(name='comment', label='Comment',
                     attrs={'style':'min-height:7em; width:97%'}),
         ew.SubmitButton(label=self.submit_text,name='submit',
             attrs={'class':"ui-button ui-widget ui-state-default ui-button-text-only"}),
         ew.HiddenField(name='ticket_num', validator=fev.Int(if_missing=None)),
         ew.HiddenField(name='super_id', validator=fev.UnicodeString(if_missing=None)) ]
     # milestone is kind of special because of the layout
     # add it to the main form rather than handle with the other customs
     if c.app.globals.custom_fields:
         for cf in c.app.globals.custom_fields:
             if cf.name == '_milestone':
                 fields.append(TicketCustomField.make(cf))
                 break
     return ew_core.NameList(fields)
Esempio n. 2
0
 def edit(self):
     page_exists = self.page
     if self.page:
         require_access(self.page, 'edit')
         page = self.page
     else:
         page = self.fake_page()
     c.markdown_editor = W.markdown_editor
     c.user_select = ffw.ProjectUserSelect()
     c.attachment_add = W.attachment_add
     c.attachment_list = W.attachment_list
     c.label_edit = W.label_edit
     hide_left_bar = not c.app.show_left_bar
     return dict(page=page, page_exists=page_exists,
         hide_left_bar=hide_left_bar)
Esempio n. 3
0
 def _user(field):
     return ffw.ProjectUserSelect(label=field.label, name=str(field.name))