def fields(self): result = [ ew.TextField(name='summary', attrs={'style': 'width: 93.5%;'}), ew.SingleSelectField(name='source_branch', label='Source Branch', options=self.source_branches), ew.SingleSelectField(name='target_branch', label='Target Branch', options=self.target_branches), ffw.MarkdownEdit(name='description') ] return result
def fields(self): result = [ ew.TextField(name='summary'), ew.SingleSelectField(name='source_branch', label='Source Branch', options=self.source_branches), ew.SingleSelectField(name='target_branch', label='Target Branch', options=self.target_branches), ffw.AutoResizeTextarea(name='description') ] return result
def fields(self): # Since @property is readonly we can't modify field values in display() method # Returns fields modified by display() if self._fields: return self._fields list_of_fields = [ ew.SingleSelectField( name='sex', label='Gender', options=[ ew.Option(py_value=v, label=v, selected=False) for v in ['Male', 'Female', 'Unknown', 'Other'] ], validator=formencode.All( V.OneOfValidator(['Male', 'Female', 'Unknown', 'Other']), fev.UnicodeString(not_empty=True))), ew.SingleSelectField( name='country', label='Country of residence', validator=V.MapValidator(country_names, not_empty=False), options=[ ew.Option( py_value=" ", label=" -- Unknown -- ", selected=False) ] + [ ew.Option(py_value=c, label=n, selected=False) for c, n in sorted(country_names.items(), key=lambda (k, v): v) ], attrs={'onchange': 'selectTimezone(this.value)'}), ew.TextField(name='city', label='City of residence', attrs=dict(value=None), validator=fev.UnicodeString(not_empty=False)), ew.SingleSelectField( name='timezone', label='Timezone', attrs={'id': 'tz'}, validator=V.OneOfValidator(common_timezones, not_empty=False), options=[ew.Option(py_value=" ", label=" -- Unknown -- ")] + [ ew.Option(py_value=n, label=n) for n in sorted(common_timezones) ]) ] if asbool(tg.config.get('auth.allow_birth_date', True)): list_of_fields[1:1] = self.birth_date_fields return list_of_fields
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)
class PostFilter(ff.ForgeForm): defaults = dict( ew.SimpleForm.defaults, submit_text=None, method='GET') fields = [ ew.HiddenField( name='page', validator=fev.Int()), ew.FieldSet(label='Post Filter', fields=[ ew.SingleSelectField( name='status', label='Show posts with status', options=[ ew.Option(py_value='-', label='Any'), ew.Option(py_value='spam', label='Spam'), ew.Option(py_value='pending', label='Pending moderation'), ew.Option(py_value='ok', label='Ok')], if_missing='pending'), ew.InputField(name='username', label='Show post filtered by username'), ew.SubmitButton(label='Filter Posts') ]) ]
def fields(self): fields = [ ew.Checkbox(name='EnableVoting', label='Enable voting on tickets'), ew.Checkbox(name='AllowEmailPosting', label='Allow posting replies via email'), ew.TextField(name='TicketMonitoringEmail', label='Email ticket notifications to', validator=fev.Email(), grid_width='7'), ew.SingleSelectField( name='TicketMonitoringType', label='Send notifications for', grid_width='7', options=[ ew.Option(py_value='NewTicketsOnly', label='New tickets only'), ew.Option(py_value='NewPublicTicketsOnly', label='New public tickets only'), ew.Option(py_value='AllTicketChanges', label='All ticket changes'), ew.Option(py_value='AllPublicTicketChanges', label='All public ticket changes'), ]), ffw.MarkdownEdit(name='TicketHelpNew', label='Help text to display on new ticket page', validator=v.String(), attrs={'style': 'width: 95%'}), ffw.MarkdownEdit( name='TicketHelpSearch', label='Help text to display on ticket list pages (index page,' ' search results, milestone lists)', validator=v.String(), attrs={'style': 'width: 95%'}), ] return fields
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)), ])
class CustomFieldAdminDetail(ffw.StateField): template = 'jinja:forgetracker:templates/tracker_widgets/custom_field_admin_detail.html' defaults = dict( ffw.StateField.defaults, selector=ffw.AdminField(field=ew.SingleSelectField( name='type', options=[ ew.Option(py_value='string', label='Text'), ew.Option(py_value='number', label='Number'), ew.Option(py_value='boolean', label='Boolean'), ew.Option(py_value='select', label='Select'), ew.Option(py_value='milestone', label='Milestone'), ew.Option(py_value='user', label='User'), ], )), states=dict( select=ffw.FieldCluster(fields=[ ffw.AdminField(field=ew.TextField( name='options', label= 'Options (separate with spaces; quote if containing spaces; prefix with * to set a default)', )) ], show_labels=False), milestone=ffw.FieldCluster( # name='milestones', fields=[MilestonesAdmin(name='milestones')])))
class fields(ew_core.NameList): weekday = ew.SingleSelectField( label='Weekday', options=[ew.Option(py_value=wd, label=wd) for wd in weekdays], validator=V.OneOfValidator(weekdays)) starttime = ew.TextField(label='Start time', validator=V.TimeValidator()) endtime = ew.TextField(label='End time', validator=V.TimeValidator())
def _milestone(field): options = [] for m in field.milestones: if not m.complete: options.append(ew.Option(label=m.name, py_value=m.name)) ssf = ew.SingleSelectField(label=field.label, name=str(field.name), options=options) return ssf
def _select(field): options = [] for opt in field.options.split(): selected = False if opt.startswith('*'): opt = opt[1:] selected = True options.append(ew.Option(label=opt,html_value=opt,py_value=opt,selected=selected)) return ew.SingleSelectField(label=field.label, name=str(field.name), options=options)
class fields(ew_core.NameList): subscriptions=_SubscriptionTable() email_format = ew.SingleSelectField( name='email_format', label='Email Format', options=[ ew.Option(py_value='plain', label='Plain Text'), ew.Option(py_value='html', label='HTML'), ew.Option(py_value='both', label='Combined')])
class fields(ew_core.NameList): socialnetwork = ew.SingleSelectField( label='Social network', options=[ ew.Option(py_value=name, label=name) for name in socialnetworks ], validator=formencode.All(V.OneOfValidator(socialnetworks), fev.UnicodeString(not_empty=True))) accounturl = ew.TextField(label='Account url', validator=fev.UnicodeString(not_empty=True))
def fields(self): return [ _SubscriptionTable(name='subscriptions'), ew.SingleSelectField( name='email_format', show_label=False, options=[ ew.Option(py_value='plain', label='Plain Text'), ew.Option(py_value='both', label='HTML')]), ]
def fields(self): fields = [ ew.SingleSelectField(name='PostingPolicy', label='Posting Policy', options=[ ew.Option(py_value='ApproveOnceModerated', label='Approve Once Moderated'), ew.Option(py_value='ApproveAll', label='Approve All') ]) ] return fields
class fields(ew_core.NameList): sex = ew.SingleSelectField( label='Gender', options=[ ew.Option(py_value=v, label=v, selected=False) for v in ['Male', 'Female', 'Unknown', 'Other'] ], validator=formencode.All( V.OneOfValidator(['Male', 'Female', 'Unknown', 'Other']), fev.UnicodeString(not_empty=True))) birthdate = ew.TextField(label='Birth date', validator=V.DateValidator(), attrs=dict(value=None)) exp = _HTMLExplanation(text="Use the format DD/MM/YYYY", show_errors=False) country = ew.SingleSelectField( label='Country of residence', validator=V.MapValidator(country_names, not_empty=False), options = [ ew.Option( py_value=" ", label=" -- Unknown -- ", selected=False)] +\ [ew.Option(py_value=c, label=n, selected=False) for c,n in sorted(country_names.items(), key=lambda (k,v):v)], attrs={'onchange':'selectTimezone(this.value)'}) city = ew.TextField(label='City of residence', attrs=dict(value=None), validator=fev.UnicodeString(not_empty=False)) timezone=ew.SingleSelectField( label='Timezone', attrs={'id':'tz'}, validator=V.OneOfValidator(common_timezones, not_empty=False), options=[ ew.Option( py_value=" ", label=" -- Unknown -- ")] + \ [ew.Option(py_value=n, label=n) for n in sorted(common_timezones)])
class fields(ew_core.NameList): weekday = ew.SingleSelectField( label='Weekday', options=[ew.Option(py_value=wd, label=wd) for wd in weekdays], validator=formencode.All(V.OneOfValidator(weekdays), fev.UnicodeString(not_empty=True))) starttime = ew.TextField(label='Start time', validator=formencode.All( V.TimeValidator(), fev.UnicodeString(not_empty=True))) endtime = ew.TextField(label='End time', validator=formencode.All( V.TimeValidator(), fev.UnicodeString(not_empty=True)))
def fields(self): fields = [ ew.SingleSelectField( name='PostingPolicy', label='Posting Policy', options=[ ew.Option(py_value='ApproveOnceModerated', label='Approve Once Moderated'), ew.Option(py_value='ApproveAll', label='Approve All')]), ew.Checkbox( name='AllowEmailPosting', label='Allow posting replies via email') ] return fields
def fields(self): socialnetworks = aslist( tg.config.get('socialnetworks', ['Facebook', 'Linkedin', 'Twitter', 'Google+']), ',') return [ ew.SingleSelectField(name='socialnetwork', label='Social network', validator=fev.UnicodeString(not_empty=True), options=[ ew.Option(py_value=name, label=name) for name in socialnetworks ]), ew.TextField(name='accounturl', label='Account url', validator=fev.UnicodeString(not_empty=True)) ]
def fields(self): return [ ew.SingleSelectField(name='grant', label='Award', options=self.award_options()), ffw.NeighborhoodProjectSelect(self._project_select_url, name='recipient'), ew.TextField(name='url', label='Award URL', validator=fev.URL()), ew.TextArea(name='comment', label='Comment', validator=fev.UnicodeString(not_empty=False), attrs={ 'rows': 5, 'cols': 30 }), ]
class fields(ew_core.NameList): title = ew.TextField(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')) text = ffw.MarkdownEdit(show_label=False, attrs=dict( placeholder='Enter your content here', title='Enter your content here')) state = ew.SingleSelectField(options=[ ew.Option(py_value='draft', label='Draft'), ew.Option(py_value='published', label='Published') ]) labels = ffw.LabelEdit(placeholder='Add labels here', title='Add labels here')
def fields(self): search_fields = [ew.Option(py_value=v, label=l) for v, l in self._fields] search_fields.append(ew.Option(py_value='__custom__', label='custom query')) return [ ew.RowField(fields=[ ew.SingleSelectField( name='f', show_label=False, options=search_fields), ew.InputField(name='q', show_label=False, attrs={'style': 'width: 600px'}), ew.SubmitButton( show_label=False, attrs={ 'value': 'Search', 'style': 'float:none; margin-top:3px;', }, show_errors=False), ])]
class fields(ew_core.NameList): selected_skill = ew.HiddenField( attrs={'value': ''}, show_errors=False, validator=V.UnicodeString(not_empty=True)) level = ew.SingleSelectField( label="Level of knowledge", options=[ ew.Option(py_value="low", label="Low level"), ew.Option(py_value="medium", label="Medium level"), ew.Option(py_value="high", label="Advanced level")], validator=formencode.All( V.OneOfValidator(['low', 'medium', 'high']), V.UnicodeString(not_empty=True))) comment = ew.TextArea( label="Additional comments", validator=V.UnicodeString(not_empty=False), attrs={'rows': 5, 'cols': 30})
def _select(field): options = [] field_options = h.really_unicode(field.options) try: # shlex have problems with parsing unicode, # it's better to pass properly encoded byte-string field_options = shlex.split(field_options.encode('utf-8')) # convert splitted string back to unicode field_options = map(h.really_unicode, field_options) except ValueError: field_options = field_options.split() # After regular split field_options might contain a " characters, # which would break html when rendered inside tag's value attr. # Escaping doesn't help here, 'cause it breaks EasyWidgets' validation, # so we're getting rid of those. field_options = [o.replace('"', '') for o in field_options] for opt in field_options: selected = False if opt.startswith('*'): opt = opt[1:] selected = True options.append(ew.Option(label=opt,html_value=opt,py_value=opt,selected=selected)) return ew.SingleSelectField(label=field.label, name=str(field.name), options=options)
class fields(ew_core.NameList): tracker = ew.SingleSelectField(label='Tracker mount point', options=[])
class fields(ew_core.NameList): status = ew.SingleSelectField(label='Change Status', options=M.MergeRequest.statuses)
class fields(ew_core.NameList): selected_category = ew.SingleSelectField(name="selected_category", label="Available categories", options=[])