Skip to content

Update resource type icon logic#1609

Merged
thatbudakguy merged 2 commits intomainfrom
specific-icons-2
Sep 16, 2024
Merged

Update resource type icon logic#1609
thatbudakguy merged 2 commits intomainfrom
specific-icons-2

Conversation

@thatbudakguy
Copy link
Member

@thatbudakguy thatbudakguy commented Sep 12, 2024

This slightly refactors the logic in the header icons component that picks a more specific icon to display based on an item's resource type.

For cases where an item had multiple resource types, but one of them was one that mapped to an icon (e.g. "Raster data" and "Nautical charts"), we were sometimes falling back to the resource class ("Datasets"). This change has us use "Raster data" since we know we have a more specific icon for it in that situation.

For more info, see sul-dlss/earthworks#1398.

Both are multivalued, and we needed a new one for resource class
@github-actions
Copy link

github-actions bot commented Sep 12, 2024

Demo app download link: https://github.com/geoblacklight/geoblacklight/actions/runs/10886871149/artifacts/1938284304

  1. Download demo app and unzip file
  2. Change into app directory
    • run docker compose pull
    • run docker compose up
  3. Open in browser

@thatbudakguy thatbudakguy marked this pull request as ready for review September 12, 2024 20:32

# If the item has a resource type of "X data" where "X" is an existing icon, use that icon
# Otherwise just use the resource class icon
def get_resource_icon
Copy link
Collaborator

Choose a reason for hiding this comment

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

get_ as a prefix on an accessor method is not typical in Ruby. https://github.com/rubocop/ruby-style-guide#accessormutator-method-names Would resource_icon work?

Copy link
Member Author

Choose a reason for hiding this comment

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

sure – I just did that because the other method was named get_icon. I'll change them both

Copy link
Member Author

Choose a reason for hiding this comment

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

updated

Copy link
Collaborator

@jcoyne jcoyne Sep 16, 2024

Choose a reason for hiding this comment

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

To be clear, the other method was not an accessor (it takes a parameter), so doesn't really fall under the same convention, but I still like to avoid it.

@thatbudakguy thatbudakguy merged commit 7d8804b into main Sep 16, 2024
@thatbudakguy thatbudakguy deleted the specific-icons-2 branch September 16, 2024 17:36
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