autoresize css class added to comment-textarea.

svn path=/plone.app.discussion/trunk/; revision=29104
This commit is contained in:
Timo Stollenwerk 2009-08-17 20:31:37 +00:00
parent ed4c6c411c
commit 962e4dd0d3
2 changed files with 11 additions and 1 deletions

View File

@ -17,7 +17,8 @@ from zope.interface import Interface, implements
from zope.viewlet.interfaces import IViewlet from zope.viewlet.interfaces import IViewlet
from z3c.form import form, field, button, interfaces from z3c.form import form, field, button, interfaces, widget
from z3c.form.browser.textarea import TextAreaWidget
from Products.Five.browser import BrowserView from Products.Five.browser import BrowserView
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
@ -52,6 +53,13 @@ class View(BrowserView):
aq_parent(aq_parent(aq_parent(self))).absolute_url() + aq_parent(aq_parent(aq_parent(self))).absolute_url() +
'#' + str(comment_id)) '#' + str(comment_id))
class AutoResizeTextArea(TextAreaWidget):
klass = u'autoresize'
def AutoResizeTextAreaFieldWidget(field, request):
"""IFieldWidget factory for AutoResizeTextAreaWidget."""
return widget.FieldWidget(field, AutoResizeTextArea(request))
class CommentForm(extensible.ExtensibleForm, form.Form): class CommentForm(extensible.ExtensibleForm, form.Form):
ignoreContext = True # don't use context to get widget data ignoreContext = True # don't use context to get widget data
@ -65,6 +73,7 @@ class CommentForm(extensible.ExtensibleForm, form.Form):
'creation_date', 'creation_date',
'modification_date', 'modification_date',
'author_username') 'author_username')
fields['text'].widgetFactory = AutoResizeTextAreaFieldWidget
def updateWidgets(self): def updateWidgets(self):
super(CommentForm, self).updateWidgets() super(CommentForm, self).updateWidgets()

View File

@ -101,6 +101,7 @@
layer="..interfaces.IDiscussionLayer" layer="..interfaces.IDiscussionLayer"
/> />
<!-- Control panel -->
<browser:page <browser:page
name="discussion-settings" name="discussion-settings"
for="Products.CMFPlone.interfaces.IPloneSiteRoot" for="Products.CMFPlone.interfaces.IPloneSiteRoot"