From 962e4dd0d3e42d5c0cac6354b6d22a4c9b9b9a88 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Mon, 17 Aug 2009 20:31:37 +0000 Subject: [PATCH] autoresize css class added to comment-textarea. svn path=/plone.app.discussion/trunk/; revision=29104 --- plone/app/discussion/browser/comments.py | 11 ++++++++++- plone/app/discussion/browser/configure.zcml | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/plone/app/discussion/browser/comments.py b/plone/app/discussion/browser/comments.py index 589aa7f..baa913d 100644 --- a/plone/app/discussion/browser/comments.py +++ b/plone/app/discussion/browser/comments.py @@ -17,7 +17,8 @@ from zope.interface import Interface, implements 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.pagetemplatefile import ViewPageTemplateFile @@ -52,6 +53,13 @@ class View(BrowserView): aq_parent(aq_parent(aq_parent(self))).absolute_url() + '#' + 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): ignoreContext = True # don't use context to get widget data @@ -65,6 +73,7 @@ class CommentForm(extensible.ExtensibleForm, form.Form): 'creation_date', 'modification_date', 'author_username') + fields['text'].widgetFactory = AutoResizeTextAreaFieldWidget def updateWidgets(self): super(CommentForm, self).updateWidgets() diff --git a/plone/app/discussion/browser/configure.zcml b/plone/app/discussion/browser/configure.zcml index e83b4b7..076efa1 100644 --- a/plone/app/discussion/browser/configure.zcml +++ b/plone/app/discussion/browser/configure.zcml @@ -101,6 +101,7 @@ layer="..interfaces.IDiscussionLayer" /> +