autoresize css class added to comment-textarea.
svn path=/plone.app.discussion/trunk/; revision=29104
This commit is contained in:
parent
ed4c6c411c
commit
962e4dd0d3
@ -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()
|
||||||
|
@ -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"
|
||||||
|
Loading…
Reference in New Issue
Block a user