Child: [fceffe] (diff)

Download this file

widgets.py    39 lines (32 with data), 1.2 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import ew
from allura.lib.widgets import form_fields as ffw
from allura.lib.widgets import forms
from allura import model as M
class NewPostForm(forms.ForgeForm):
class fields(ew.WidgetsList):
title = ew.TextField()
text = ffw.MarkdownEdit(show_label=False)
date = ew.DateField()
time = ew.TimeField()
state = ew.SingleSelectField(
options=[
ew.Option(py_value='draft', label='Draft'),
ew.Option(py_value='published', label='Published') ])
labels = ffw.LabelEdit()
class EditPostForm(NewPostForm):
class buttons(ew.WidgetsList):
delete = ew.SubmitButton()
class ViewPostForm(ew.Widget):
template='genshi:forgeblog.templates.widgets.view_post'
params = [ 'value', 'subscribed' ]
value=None
subscribed=None
def __call__(self, **kw):
kw = super(ViewPostForm, self).__call__(**kw)
kw['subscribed'] = \
M.Mailbox.subscribed(artifact=kw.get('value'))
return kw
class PreviewPostForm(ew.Widget):
template='genshi:forgeblog.templates.widgets.preview_post'
params = [ 'value' ]
value=None