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.
41 lines
1.1 KiB
Go
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
|
|
}
|