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 2 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

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?

@ajistrying ajistrying changed the title 4595 dropdown lists alphabetical order pt 1 Make dropdown lists alphabetical order ( Part 1) Sep 22, 2024
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.

1 participant