Skip to content

Conversation

@technologic-technologic
Copy link
Contributor

@technologic-technologic technologic-technologic commented Oct 28, 2025

Fix for issue #760

Issue: Adoption save container does not contain default image

What

  • Add defaultImage to the ModelAndView in save endpoint.
  • Wire defaultImage so carousel fallback works in the listForAdoption.html template

Why

  • Enables the Thymeleaf fallback when pet.images is empty, preventing empty/broken thumbnails.

Impact

  • View-only change; no storage or controller logic altered.

Behavior

Before: Pets with images display correctly; pets without images render no thumbnail.
After: Pets with images still display correctly (no changes); pets without images render the configured default image. Added component that reads the defaultImage. Just like other templates that does render the default Image.

  • Ensure the pets list renders a fallback image when a pet has no uploaded images by:
    • Passing defaultImage into the view model.
    • Using that value in the Thymeleaf template fallback block below the carousel definition (shown when pet.images is empty).

What
- Add defaultImage to the ModelAndView in save endpoint.
- Wire defaultImage so carousel fallback works in the listForAdoption.html template

Why
- Enables the Thymeleaf fallback when pet.images is empty, preventing empty/broken thumbnails.

Impact
- View-only change; no storage or controller logic altered.
- Backwards compatible. Requires that gcpImageUrl + defaultImage resolve to a valid image.
Copy link
Owner

@josdem josdem left a comment

Choose a reason for hiding this comment

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

It looks good to me, thanks @technologic-technologic

@josdem
Copy link
Owner

josdem commented Oct 28, 2025

@all-contributors please add @technologic-technologic for code

@allcontributors
Copy link
Contributor

@josdem

I've put up a pull request to add @technologic-technologic! 🎉

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for displaying a default image when pets have no uploaded images in the adoption listing page. The changes ensure that pets without images still have a visual representation in the UI.

  • Added fallback display logic to show a default image when pet.images is empty
  • Injected defaultImage configuration value into AdoptionController
  • Passed defaultImage to the template model for rendering

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/main/resources/templates/pet/listForAdoption.html Added conditional block to display default image when pet has no images
src/main/java/com/josdem/vetlog/controller/AdoptionController.java Added defaultImage field injection and passed it to the model for the template

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@josdem josdem merged commit 43a2632 into josdem:main Oct 29, 2025
6 checks passed
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