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

Use human model name when creating new polymorphic association #2573

Merged
merged 1 commit into from Mar 13, 2024

Conversation

iainbeeston
Copy link
Contributor

Description

Use the human model name in the link for creating a new polymorphic association, instead of the class name

Fixes # (issue)

Right now, when you have a polymorphic belongs to field and you specify the types argument (so the field shows a useful select menu allowing you to choose from the different polymorphic types) it has a link below the select menu saying "Create new ". However, the name it uses for the resource is the class name used in the code, which isn't very user-friendly.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

Screenshots & recording

This is what it looks like before (note the class name with modules in the link):

Screenshot 2024-03-08 at 12 36 13

This is what it looks like after:

Screenshot 2024-03-08 at 12 35 36

Manual review steps

  1. Find a polymorphic belongs to field that uses types, eg. https://main.avodemo.com/avo/resources/comments/549/edit
  2. Switch to this branch
  3. Confirm that the "create new " hasn't changed
  4. Change the human name for the polymorphic class in the rails translations file
  5. Reload avo and confirm that the name has updated to use the new translation

Manual reviewer: please leave a comment with output from the test if that's the case.

Copy link

codeclimate bot commented Mar 8, 2024

Code Climate has analyzed commit 8fa6a81 and detected 0 issues on this pull request.

View more on Code Climate.

Copy link
Contributor

@Paul-Bob Paul-Bob left a comment

Choose a reason for hiding this comment

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

Thanks for this fix @iainbeeston !

@adrianthedev adrianthedev merged commit b81aff1 into avo-hq:main Mar 13, 2024
20 checks passed
@Paul-Bob Paul-Bob added the Fix label Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants