"Import a collection" button redirects to incorrect URL missing /hero_books/admin/ prefix #136
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_books#136
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
When pressing the "Import a collection to get started." button, it redirects to an incorrect URL that is missing the proper route prefix.
http://[50c:2786:2581:b5fe:3::1]:9988/importhttp://[50c:2786:2581:b5fe:3::1]:9988/hero_books/admin/import(same as the working link in the navbar)The navbar link to import works correctly, but this button uses the wrong path.
Expected behavior: The "Import a collection" button should redirect to the same correctly-prefixed URL as the navbar link (
/hero_books/admin/import).Implementation Spec for Issue #136
Objective
Fix the empty-state "Import" links in the hero_books admin UI so they point at the base-path-prefixed
/importroute (e.g./hero_books/admin/import) instead of a hardcoded/import, matching the navbar link and working correctly behind the router prefix.Root Cause
The admin templates hardcode
href="/import", which resolves to the router root (/import) rather than the service-prefixed path. The navbar link already uses the template's{{ base }}prefix variable (base.html:href="{{ base }}/import"), populated bybase_path_middlewarefrom thex-forwarded-prefixheader. The two empty-state links were missed.Files to Modify
crates/hero_books_admin/templates/collections.html(line 44) — the "Import a collection to get started" link named in the issue.crates/hero_books_admin/templates/index.html(line 48) — the identical defect on the Libraries empty state ("Import a library to get started").Both templates
{% extends "base.html" %}, and their render structs (CollectionsTemplate,IndexTemplateinsrc/main.rs) already carry abase: Stringfield, so{{ base }}is in scope.Implementation Plan
Step 1: Prefix the import links
Files:
crates/hero_books_admin/templates/collections.html,crates/hero_books_admin/templates/index.htmlhref="/import"tohref="{{ base }}/import"in both empty-state paragraphs.Dependencies: none
Acceptance Criteria
{{ base }}/import(e.g./hero_books/admin/import).{{ base }}/import.cargo check).Notes
hero_books_app(Dioxus SPA) uses client-side hash routing (#/import) and is correct as-is;hero_books_webtemplates already use{{ base }}/import./ui/vs/admin/route redundancy is tracked separately in #135 (a hero_router concern), not part of this fix.Implementation Summary
Fixed the empty-state "Import" links in the hero_books admin UI to use the base-path prefix, matching the navbar link.
Changes
crates/hero_books_admin/templates/collections.html—href="/import"->href="{{ base }}/import"(the "Import a collection to get started" link from the issue).crates/hero_books_admin/templates/index.html—href="/import"->href="{{ base }}/import"(the "Import a library to get started" empty state, identical defect).Behind the router prefix these now render
/hero_books/admin/import— the same target as the navbar Import link.Tests
cargo check -p hero_books_admin— passes (Askama compiles the templates with the change).cargo test -p hero_books_admin— 2 passed, 0 failed (round_trip_ok,upstream_unreachable_returns_502).Acceptance Criteria
{{ base }}/import.{{ base }}/import.Note: the running hero_books_admin instance needs a rebuild + restart to pick up the change.
Fixed in commit
60494989, pushed todevelopment. Both empty-state Import links now use the{{ base }}prefix and render/hero_books/admin/import. The running hero_books_admin instance needs a rebuild + restart to pick up the change.