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

Make dropdown lists alphabetical order ( Part 1) #4663

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ajistrying
Copy link

@ajistrying ajistrying commented Sep 22, 2024

Resolves #4663

Description

NOTE: Part of a multi-part effort to convert all relevant dropdown lists throughout the app to lower-case alphabetical order

There's a need to ensure that dropdown lists are ordered alphabetically by their lowercase options. I opted to go for tweaking existing alphabetized scopes where possible, and where that wasn't possible I would sort the list of options in place usually at the site of the instance variable being instantiated in the relevant controller.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

This isn't a bug fix in the strict definition, more like a tweak to existing functionality.

How Has This Been Tested?

Screenshots

@@ -71,7 +71,6 @@ class User < ApplicationRecord
validate :password_complexity

default_scope -> { kept }
scope :alphabetized, -> { order(discarded_at: :desc, name: :asc) }
Copy link
Author

Choose a reason for hiding this comment

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

This wasn't being used anywhere, so I opted to remove it and look to order user select fields on the instance vars defined in relevant controller files.

include_blank: "",
collection: @items,
prompt: "Choose an item",
include_blank: false, # We've got a prompt, so no need for an include blank
Copy link
Author

Choose a reason for hiding this comment

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

I can remove this comment later, but I observed the item choice dropdown was showing some weird UI behavior, screenshot below of what I was seeing

image

Copy link
Author

@ajistrying ajistrying Sep 22, 2024

Choose a reason for hiding this comment

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

With the change, here is what it looks like. I think it looks a lot better, especially since this isn't a strict dropdown:
image

@@ -10,7 +10,8 @@
label: label,
error: error,
selected: storage_location_for_source(source.object),
include_blank: true,
include_blank: false,
prompt: "Choose a storage location",
Copy link
Author

Choose a reason for hiding this comment

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

Felt like this just looked better.

Before:
image

After:
image

db/seeds.rb Outdated
password_confirmation: 'password!'
password_confirmation: 'password!',
organization: user_data[:organization], # Any reason not to set this?
name: user_data[:email].split('@').first # Any reason not to set this?
Copy link
Author

Choose a reason for hiding this comment

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

Was there a reason why we weren't ensuring that an organization and name were in place for users?

Copy link
Collaborator

@cielf cielf Sep 23, 2024

Choose a reason for hiding this comment

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

Once upon a time we needed organizations for bank users. We changed to a role-based access for all users so it is no longer needed. Super users and partners wouldn't have had an organization from the get-go. As for names, I think all the bank users in production have names, but not all the partner users do. Does that help?

Copy link
Author

Choose a reason for hiding this comment

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

Ahhhh I see, that does help thank you! I'll get rid of these two additions and keep that in mind moving forward.

@ajistrying ajistrying changed the title 4595 dropdown lists alphabetical order pt 1 Make dropdown lists alphabetical order ( Part 1) Sep 22, 2024
@cielf
Copy link
Collaborator

cielf commented Dec 9, 2024

Hey @ajistrying -- Just noticing this is still in draft, with no changes for awhile. It that the intent?

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.

2 participants