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)
Beispiel #2
0
    def display(self, **kw):
        weekday = kw.get('weekday', '')
        starttime = kw.get('starttime')
        endtime = kw.get('endtime')

        self.fields = [
            ew.RowField(show_errors=False,
                        show_label=False,
                        fields=[
                            ffw.DisplayOnlyField(name='weekday',
                                                 attrs={'value': weekday},
                                                 show_errors=False),
                            ffw.DisplayOnlyField(
                                name='starttime',
                                attrs={'value': starttime.strftime('%H:%M')},
                                show_errors=False),
                            ffw.DisplayOnlyField(
                                name='endtime',
                                attrs={'value': endtime.strftime('%H:%M')},
                                show_errors=False),
                            ew.SubmitButton(show_errors=False,
                                            attrs={'value': 'Remove'})
                        ])
        ]
        return super(ForgeForm, self).display(**kw)
Beispiel #3
0
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')
        ])
    ]
Beispiel #4
0
    def display(self, **kw):
        initial_value = kw.get('value', '')
        label = kw.get('label', '')
        description = kw.get('description')

        self.fields = [
            ew.RowField(
                show_errors=False,
                fields=[
                    ffw.DisplayOnlyField(text=label),
                    ffw.DisplayOnlyField(
                        name='oldvalue',
                        label=initial_value,
                        attrs={'value': initial_value},
                        show_errors=False),
                    ew.SubmitButton(
                        show_label=False,
                        attrs={'value': 'Remove'},
                        show_errors=False)])]
        if description:
            self.fields.append(
                _HTMLExplanation(
                    text=description,
                    show_errors=False))
        return super(ForgeForm, self).display(**kw)
Beispiel #5
0
class ModeratePost(ew.SimpleForm):
    submit_text = None
    fields = [
        ew.FieldSet(legend='Promote post to its own thread',
                    fields=[
                        ew.TextField(name='subject', label='Thread title'),
                        ew.SubmitButton(name='promote',
                                        label='Promote to thread')
                    ])
    ]
Beispiel #6
0
 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),
         ])]
Beispiel #7
0
    def display(self, **kw):
        cat = kw.get('category')

        self.fields = [
            ew.RowField(show_errors=False,
                        show_label=False,
                        fields=[
                            ew.LinkField(text=cat.fullname,
                                         href="/categories/%s" %
                                         cat.trove_cat_id),
                            ew.SubmitButton(show_errors=False,
                                            attrs={'value': 'Remove'})
                        ],
                        hidden_fields=[
                            ew.HiddenField(name='categoryid',
                                           attrs={'value': cat.trove_cat_id})
                        ])
        ]
        return super(ForgeForm, self).display(**kw)
Beispiel #8
0
    def display(self, **kw):
        account = kw.get('account', '')
        socialnetwork = kw.get('socialnetwork', '')

        self.fields = [
            ew.RowField(show_errors=False,
                        fields=[
                            ffw.DisplayOnlyField(
                                text='%s account' % socialnetwork,
                                name="socialnetwork",
                                attrs={'value': socialnetwork},
                                show_errors=False),
                            ffw.DisplayOnlyField(name="account",
                                                 attrs={'value': account},
                                                 show_errors=False),
                            ew.SubmitButton(show_label=False,
                                            attrs={'value': 'Remove'},
                                            show_errors=False)
                        ])
        ]
        return super(ForgeForm, self).display(**kw)
Beispiel #9
0
    def display(self, **kw):
        startdate = kw.get('startdate')
        enddate = kw.get('enddate')

        self.fields = [
            ew.RowField(
                show_label=False,
                show_errors=False,
                fields=[
                    ffw.DisplayOnlyField(
                        name='startdate',
                        attrs={'value': startdate.strftime('%d/%m/%Y')},
                        show_errors=False),
                    ffw.DisplayOnlyField(
                        name='enddate',
                        attrs={'value': enddate.strftime('%d/%m/%Y')},
                        show_errors=False),
                    ew.SubmitButton(
                        attrs={'value': 'Remove'},
                        show_errors=False)])]
        return super(ForgeForm, self).display(**kw)
Beispiel #10
0
    def display(self, **kw):
        skill = kw.get('skill')
        comment = skill['comment']
        if not comment:
            comment = " "

        self.fields = [
            ew.RowField(show_errors=False,
                        hidden_fields=[
                            ew.HiddenField(
                                name="categoryid",
                                attrs={'value': skill['skill'].trove_cat_id},
                                show_errors=False)
                        ],
                        fields=[
                            ffw.DisplayOnlyField(text=skill['skill'].fullpath),
                            ffw.DisplayOnlyField(text=skill['level']),
                            ffw.DisplayOnlyField(text=comment),
                            ew.SubmitButton(show_label=False,
                                            attrs={'value': 'Remove'},
                                            show_errors=False)
                        ])
        ]
        return super(ForgeForm, self).display(**kw)
 class buttons(ew_core.NameList):
     save = ew.SubmitButton(label='Save')
     delete = ew.SubmitButton(label='Delete Group')
Beispiel #12
0
 class buttons(ew_core.NameList):
     delete = ew.SubmitButton(label='Delete Thread')
 class buttons(ew_core.NameList):
     save = ew.SubmitButton(label='Save')
     cancel = ew.SubmitButton(
         label="Cancel",
         css_class='cancel',
         attrs=dict(onclick='window.location.reload(); return false;'))
Beispiel #14
0
class PromoteToThread(ew.SimpleForm):
    submit_text = None
    fields = [
        ew.TextField(name='subject', label='Thread title'),
        ew.SubmitButton(name='promote', label='Promote to thread')
    ]