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

handle optional :sort option for attribute renderers #5010

Merged
merged 1 commit into from
Jul 15, 2021
Merged

Conversation

no-reply
Copy link
Contributor

following a suggestion in #395, introduce a :sort option for renderers and a startlingly naive implementation.

@samvera/hyrax-code-reviewers

@no-reply no-reply mentioned this pull request Jun 30, 2021
Comment on lines 34 to 39
values_array = Array(values)
values_array.sort! if options[:sort]

markup += values_array.map do |value|
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to worry at all about modifying the order of the passed in values? Would sort be safer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

probably. good call. 👍🏻

Copy link
Member

@cjcolvar cjcolvar left a comment

Choose a reason for hiding this comment

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

This is cool and simple. It would be helpful to include the option in the yard docs on #initialize.

@no-reply
Copy link
Contributor Author

no-reply commented Jul 1, 2021

This is cool and simple. It would be helpful to include the option in the yard docs on #initialize.

yeah, you're right. i'll take a second pass through to do some quick docs and a test in the AM.

@no-reply
Copy link
Contributor Author

removed array mutation and added a yard annotation for the new option

following a suggestion in #395, introduce a `:sort` option for renderers and a
startlingly naive implementation.
@jeremyf jeremyf merged commit 4023fcf into main Jul 15, 2021
@jeremyf jeremyf deleted the renderer-sort branch July 15, 2021 19:11
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.

3 participants