Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(287)

Delta Between Two Patch Sets: MoinMoin/items/comment.py

Issue 10761044: Add initial implementation of Comment itemtype.
Left Patch Set: Created 11 years, 9 months ago
Right Patch Set: Updates ModifyForm and templates. Created 11 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 # Copyright: 2013 MoinMoin:PavelSviderski 1 # Copyright: 2013 MoinMoin:PavelSviderski
2 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details. 2 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
3 3
4 """ 4 """
5 MoinMoin - Comment itemtype 5 MoinMoin - Comment itemtype
6 """ 6 """
7 7
8 8
9 from MoinMoin.constants.contenttypes import GROUP_MARKUP_TEXT
9 from MoinMoin.i18n import L_ 10 from MoinMoin.i18n import L_
10 from MoinMoin.forms import DateTime, OptionalText, RequiredText
11 from MoinMoin.items import BaseMetaForm, Default, register 11 from MoinMoin.items import BaseMetaForm, Default, register
12 from MoinMoin.items.content import content_registry
13 from MoinMoin.forms import DateTime, OptionalText, RequiredText, Select
14 from MoinMoin.util.mime import Type
12 15
13 16
14 ITEMTYPE_COMMENT = u'comment' 17 ITEMTYPE_COMMENT = u'comment'
15 18
16 19
17 class CommentMetaForm(BaseMetaForm): 20 class CommentMetaForm(BaseMetaForm):
21 # Use only Markup text content type for a comment item
22 contenttype = Select.using(label=L_("Content type")).out_of(
23 ((unicode(Type(e.content_type, parameters=e.default_contenttype_params)) , e.display_name)
ReimarBauer 2013/07/27 11:55:18 why explicitly unicode type casting? can it be som
spy 2013/07/28 15:08:49 I want to define a mapping between valid contentty
24 for e in content_registry.groups[GROUP_MARKUP_TEXT]))
18 comment_for = RequiredText.using(label=L_("Comment for")).with_properties(pl aceholder=L_("Item UUID")) 25 comment_for = RequiredText.using(label=L_("Comment for")).with_properties(pl aceholder=L_("Item UUID"))
19 reply_to = OptionalText.using(label=L_("Reply to")).with_properties(placehol der=L_("Item UUID")) 26 reply_to = OptionalText.using(label=L_("Reply to")).with_properties(placehol der=L_("Comment item UUID"))
Thomas.J.Waldmann 2013/06/28 22:45:30 using "Item UUID" for both?
20 ptime = DateTime.using(label=L_('Publication time (UTC)'), optional=True) 27 ptime = DateTime.using(label=L_("Publication time (UTC)"), optional=True)
21 28
22 29
23 @register 30 @register
24 class Comment(Default): 31 class Comment(Default):
25 itemtype = ITEMTYPE_COMMENT 32 itemtype = ITEMTYPE_COMMENT
26 display_name = L_('Comment') 33 display_name = L_('Comment')
27 description = L_('Comment item') 34 description = L_('Comment item')
35 shown = False
28 36
29 class _ModifyForm(Default._ModifyForm): 37 class _ModifyForm(Default._ModifyForm):
30 meta_form = CommentMetaForm 38 meta_form = CommentMetaForm
31 meta_template = 'comment/modify_meta.html' 39 meta_template = 'comment/modify_meta.html'
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b