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.ProjectUserCombo(name='assigned_to', label='Owner'),
         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', attrs={'multiple': 'True'}, 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)),
     ]
     # 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)
示例#2
0
 def fields(self):
     return ew_core.NameList([
         ew.TextField(name='title',
                      validator=fev.UnicodeString(
                          not_empty=True,
                          messages={'empty': "You must provide a Title"}),
                      attrs=dict(placeholder='Enter your title here',
                                 title='Enter your title here',
                                 style='width: 425px')),
         ffw.MarkdownEdit(name='text',
                          show_label=False,
                          attrs=dict(placeholder='Enter your content here',
                                     title='Enter your content here')),
         ew.SingleSelectField(name='state',
                              options=[
                                  ew.Option(py_value='draft',
                                            label='Draft'),
                                  ew.Option(py_value='published',
                                            label='Published')
                              ]),
         ffw.LabelEdit(name='labels',
                       placeholder='Add labels here',
                       title='Add labels here'),
         ew.InputField(
             name='attachment',
             label='Attachment',
             field_type='file',
             attrs={'multiple': 'True'},
             validator=fev.FieldStorageUploadConverter(if_missing=None)),
     ])
示例#3
0
文件: forms.py 项目: xmonader/allura
    def fields(self):
        provider = plugin.ProjectRegistrationProvider.get()
        tools_options = []
        for ep, tool in six.iteritems(g.entry_points["tool"]):
            if tool.status == 'production' and tool._installable(tool_name=ep,
                                                                 nbhd=c.project.neighborhood,
                                                                 project_tools=[]):
                tools_options.append(ew.Option(label=tool.tool_label, html_value=ep))

        return ew_core.NameList([
            ew.HiddenField(name='project_description', label='Public Description'),
            ew.HiddenField(name='neighborhood', label='Neighborhood'),
            ew.Checkbox(name='private_project', label="", attrs={'class': 'unlabeled'}),
            ew.InputField(name='project_name', label='Project Name',
                          field_type='text',
                          validator=formencode.All(
                              V.UnicodeString(not_empty=True, max=40),
                              V.MaxBytesValidator(max=40)),
                          ),
            ew.InputField(name='project_unixname',
                          label='Short Name', field_type='text',
                          attrs={
                              'title': 'Create a URL name that matches your project name as closely as possible to improve search indexing and maximize visibility.',
                              'class': 'tooltip'
                          },
                          validator=provider.shortname_validator),
            ew.CheckboxSet(name='tools', options=tools_options),
        ])
示例#4
0
 def buttons(self):
     # add things after the default submit button
     fields = ew_core.NameList()
     if self.show_subscribe_checkbox:
         fields.append(
             ew.Checkbox(name='subscribe',
                         label='Subscribe to this merge request',
                         value=True,
                         attrs={'class': 'subscribe-checkbox'}))
     return fields
示例#5
0
 def fields(self):
     fields = ew_core.NameList()
     fields.append(ffw.MarkdownEdit(name='text'))
     fields.append(ew.HiddenField(name='forum', if_missing=None))
     if ew_core.widget_context.widget:
         # we are being displayed
         if ew_core.widget_context.render_context.get('show_subject', self.show_subject):
             fields.append(
                 ew.TextField(name='subject', attrs=dict(style="width:97%")))
     else:
         # We are being validated
         validator = fev.UnicodeString(not_empty=True, if_missing='')
         fields.append(ew.TextField(name='subject', validator=validator))
         fields.append(NullValidator(name=self.att_name))
     return fields
示例#6
0
 def fields(self):
     fields = ew_core.NameList(super(TicketForm, self).fields)
     if c.app.globals.custom_fields:
         fields.append(TicketCustomFields(name="custom_fields"))
     return fields