Address instead of URLs
This commit is contained in:
parent
60d23faf6c
commit
e4cee9f3fe
@ -128,7 +128,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
{{#each records}}
|
{{#each records}}
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="{{url}}" target="_blank" onclick="javascript:accessReview({{id}});">{{name}}</a></td>
|
<td><a href="https://maps.google.com/?q={{#urlEncode}}{{address}}{{/urlEncode}}" target="_blank" onclick="javascript:accessReview({{id}});">{{name}}</a></td>
|
||||||
<td>{{#prettyFloat 2}}{{distanceToUser}}{{/prettyFloat}} km</td>
|
<td>{{#prettyFloat 2}}{{distanceToUser}}{{/prettyFloat}} km</td>
|
||||||
<td>{{closestStn}}</td>
|
<td>{{closestStn}}</td>
|
||||||
<td>{{#prettyFloat 2}}{{distanceToStn}}{{/prettyFloat}} km</td>
|
<td>{{#prettyFloat 2}}{{distanceToStn}}{{/prettyFloat}} km</td>
|
||||||
|
@ -47,6 +47,10 @@
|
|||||||
return parseFloat(options.fn(this)).toFixed(precision);
|
return parseFloat(options.fn(this)).toFixed(precision);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Handlebars.registerHelper('urlEncode', function(options) {
|
||||||
|
return encodeURIComponent(options.fn(this));
|
||||||
|
});
|
||||||
|
|
||||||
$('#minScore,#resolution,#walkingDist,#maxResults').change(onSearch);
|
$('#minScore,#resolution,#walkingDist,#maxResults').change(onSearch);
|
||||||
$('#profileDlg').on('hidden.bs.modal', onSearch);
|
$('#profileDlg').on('hidden.bs.modal', onSearch);
|
||||||
$('#resetStorage').click(function() {
|
$('#resetStorage').click(function() {
|
||||||
|
2
types.go
2
types.go
@ -62,7 +62,7 @@ type record struct {
|
|||||||
Id int `json:"id"`
|
Id int `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Score float64 `json:"score"`
|
Score float64 `json:"score"`
|
||||||
Urls string `json:"urls"`
|
Address string `json:"address"`
|
||||||
features map[string]float64
|
features map[string]float64
|
||||||
geo geoData
|
geo geoData
|
||||||
}
|
}
|
||||||
|
8
util.go
8
util.go
@ -256,7 +256,7 @@ func computeRecordCompat(db *sql.DB, entries []record, context queryContext) err
|
|||||||
}
|
}
|
||||||
|
|
||||||
func fetchRecords(db *sql.DB, context queryContext) ([]record, error) {
|
func fetchRecords(db *sql.DB, context queryContext) ([]record, error) {
|
||||||
rows, err := db.Query("SELECT name, urls, delicious, accommodating, affordable, atmospheric, latitude, longitude, closestStnDist, closestStnName, accessCount, id FROM reviews")
|
rows, err := db.Query("SELECT name, address, delicious, accommodating, affordable, atmospheric, latitude, longitude, closestStnDist, closestStnName, accessCount, id FROM reviews")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -265,7 +265,7 @@ func fetchRecords(db *sql.DB, context queryContext) ([]record, error) {
|
|||||||
var entries []record
|
var entries []record
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var (
|
var (
|
||||||
name, urls, closestStn string
|
name, address, closestStn string
|
||||||
delicious, accommodating, affordable, atmospheric float64
|
delicious, accommodating, affordable, atmospheric float64
|
||||||
latitude, longitude, distanceToStn float64
|
latitude, longitude, distanceToStn float64
|
||||||
accessCount, id int
|
accessCount, id int
|
||||||
@ -273,7 +273,7 @@ func fetchRecords(db *sql.DB, context queryContext) ([]record, error) {
|
|||||||
|
|
||||||
rows.Scan(
|
rows.Scan(
|
||||||
&name,
|
&name,
|
||||||
&urls,
|
&address,
|
||||||
&delicious,
|
&delicious,
|
||||||
&accommodating,
|
&accommodating,
|
||||||
&affordable,
|
&affordable,
|
||||||
@ -287,7 +287,7 @@ func fetchRecords(db *sql.DB, context queryContext) ([]record, error) {
|
|||||||
|
|
||||||
entry := record{
|
entry := record{
|
||||||
Name: name,
|
Name: name,
|
||||||
Urls: urls,
|
Address: address,
|
||||||
DistanceToStn: distanceToStn,
|
DistanceToStn: distanceToStn,
|
||||||
ClosestStn: closestStn,
|
ClosestStn: closestStn,
|
||||||
AccessCount: accessCount,
|
AccessCount: accessCount,
|
||||||
|
Loading…
Reference in New Issue
Block a user