From bf13065d8af6de696b95c09f4dde041220e6e64b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Mon, 10 Jul 2017 08:33:39 +0200 Subject: [PATCH] forms: increate default textarea size (#17483) --- tests/test_fields.py | 12 ++++++++++++ wcs/qommon/form.py | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/tests/test_fields.py b/tests/test_fields.py index 15573b0a..473f75e0 100644 --- a/tests/test_fields.py +++ b/tests/test_fields.py @@ -58,6 +58,18 @@ def test_text(): assert fields.TextField().get_view_value('foo\n\nfoo') == '

foo\n

\nfoo

' assert fields.TextField(pre=True).get_view_value('foo') == '
foo
' + form = Form(use_tokens=False) + fields.TextField().add_to_form(form) + assert 'foo@localhost' diff --git a/wcs/qommon/form.py b/wcs/qommon/form.py index 11e385d4..c401899c 100644 --- a/wcs/qommon/form.py +++ b/wcs/qommon/form.py @@ -194,6 +194,10 @@ def text_render_content(self): attrs['aria-required'] = 'true' if self.attrs: attrs.update(self.attrs) + if not attrs.get('cols'): + attrs['cols'] = 72 + if not attrs.get('rows'): + attrs['rows'] = 5 return (htmltag("textarea", name=self.name, **attrs) + htmlescape(self.value or "") + htmltext("")) TextWidget.render_content = text_render_content -- 2.13.2