Skip to content

Introduce Thymeleaf fragments and dynamic case management features#22

Merged
mattknatt merged 3 commits into
mainfrom
refactor/thymeleaf
Mar 31, 2026
Merged

Introduce Thymeleaf fragments and dynamic case management features#22
mattknatt merged 3 commits into
mainfrom
refactor/thymeleaf

Conversation

@mattknatt

@mattknatt mattknatt commented Mar 31, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

Release Notes

  • New Features

    • Cases list page now dynamically displays all available cases with title and creation date.
    • Case creation form properly submits and creates new cases.
    • Case detail page displays case information (title, description, creation date) or error message when case not found.
  • Style

    • Improved visual styling and responsive layout across case-related pages.

@coderabbitai

coderabbitai Bot commented Mar 31, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@mattknatt has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 6 minutes and 24 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 6 minutes and 24 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9fe8877a-254f-4455-b507-ada4e9ad21f8

📥 Commits

Reviewing files that changed from the base of the PR and between fe87171 and 8fbad1b.

📒 Files selected for processing (9)
  • docker-compose.yml
  • src/main/java/org/example/projektarendehantering/presentation/dto/CreateCaseForm.java
  • src/main/java/org/example/projektarendehantering/presentation/web/UiController.java
  • src/main/resources/static/app.js
  • src/main/resources/templates/cases/detail.html
  • src/main/resources/templates/cases/list.html
  • src/main/resources/templates/cases/new.html
  • src/main/resources/templates/fragments/head.html
  • src/main/resources/templates/index.html
📝 Walkthrough

Walkthrough

The PR implements full-stack case management: JPA now auto-generates UUIDs for case IDs, the UI controller integrates with CaseService for CRUD operations, and templates transition from static placeholders to dynamic Thymeleaf rendering displaying actual case data. A shared head fragment consolidates common template structure and styling.

Changes

Cohort / File(s) Summary
Persistence Layer
src/main/java/.../infrastructure/persistence/CaseEntity.java
Added @GeneratedValue(strategy = GenerationType.UUID) annotation to the id field, enabling JPA to auto-generate UUID values instead of requiring external provision.
Controller Layer
src/main/java/.../presentation/web/UiController.java
Integrated CaseService via constructor injection; updated /ui/cases GET to populate cases list, /ui/cases/new GET to initialize empty CaseDTO, added new POST handler to create cases, and modified /ui/cases/{caseId} GET to accept UUID and fetch actual case details.
View Templates (Case Pages)
src/main/resources/templates/cases/detail.html, cases/list.html, cases/new.html
Replaced static placeholder content with dynamic Thymeleaf conditionals; detail template shows case fields or "not found" message, list template renders cases table or empty state, new template binds form to caseDTO model object.
Shared Template Fragment & Layout
src/main/resources/templates/fragments/head.html, index.html
Created new shared head fragment with comprehensive inline CSS (theme, layout, typography, responsive grid); updated index.html to use fragment instead of inline meta/stylesheet tags.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 Cases now bloom with auto-UUIDs bright,
Service layer guides each form through the night,
Templates dance with Thymeleaf's dynamic grace,
From static stubs to living, breathing space! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: introducing Thymeleaf fragments for shared template markup and adding dynamic case management features via controller updates and model binding.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/thymeleaf

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@src/main/java/org/example/projektarendehantering/presentation/web/UiController.java`:
- Around line 34-43: Replace direct binding of CaseDTO in UiController.newCase
and UiController.createCase with a new CreateCaseForm DTO that exposes only
title and description; update the GET to model.addAttribute("createCaseForm",
new CreateCaseForm()) and the POST to accept `@Valid`
`@ModelAttribute`("createCaseForm") CreateCaseForm form, then construct a new
CaseDTO inside createCase copying only title/description (do not accept
id/status/createdAt from the client) and pass that CaseDTO to
caseService.createCase(); also add CreateCaseForm with validation annotations
and update templates/cases/new.html th:object to use createCaseForm. Ensure
CaseMapper.toEntity and CaseService.createCase remain unchanged so only
server-generated fields are set server-side.

In `@src/main/resources/templates/fragments/head.html`:
- Around line 123-131: The CSS removes the keyboard focus indicator by using
"outline: none" on the .input selector; restore an accessible focus cue by
removing the global outline suppression and adding a visible focus style for
.input:focus (e.g., a high-contrast outline or box-shadow using your theme
variables like --focus or --border) so keyboard users get a clear, persistent
focus ring; update the .input rule and add a .input:focus rule (or
:focus-visible) to provide a clear, high-contrast indicator that matches your
design system.
- Around line 3-6: The head fragment uses ${title} but callers discard child
nodes so pages fall back to "Ärendehantering"; update every caller (index.html,
cases/list.html, cases/detail.html, cases/new.html) to pass the page title
explicitly via the fragment parameter (use the head fragment name "head" and
supply the title, e.g. th:replace="~{fragments/head :: head('Cases')}"), or
alternatively set a "title" model attribute in the corresponding UiController
handlers so ${title} is populated; ensure the fragment invocation and/or
controller model use the exact variable name "title" referenced in the head
fragment.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 72378648-e3b4-4074-921a-5fd044920c90

📥 Commits

Reviewing files that changed from the base of the PR and between c31a679 and fe87171.

📒 Files selected for processing (7)
  • src/main/java/org/example/projektarendehantering/infrastructure/persistence/CaseEntity.java
  • src/main/java/org/example/projektarendehantering/presentation/web/UiController.java
  • src/main/resources/templates/cases/detail.html
  • src/main/resources/templates/cases/list.html
  • src/main/resources/templates/cases/new.html
  • src/main/resources/templates/fragments/head.html
  • src/main/resources/templates/index.html

Comment thread src/main/resources/templates/fragments/head.html Outdated
Comment thread src/main/resources/templates/fragments/head.html
Introduced `CreateCaseForm` DTO with validation annotations for title and description. Updated Thymeleaf templates and controller to align with the new validation structure. Enhanced input error handling and polished UI with dynamic page titles. Removed unnecessary PostgreSQL profile from `docker-compose.yml`.
@mattknatt
mattknatt merged commit 024c755 into main Mar 31, 2026
2 checks passed
@mattknatt
mattknatt deleted the refactor/thymeleaf branch March 31, 2026 12:23
This was referenced Apr 20, 2026
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.

1 participant