Files
pages/internal/server/city_links.go
Anya Tokugawa c1175d389f Implement Knowledge City platform, organizer and DAV integration
Capture accumulated application, UI, CLI, regression tests and design documentation changes, including task project mapping and default CalDAV list naming.

Keep deployment data, backups, local credentials and build artifacts out of Git. Move the Compose enrollment token to an ignored local environment file.
2026-09-27 14:44:43 +09:00

41 lines
1.1 KiB
Go

package server
import (
"net/url"
"strings"
"pageswiki/internal/store"
)
// Names identify Streets only within their parent Quartier. UUID references
// remain available for stable identity across renames and moves.
func cityDetailHref(kind, name, quartierName, uuid string) string {
prefix := map[string]string{"quartier": "q", "street": "s", "spot": "p"}[strings.ToLower(kind)]
if prefix == "" {
return "/v/city"
}
ref := "uuid:" + uuid
if name != "" && (prefix != "s" || quartierName != "") {
ref = url.PathEscape(name)
if prefix == "s" {
ref = url.PathEscape(quartierName) + "/" + ref
}
} else {
ref = url.PathEscape(ref)
}
return "/v/city/" + prefix + "/" + ref
}
func canReadCityNode(node store.CityNodeDetail, allowed func(string) bool) bool {
return allowed(node.PathPrefix) && (node.Quartier == nil || allowed(node.Quartier.PathPrefix)) && (node.Street == nil || allowed(node.Street.PathPrefix))
}
func cityPageHref(path string) string {
return (&url.URL{Path: path}).EscapedPath()
}
type cityPageView struct {
store.CityPagePlacement
Href string
}