Skip to content
Snippets Groups Projects
Commit f1b57b79 authored by Fredrik Jonsson's avatar Fredrik Jonsson
Browse files

Add help text about information being fetched from account. Add css for...

Add help text about information being fetched from account. Add css for disabled input fields, was in apply but not in public.
parent dbb7cf62
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@
import copy
from collections import OrderedDict
from django.utils.translation import gettext_lazy as _
from wagtail.contrib.forms.models import AbstractForm
from hypha.apply.funds.blocks import (
......@@ -63,12 +64,15 @@ class BaseStreamForm:
struct_value = struct_child.value
if isinstance(block, FormFieldBlock):
field_from_block = block.get_field(struct_value)
disabled_help_text = _('You are logged in so this information is fetched from your user account.')
if isinstance(block, FullNameBlock) and user and user.is_authenticated:
field_from_block.disabled = True
field_from_block.initial = user.full_name
field_from_block.help_text = disabled_help_text
if isinstance(block, EmailBlock) and user and user.is_authenticated:
field_from_block.disabled = True
field_from_block.initial = user.email
field_from_block.help_text = disabled_help_text
if draft and not issubclass(block.__class__, ApplicationMustIncludeFieldBlock):
field_from_block.required = False
field_from_block.help_link = struct_value.get('help_link')
......
......@@ -366,6 +366,11 @@
max-width: 385px;
padding: .4em;
border: 1px solid $color--mid-grey;
&:disabled {
color: $color--black-50;
cursor: not-allowed;
}
}
&__error {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment