[openstreetmap-website] Append "Details" link to Nominatim search results (#250)

Tom Hughes notifications at github.com
Sun May 5 16:52:00 UTC 2013


> @@ -177,11 +177,17 @@ def search_osm_nominatim
>        prefix = t "geocoder.search_osm_nominatim.prefix_format", :name => prefix_name
>        object_type = place.attributes["osm_type"].to_s
>        object_id = place.attributes["osm_id"].to_s
> +      if object_type != ''
> +        suffix = " [<a href='browse/%s/%s'>%s</a>]" % [ object_type, object_id, t ("browse.%s_history.view_details" % object_type) ]

You need to get rid of the space in `t (` for this to work - without that change I just get syntax errors from ruby.

That said, you should be using `link_to` here rather than constructing the link by hand like that. That's hard to do in the controller, but then I think this is better done by changing `result_to_html` in `app/helpers/geocoder_helper.rb` anyway, and `link_to` is readily available there, so you can do something like:

```
link_to(t("browse.#{result[:type]}_history.view_details"), :controller => :browse, :action => result[:type], :id => result[:id])
```

---
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/250/files#r4087048
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20130505/cdb0d611/attachment-0001.html>


More information about the rails-dev mailing list