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

Change checkboxes to radio buttons #3824

Merged
merged 1 commit into from
Aug 18, 2023

Conversation

mdphillips375
Copy link
Contributor

Resolves #3804

Description

  • Checkboxes changed to yes/no buttons on Partner Profile form to reduce confusion
  • Existing styles did not work well with radio buttons on this form (width property was getting set to 0 on the enclosing DIVs, causing odd display of the buttons). New styles added to better match the general style of the form.
  • Partner profile show view updated to include "Unspecified" when the boolean field is still null. Previous behavior was to show "No" for any falsey value, including null.
  • Added tests to verify these fields are null on creation, and that they change to the proper values when the radio buttons are selected.

List any dependencies that are required for this change. (gems, js libraries, etc.)
No new dependencies

Include anything else we should know about. -->

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Screenshots

Before:
Edit:
before_checkbox
Show:

before_show

After:
Edit:
after_edit
Show:

after_show

Copy link
Collaborator

@dorner dorner left a comment

Choose a reason for hiding this comment

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

Looks pretty good! Had a couple of questions/suggestions.

}

.form-yesno > div > div > label {
Copy link
Collaborator

Choose a reason for hiding this comment

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

These kinds of rules are pretty brittle. Can we add some classes or IDs here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was able to rewrite these rules to use classes.

@@ -215,4 +215,19 @@
describe "versioning" do
it { is_expected.to be_versioned }
end

describe "default values" do
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure this needs its own test. You're basically asserting the default database values.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

@@ -0,0 +1,92 @@
RSpec.describe "Partners profile radio buttons behaviour", type: :system, js: true do
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can be a request spec. System specs use a full browser and are only needed when testing interactions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed the system spec and re-implemented some of these tests as request spec.

@dorner
Copy link
Collaborator

dorner commented Aug 11, 2023

Also, please fix the lint issues!

@dorner
Copy link
Collaborator

dorner commented Aug 18, 2023

Thanks for the contribution! 

FYI, for next time please do not force push branches that have active pull request conversations, as it becomes really hard to find the previous comments.

@dorner dorner merged commit b349eea into rubyforgood:main Aug 18, 2023
11 checks passed
@mdphillips375 mdphillips375 deleted the 3804-boolean-to-radio branch August 26, 2023 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert single checkboxes on partner profile form to yes/no radio buttons
2 participants