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

Org root page: add browse species buttons conditionally #1081

Open
kasugaijin opened this issue Oct 23, 2024 · 7 comments
Open

Org root page: add browse species buttons conditionally #1081

kasugaijin opened this issue Oct 23, 2024 · 7 comments
Assignees

Comments

@kasugaijin
Copy link
Collaborator

Currently, the browse cats and browse dogs buttons are hard coded. However, not every organization is going to have both cats and dogs. So, we should build the necessary buttons based on the unique pet species represented in the organization.

For example, if you queried the unique species on all pet records for a given org, and it returned only 'dog', then we should only show a dog button...and so on.

I was thinking about what we should do when there are no adoptable pets for a given species. For now, let's still show the button, but we should show an empty state. This related issue is adding empty states.

Regarding implementation, we will be handling this in the Organizations::HomeController. I think we should add a scope on Pet called something like organization_species that returns a list of unique species for the org. Then we can use this list to build the buttons.

Image

@kasugaijin kasugaijin added the Ready Make a comment to get assigned. label Oct 23, 2024
@Yuji3000
Copy link
Contributor

Yuji3000 commented Oct 23, 2024

@kasugaijin I'd be happy to take this issue

@kasugaijin
Copy link
Collaborator Author

@Yuji3000 all yours

@kasugaijin kasugaijin removed the Ready Make a comment to get assigned. label Oct 23, 2024
@jmilljr24
Copy link
Collaborator

Just to point out/clarify, the Pet model is scoped to the current organization using acts_as_tenant. @kasugaijin I think using organization_species could cause confusion. Since the model is already scoped to the org, it doesn't really tell me what the method is doing. Maybe unique_species or species_present , thoughts?

@kasugaijin
Copy link
Collaborator Author

@jmilljr24 I think unique_species is proably the clearest name

@kasugaijin
Copy link
Collaborator Author

@Yuji3000 let us know if you have any questions!

@Yuji3000
Copy link
Contributor

@kasugaijin thank you

@kasugaijin
Copy link
Collaborator Author

@Yuji3000 are you still able to work on this? Let me know if not and I can reassign.

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

No branches or pull requests

3 participants