Skip to content

Commit

Permalink
Add view for embedding relation info in wiki
Browse files Browse the repository at this point in the history
  • Loading branch information
joto committed Jan 23, 2013
1 parent c601fa9 commit 47ec712
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
7 changes: 7 additions & 0 deletions web/lib/ui/embed.rb
Expand Up @@ -15,4 +15,11 @@ class Taginfo < Sinatra::Base
erb :'embed/tag', :layout => :'embed/layout'
end

get '/embed/relation' do
@rtype = params[:rtype]
@dbrtype = @db.select("SELECT * FROM db.relation_types").condition('rtype = ?', @rtype).execute()[0]
@roles = @db.select("SELECT role FROM db.prevalent_roles WHERE rtype=? ORDER BY count DESC LIMIT 10", @rtype).execute().map{ |row| row['role'] == '' ? '<i>(empty role)</i>' : row['role'] }
erb :'embed/relation', :layout => :'embed/layout'
end

end
2 changes: 1 addition & 1 deletion web/views/embed/key.erb
Expand Up @@ -2,7 +2,7 @@
<a target="_blank" title="More information about key '<%= escape_html(@key) %>' at Taginfo" href="http://taginfo.openstreetmap.org/">tag<b>info</b> [More...]</a>
<p>Statistics about the key will appear here.</p>
<% elsif @dbkey.nil? %>
<a target="_blank" title="More information about key '<%= escape_html(@key) %>' at Taginfo" href="http://taginfo.openstreetmap.org/tags/?key=<%= escape(@key) %>&value=<%= escape(@value) %>">tag<b>info</b> [More...]</a>
<a target="_blank" title="More information about key '<%= escape_html(@key) %>' at Taginfo" href="http://taginfo.openstreetmap.org/keys/?key=<%= escape(@key) %>">tag<b>info</b> [More...]</a>
<p>This key does not appear in the OSM database.</p>
<% else %>
<a target="_blank" title="More information about key '<%= escape_html(@key) %>' at Taginfo" href="http://taginfo.openstreetmap.org/keys/?key=<%= escape(@key) %>">tag<b>info</b> [More...]</a>
Expand Down
16 changes: 6 additions & 10 deletions web/views/embed/layout.erb
Expand Up @@ -14,12 +14,8 @@ div.main {
width: 180px;
background-color: #ffffff;
border: 1px solid #a0a0a0;
border-radius: 4px;
padding: 4px;
-moz-border-radius: 4px;
-khtml-border-radius: 4px;
-webkit-border-radius: 4px;
-chrome-border-radius: 4px;
-o-border-radius: 4px;
}

a img {
Expand Down Expand Up @@ -47,10 +43,10 @@ div.content td.ft {
}

</style>
</head>
<body>
<div class="main">
</head>
<body>
<div class="main">
<%= yield %>
</div>
</body>
</div>
</body>
</html>

0 comments on commit 47ec712

Please sign in to comment.