diff --git a/core/forms/access.py b/core/forms/access.py index a07d2e12..75a183b3 100644 --- a/core/forms/access.py +++ b/core/forms/access.py @@ -1,4 +1,4 @@ -from django.forms import ModelForm, DateInput, ChoiceField +from django.forms import ModelForm, DateInput, ChoiceField, Textarea from core.models import Access, DataLocation @@ -11,7 +11,9 @@ class Meta: widgets = { # Date pickers 'granted_on': DateInput(attrs={'class': 'datepicker'}), - 'grant_expires_on': DateInput(attrs={'class': 'datepicker'}) + 'grant_expires_on': DateInput(attrs={'class': 'datepicker'}), + # Textareas + 'access_notes': Textarea(attrs={'rows': 2, 'cols': 40}), } def __init__(self, *args, **kwargs): @@ -40,7 +42,9 @@ class Meta: widgets = { # Date pickers 'granted_on': DateInput(attrs={'class': 'datepicker'}), - 'grant_expires_on': DateInput(attrs={'class': 'datepicker'}) + 'grant_expires_on': DateInput(attrs={'class': 'datepicker'}), + # Textareas + 'access_notes': Textarea(attrs={'rows': 2, 'cols': 40}), } field_order = [ @@ -56,4 +60,3 @@ def __init__(self, *args, **kwargs): # we don't allow editing dataset self.fields.pop('dataset') self.fields['defined_on_locations'].choices = [(d.id, d) for d in kwargs['instance'].dataset.data_locations.all()] - diff --git a/core/forms/cohort.py b/core/forms/cohort.py index 97867223..707caac5 100644 --- a/core/forms/cohort.py +++ b/core/forms/cohort.py @@ -1,4 +1,4 @@ -from django.forms import ModelForm +from django.forms import ModelForm, Textarea from core.forms.input import SelectWithModal from core.models import Cohort @@ -8,6 +8,9 @@ class CohortForm(ModelForm): class Meta: model = Cohort fields = '__all__' + widgets = { + 'comments': Textarea(attrs={'rows': 2, 'cols': 40}), + } def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/core/forms/contract.py b/core/forms/contract.py index f273aeb9..3a2b41ef 100644 --- a/core/forms/contract.py +++ b/core/forms/contract.py @@ -1,5 +1,5 @@ from django import forms -from django.forms import ModelForm, ModelChoiceField +from django.forms import ModelForm, ModelChoiceField, Textarea from django.utils.text import slugify from core.forms.input import SelectWithModal @@ -11,6 +11,9 @@ class Meta: model = Contract fields = '__all__' exclude = ['partners_roles'] + widgets = { + 'comments': Textarea(attrs={'rows': 2, 'cols': 40}), + } def __init__(self, *args, **kwargs): kwargs['label_suffix'] = "" diff --git a/core/forms/dataset.py b/core/forms/dataset.py index 473920fd..8ad5f843 100644 --- a/core/forms/dataset.py +++ b/core/forms/dataset.py @@ -9,6 +9,10 @@ class DatasetForm(forms.ModelForm): class Meta: model = Dataset fields = ['local_custodians', 'title', 'comments'] + widgets = { + 'comments': forms.Textarea(attrs={'rows': 2, 'cols': 40}), + } + def __init__(self, *args, **kwargs): dataset = None @@ -70,7 +74,7 @@ def save(self, commit=True): class DatasetFormEdit(DatasetForm): class Meta(DatasetForm.Meta): - fields = DatasetForm.Meta.fields +['other_external_id', 'sensitivity'] + fields = DatasetForm.Meta.fields + ['other_external_id', 'sensitivity'] def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/core/forms/document.py b/core/forms/document.py index 00e32b44..c772d182 100644 --- a/core/forms/document.py +++ b/core/forms/document.py @@ -1,7 +1,8 @@ from django import forms +from django.forms import DateInput, Textarea + from core.models import Document from core.forms.input import CustomClearableFileInput -from django.forms import DateInput class DocumentForm(forms.ModelForm): @@ -13,10 +14,9 @@ class Meta: 'content': CustomClearableFileInput, 'content_type': forms.HiddenInput(), 'object_id': forms.HiddenInput(), - 'expiry_date': DateInput(attrs={'class': 'datepicker'}) + 'expiry_date': DateInput(attrs={'class': 'datepicker'}), + 'content_notes': Textarea(attrs={'rows': 2, 'cols': 40}), } def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - - diff --git a/core/forms/project.py b/core/forms/project.py index a3c73f19..b4cdf5cd 100644 --- a/core/forms/project.py +++ b/core/forms/project.py @@ -14,6 +14,12 @@ class Meta: # Date pickers 'start_date': DateInput(attrs={'class': 'datepicker'}), 'end_date': DateInput(attrs={'class': 'datepicker'}), + # Smaller text-areas + 'description': forms.Textarea(attrs={'rows': 6, 'cols': 40}), + 'cner_notes': forms.Textarea(attrs={'rows': 2, 'cols': 40}), + 'erp_notes': forms.Textarea(attrs={'rows': 2, 'cols': 40}), + 'comments': forms.Textarea(attrs={'rows': 2, 'cols': 40}), + 'dpia': forms.Textarea(attrs={'rows': 2, 'cols': 40}) } exclude = ['publications', 'contacts'] @@ -129,5 +135,3 @@ class Meta: heading_help = 'Select the the dataset the project uses.' dataset = forms.ModelChoiceField(queryset=Dataset.objects.all(), help_text='Select the dataset.') - - diff --git a/core/forms/share.py b/core/forms/share.py index 1b69b55d..6aedfcb0 100644 --- a/core/forms/share.py +++ b/core/forms/share.py @@ -1,5 +1,5 @@ from django import forms -from django.forms import ModelForm, DateInput +from django.forms import ModelForm, DateInput, Textarea from core.models import Share, Partner, Contract, PartnerRole @@ -12,7 +12,8 @@ class Meta: widgets = { # Date pickers 'granted_on': DateInput(attrs={'class': 'datepicker'}), - 'grant_expires_on': DateInput(attrs={'class': 'datepicker'}) + 'grant_expires_on': DateInput(attrs={'class': 'datepicker'}), + 'share_notes': Textarea(attrs={'rows': 2, 'cols': 40}), } help_texts = { 'contract': '' diff --git a/web/static/css/daisy.scss b/web/static/css/daisy.scss index d6e273cf..2a746a52 100644 --- a/web/static/css/daisy.scss +++ b/web/static/css/daisy.scss @@ -390,3 +390,8 @@ body { color: #d9d9d9; font-weight: bolder; } + +/* Reduce padding in forms */ +form.col-md-12.nice-selects > .form-group.bmd-form-group { + padding-top: 0.75rem; +} \ No newline at end of file diff --git a/web/templates/_includes/field.html b/web/templates/_includes/field.html index 80d12df5..126fe691 100644 --- a/web/templates/_includes/field.html +++ b/web/templates/_includes/field.html @@ -1,7 +1,6 @@ {% load widget_tweaks %}