Replaced the Textarea widget with the TextAreaDiv widget on document and document page detail views
This commit is contained in:
@@ -4,7 +4,7 @@ from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
from common.utils import return_attrib
|
||||
from common.widgets import DetailSelectMultiple, PlainWidget
|
||||
from common.widgets import DetailSelectMultiple, PlainWidget, TextAreaDiv
|
||||
|
||||
|
||||
class DetailForm(forms.ModelForm):
|
||||
@@ -41,7 +41,11 @@ class DetailForm(forms.ModelForm):
|
||||
queryset=getattr(field, 'queryset', None),
|
||||
)
|
||||
self.fields[field_name].help_text = ''
|
||||
|
||||
elif isinstance(field.widget, forms.widgets.Textarea):
|
||||
self.fields[field_name].widget = TextAreaDiv(
|
||||
attrs=field.widget.attrs,
|
||||
)
|
||||
|
||||
for field_name, field in self.fields.items():
|
||||
self.fields[field_name].widget.attrs.update({'readonly': 'readonly'})
|
||||
|
||||
|
||||
@@ -72,7 +72,6 @@ class TextAreaDiv(forms.widgets.Widget):
|
||||
def __init__(self, attrs=None):
|
||||
# The 'rows' and 'cols' attributes are required for HTML correctness.
|
||||
default_attrs = {'class': 'text_area_div'}
|
||||
#'cols': '40', 'rows': '10'}
|
||||
if attrs:
|
||||
default_attrs.update(attrs)
|
||||
super(TextAreaDiv, self).__init__(default_attrs)
|
||||
|
||||
@@ -9,6 +9,7 @@ from common.forms import DetailForm
|
||||
from common.literals import PAGE_SIZE_CHOICES, PAGE_ORIENTATION_CHOICES
|
||||
from common.conf.settings import DEFAULT_PAPER_SIZE
|
||||
from common.conf.settings import DEFAULT_PAGE_ORIENTATION
|
||||
from common.widgets import TextAreaDiv
|
||||
|
||||
from documents.models import Document, DocumentType, \
|
||||
DocumentPage, DocumentPageTransformation, DocumentTypeFilename
|
||||
@@ -229,9 +230,7 @@ class DocumentContentForm(forms.Form):
|
||||
|
||||
contents = forms.CharField(
|
||||
label=_(u'Contents'),
|
||||
widget=forms.widgets.Textarea(attrs={
|
||||
'rows': 14, 'cols': 80, 'readonly': 'readonly'
|
||||
})
|
||||
widget=TextAreaDiv()
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
border: 1px solid;
|
||||
height: 200px;
|
||||
overflow: auto;
|
||||
border: 1px solid #E2E2E2;
|
||||
border: 1px solid;
|
||||
width: 100%;
|
||||
font-size: 1.2em;
|
||||
margin: 0;
|
||||
|
||||
Reference in New Issue
Block a user