Skip to content
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

Feat: Increase mobile friendliness of forms #760

Merged
merged 8 commits into from Feb 28, 2024

Conversation

billybonks
Copy link
Contributor

@billybonks billybonks commented Feb 6, 2024

While experimenting on #754. I explored variations of form layout with fewer input boxes and replaced drop downs for pills to reduce clicks on mobile.

What I don't want to do is create an entirely forked UI, so this PR attempted to add the elements but using the original skin.

I added the advanced option, as I believe that people will use tags and notes because there is something they cannot represent in the core data model, so ideally, it is not a core feature that people use. For that reason, it defaults to hidden until people use it. Then, it will use the last toggle state.

My implementation of the fieldset might not be ideal; I just did it so that I knew how to do it in Django (hardly code in Python/Django), so feel free to modify or let me know how you want it done.

Adding the toggle code for the details, as I did, is probably not ideal. I'm happy to change.

We could bring back the drop-downs on the desktop if we wanted to by rendering both and using a media query.

Screenshots

image image image image image image

@coveralls
Copy link

coveralls commented Feb 6, 2024

Coverage Status

coverage: 98.754% (+0.007%) from 98.747%
when pulling 111ec34 on billybonks:feat/mobile-friendly-forms
into 2d1338a on babybuddy:master.

@cdubz cdubz added enhancement Feature requests or improvements to existing functionality ui/ux Issues relating to user interface/experience labels Feb 6, 2024
babybuddy/templates/babybuddy/base.html Outdated Show resolved Hide resolved
core/templates/forms/layouts/advanced.html Outdated Show resolved Hide resolved
core/forms.py Show resolved Hide resolved
core/forms.py Show resolved Hide resolved
@billybonks billybonks force-pushed the feat/mobile-friendly-forms branch 2 times, most recently from af2b31c to 530b360 Compare February 7, 2024 07:47
@billybonks
Copy link
Contributor Author

@cdubz seems like an unrelated test failure https://github.com/babybuddy/babybuddy/actions/runs/7811519906/job/21306747076?pr=760#step:8:42

passed locally

@cdubz
Copy link
Member

cdubz commented Feb 7, 2024

@cdubz seems like an unrelated test failure https://github.com/babybuddy/babybuddy/actions/runs/7811519906/job/21306747076?pr=760#step:8:42

passed locally

Yeah that is an unreliable test I need to sort out at some point. It fails randomly. Seems to be some issue related to timezones.

In order to promote less clicks on the mobile experience, this wideget
will splat out the drop down options similar to child select
In order to have more control and flexiability on how elements are
rendered create field set implementation.

every field set gets rendered in order, and uses the template specified.

This should probably be built into the metaclass of the form but i have
no idea how to do that.
Create choices template to have all multi choice experience be the same
as radio select choices.

Moved notes and tags into advanced template in order to reduce the
amount of fields in a form for users. Given that these two fields are
usually a catch all for anything that is not in the core data model. it
is not garunteed that users will use them.

If a user does decide to use the fields we will store that selection in
localstorage so that they dont have to open it every time.

I put the javascript into the page section, as i seem to have had issues
with javascript blocks overriding each other.
on mobile it text align center
Increased the font size so its easier to click
Added translations
having it directly in the page html is not ideal, now its properly
isolated.

Also use the new classname
Copy link
Member

@cdubz cdubz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I have just one last complaint here -- the radio buttons (see Type and Method in this example) need some more spacing. They seem to be right up against each other right now.

Screen Shot 2024-02-14 at 20 00 39

There may be a better way to lay them out generally but just added some evened out spacing would be a nice enough tweak here.

@billybonks
Copy link
Contributor Author

@cdubz, i tried to make them take up all available space, with spacing.

image image

My only concern was that the buttons become quite huge on desktop.

image

so i only grow the buttons on mobile

image

1. add default spacing
2. increase size to use all space on mobile
@cdubz
Copy link
Member

cdubz commented Feb 28, 2024

Looks good! Thanks for you work on this!

@cdubz cdubz added this to the 2.3.0 milestone Feb 28, 2024
@cdubz cdubz merged commit dd4e565 into babybuddy:master Feb 28, 2024
6 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests or improvements to existing functionality ui/ux Issues relating to user interface/experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants