Merge branch 'master' into openID

This commit is contained in:
Ævar Arnfjörð Bjarmason 2010-04-20 23:41:14 +00:00
commit 9448eab143
10 changed files with 1626 additions and 4 deletions

View file

@ -15,4 +15,34 @@ module BrowseHelper
end
return name
end
def format_key(key)
if url = wiki_link("key", key)
link_to h(key), url, :title => t('browse.tag_details.wiki_link.key', :key => key)
else
h(key)
end
end
def format_value(key, value)
if url = wiki_link("tag", "#{key}=#{value}")
link_to h(value), url, :title => t('browse.tag_details.wiki_link.tag', :key => key, :value => value)
else
linkify h(value)
end
end
private
def wiki_link(type, lookup)
locale = I18n.locale.to_s
if page = WIKI_PAGES[locale][type][lookup] rescue nil
url = "http://wiki.openstreetmap.org/wiki/#{page}?uselang=#{locale}"
elsif page = WIKI_PAGES["en"][type][lookup] rescue nil
url = "http://wiki.openstreetmap.org/wiki/#{page}?uselang=#{locale}"
end
return url
end
end

View file

@ -1,3 +1,3 @@
<tr>
<td><%= h(tag[0]) %> = <%= linkify(h(tag[1])) %></td>
<td><%= format_key(tag[0]) %> = <%= format_value(tag[0], tag[1]) %></td>
</tr>

View file

@ -20,7 +20,7 @@
<%= render :partial => 'search' %>
<%
session[:token] = @user.tokens.create.token unless session[:token]
session[:token] = @user.tokens.create.token unless session[:token] and UserToken.find_by_token(session[:token])
# Decide on a lat lon to initialise potlatch with. Various ways of doing this
if params['lon'] and params['lat']