mirror of
https://github.com/Xevion/r2park.git
synced 2025-12-07 01:16:06 -06:00
Capture data-locate-key for new GetForm API functions
This commit is contained in:
3
api.go
3
api.go
@@ -123,11 +123,14 @@ func GetLocations() []Location {
|
|||||||
|
|
||||||
doc.Find("input.property").Each(func(i int, s *goquery.Selection) {
|
doc.Find("input.property").Each(func(i int, s *goquery.Selection) {
|
||||||
matches := parsePattern.FindStringSubmatch(s.Parent().Text())
|
matches := parsePattern.FindStringSubmatch(s.Parent().Text())
|
||||||
|
|
||||||
|
key_attr, _ := s.Attr("data-locate-key")
|
||||||
id_attr, _ := s.Attr("value")
|
id_attr, _ := s.Attr("value")
|
||||||
id, _ := strconv.ParseUint(id_attr, 10, 32)
|
id, _ := strconv.ParseUint(id_attr, 10, 32)
|
||||||
|
|
||||||
cachedLocations = append(cachedLocations, Location{
|
cachedLocations = append(cachedLocations, Location{
|
||||||
id: uint(id),
|
id: uint(id),
|
||||||
|
key: key_attr,
|
||||||
name: matches[1],
|
name: matches[1],
|
||||||
address: matches[2] + " " + matches[3],
|
address: matches[2] + " " + matches[3],
|
||||||
})
|
})
|
||||||
|
|||||||
1
types.go
1
types.go
@@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
type Location struct {
|
type Location struct {
|
||||||
id uint // Used for registration internally
|
id uint // Used for registration internally
|
||||||
|
key string // Used for registration form lookup
|
||||||
name string // Used for autocomplete & location selection
|
name string // Used for autocomplete & location selection
|
||||||
address string // Not used in this application so far
|
address string // Not used in this application so far
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user