-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/redesign form pages #684
Conversation
fix: some more table styling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy with this, lots of changes but as far as I can tell all is well, congrats!
I did find some bugs unrelated to this PR while going through everything. Will make a separate PR for those.
I'll make a separate comment addressing some of the points in your PR description.
"details_who", | ||
"details_why", | ||
"details_frequency", | ||
"is_anonymous_header", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While reviewing I noticed that oddly enough the anonymity questions on the observation model have a default (= False
) set. Not necessarily something to be worried about right now.
@@ -44,9 +44,31 @@ def form_valid(self, form): | |||
################## | |||
|
|||
|
|||
class SessionStart(AllowErrorsOnBackbuttonMixin, UpdateView): | |||
class SessionMixin(AllowErrorsOnBackbuttonMixin): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method get_next_url()
and the attributes form_class
and template_name
feel like they don't really belong here.
tasks/views/session_views.py
Outdated
@@ -146,8 +153,11 @@ def get_next_url(self): | |||
def get_back_url(self): | |||
return reverse("tasks:session_overview", args=(self.object.study.pk,)) | |||
|
|||
def get_study(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be unnecessary
tasks/views/session_views.py
Outdated
@@ -163,3 +173,6 @@ def get_next_url(self): | |||
|
|||
def get_back_url(self): | |||
return reverse("tasks:session_start", args=(self.object.pk,)) | |||
|
|||
def get_study(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be unnecessary
I can't find an existing elegant way to do this either. In A working proof of concept is as follows: class ObservationForm(SoftValidationMixin, ConditionalModelForm):
# (Rest of class ommitted)
def get_context(self,):
context = super().get_context()
fields = context["fields"]
for field, errors in fields:
if field.name == "is_anonymous":
# Got 'em
field.css_classes = lambda: field.css_classes() + " uu-form-no-gap"
return context I suspect a better solution would be to implement the
I think the questions on those pages are very closely related to one another, and therefore probably better to keep together. And also not a priority right now.
This is a pretty good interim solution IMO!
Yes, I think this is worthy of a separate issue. Should be as simple as implementing
Setting
I see what you mean, but we need the width. Good call |
@@ -642,9 +642,14 @@ def clean(self): | |||
return cleaned_data # Sticking to Django conventions | |||
|
|||
|
|||
class StudyStartForm(forms.ModelForm): | |||
class StudyStartForm(SoftValidationMixin, ConditionalModelForm): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe SoftValidationMixin
is interacting strangely with the cleaning process, which is giving me an error. I'll have a PR into this branch soon with my proposed fix.
So this is a first version of the redesigned forms. It looks pretty good, but it could use further refinement I guess. As I am leaving for 2 weeks tomorrow, I thought I´d open this PR, as I think it is ready for some input.
Some things to note:
uu-form-no-gap
), which I think would be nice in some cases (eg. the image below). I'm wondering if there is an elegant way to implement this. Preferably, just add it as an attr to the widget or something? Looking at lines 13-15 of cdh.core.form_template.html, it seems that there should be some possibility for this?uu-form-no-gap
this situation would not have been as much of a problem. However, this solution works fine too.uu-form-row
in height ...Mock-up of use case for
uu-form-no-gap
:(btw ... I am just noticing the translation issues ... Not sure what is going on)