Skip to content

fix: back button is a history.back() in media detail and edit#41

Merged
PascalRepond merged 1 commit intomainfrom
rep-dev
Jan 5, 2026
Merged

fix: back button is a history.back() in media detail and edit#41
PascalRepond merged 1 commit intomainfrom
rep-dev

Conversation

@PascalRepond
Copy link
Copy Markdown
Owner

No description provided.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 5, 2026

📝 Walkthrough

Walkthrough

Replaces breadcrumb/back-link header with a single back button (uses history.back() with a home-URL fallback) in two templates; simplifies back-icon markup; moves title placement in the header; changes review content wrapper class from prose max-w-none to review-text.

Changes

Cohort / File(s) Summary
Back navigation & header markup
src/templates/media_detail.html, src/templates/media_edit.html
Removed breadcrumb/home/"My media" anchor sequences and replaced with a single <button> that calls history.back() and falls back to the home URL; simplified inline back icon (removed explicit width/height classes); adjusted aria-label from "Back to list" to "Back"; title rendering moved after back control in detail template.
Review content styling
src/templates/media_detail.html
Replaced review wrapper class prose max-w-none with review-text to change the styling hook for rendered review content.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Pre-merge checks

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive No pull request description was provided by the author. Add a description explaining the rationale for the change, such as improved user experience, technical benefits, or any related issues.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: replacing back navigation with history.back() functionality in two template files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 849bd14 and 1645725.

📒 Files selected for processing (2)
  • src/templates/media_detail.html
  • src/templates/media_edit.html
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/templates/media_detail.html
  • src/templates/media_edit.html

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Fix all issues with AI Agents 🤖
In @src/templates/media_detail.html:
- Line 19: The button element that calls history.back() (the button rendering {%
translate "My media" %}) is missing an explicit type and may default to submit;
add type="button" to that button (same pattern as the earlier buttons at lines
13-15) so it won't submit the form when clicked.
- Around line 13-15: The Back button element (the button with
onclick="history.back()" and aria-label translating "Back to list") lacks an
explicit type and thus defaults to type="submit"; update that button to include
type="button" (matching the implementation in media_edit.html) to prevent
accidental form submission and ensure consistent behavior.

In @src/templates/media_edit.html:
- Around line 29-32: The back button uses history.back() directly which leaves
users stranded if history.length <= 1; update the onclick behavior (both
occurrences) to check history.length and redirect to a safe default route when
there's no history, or move the logic into a helper (e.g., a new function in
media_edit.js like handleBack()) and call that from the button so it
consistently does "if history.length > 1 then history.back() else
window.location.href = '/path/to/media-list/'".
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 70c042d and 849bd14.

📒 Files selected for processing (2)
  • src/templates/media_detail.html
  • src/templates/media_edit.html
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-12-26T15:18:46.932Z
Learnt from: PascalRepond
Repo: PascalRepond/datakult PR: 21
File: src/templates/accounts/profile_edit.html:23-58
Timestamp: 2025-12-26T15:18:46.932Z
Learning: In Django projects, attributes added to a form field's widget via field.widget.attrs.update(...) in the form's __init__ are rendered when using {{ form.field }} in templates. No explicit attribute definitions are needed in the template. This applies to templates under src/templates in Django apps; ensure you update attrs in __init__ for consistent HTMX behavior.

Applied to files:

  • src/templates/media_detail.html
  • src/templates/media_edit.html
📚 Learning: 2026-01-03T21:16:52.649Z
Learnt from: PascalRepond
Repo: PascalRepond/datakult PR: 36
File: src/templates/partials/media-items.html:67-67
Timestamp: 2026-01-03T21:16:52.649Z
Learning: In HTML templates (e.g., src/templates/partials/media-items.html), Tailwind CSS v4.1.11 supports arbitrary numeric utilities (max-w-{n}, w-{n}, h-{n}) that map to calc(var(--spacing) * n). These should be considered valid Tailwind classes and not flagged as invalid. Ensure review tooling and linters treat such numeric utilities as allowed, and apply this guidance to other HTML/template files in the repository.

Applied to files:

  • src/templates/media_detail.html
  • src/templates/media_edit.html
📚 Learning: 2026-01-04T08:55:43.091Z
Learnt from: PascalRepond
Repo: PascalRepond/datakult PR: 36
File: src/templates/partials/media-score-badge.html:1-9
Timestamp: 2026-01-04T08:55:43.091Z
Learning: In Django projects, configuring heroicons in TEMPLATES builtins makes heroicons.templatetags.heroicons available in all templates without needing {% load heroicons %}. For template reviews in this codebase, assume heroicon tags work globally in HTML templates under templates/, so avoid requiring explicit loads. If a template still uses {% load heroicons %}, assess whether the load is unnecessary and can be removed; ensure no conflicts arise from global tags.

Applied to files:

  • src/templates/media_detail.html
  • src/templates/media_edit.html
🔇 Additional comments (1)
src/templates/media_detail.html (1)

106-106: The review-text class provides comprehensive styling for rendered markdown content, including proper typography for headings, lists, code blocks, blockquotes, and links. The styling is already well-established across multiple templates and uses DaisyUI/Tailwind utilities for theme consistency.

Comment thread src/templates/media_detail.html Outdated
Comment thread src/templates/media_detail.html Outdated
Comment thread src/templates/media_edit.html Outdated
@PascalRepond PascalRepond merged commit 1b34afd into main Jan 5, 2026
3 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.

1 participant