diff options
author | Jochen Topf <jochen@topf.org> | 2015-03-14 11:19:21 +0100 |
---|---|---|
committer | Jochen Topf <jochen@topf.org> | 2015-03-14 11:19:21 +0100 |
commit | 09c7c596a1cdc045298018af14c2b1e4ea4d6702 (patch) | |
tree | eac337208646281fc5f4b7af6cbfacbc4aa68dd6 | |
parent | 5ee19155669c1248d5ea9a2613cbd2eb5e478b3d (diff) | |
download | taginfo-09c7c596a1cdc045298018af14c2b1e4ea4d6702.tar taginfo-09c7c596a1cdc045298018af14c2b1e4ea4d6702.tar.gz |
Add wiki images report.
-rw-r--r-- | web/i18n/de.yml | 8 | ||||
-rw-r--r-- | web/i18n/en.yml | 7 | ||||
-rw-r--r-- | web/lib/reports.rb | 1 | ||||
-rw-r--r-- | web/public/css/taginfo.css | 46 | ||||
-rw-r--r-- | web/views/reports/wiki_images.erb | 26 | ||||
-rw-r--r-- | web/viewsjs/reports/wiki_images.js.erb | 15 |
6 files changed, 103 insertions, 0 deletions
diff --git a/web/i18n/de.yml b/web/i18n/de.yml index 7060ecd..b4b89c3 100644 --- a/web/i18n/de.yml +++ b/web/i18n/de.yml @@ -690,4 +690,12 @@ reports: title: Tags relation_types: title: Relation-Typen + wiki_images: + name: Bilder aus dem Wiki + intro: | + Bilder, die im Wiki benutzt werden, um Keys in verschiedenen + Sprachen zu symbolisieren. Manchmal sind die Bilder in der einen + oder anderen Sprachversion besser. Manchmal ist es aber wegen + verschiedener kultureller Hintergründe oder dergleichen auch + sinnvoll, unterschiedliche Bilder zu benutzen. diff --git a/web/i18n/en.yml b/web/i18n/en.yml index 9536e49..c891a5b 100644 --- a/web/i18n/en.yml +++ b/web/i18n/en.yml @@ -661,4 +661,11 @@ reports: title: Unique tags relation_types: title: Unique relation types + wiki_images: + name: Wiki images + intro: | + Images used in the wiki to symbolize the keys in different + languages. Sometimes the image from one or the other language + variant is better. But sometimes it makes sense to have different + images because of different cultural backgrounds or so. diff --git a/web/lib/reports.rb b/web/lib/reports.rb index 71e2555..a297095 100644 --- a/web/lib/reports.rb +++ b/web/lib/reports.rb @@ -61,4 +61,5 @@ Report.new 'Wiki pages about non-existing keys', :db, :wiki Report.new 'Name tags' #disabled Report.new 'Similar keys', :db Report.new 'Historic development', :db +Report.new 'Wiki images', :wiki diff --git a/web/public/css/taginfo.css b/web/public/css/taginfo.css index bdce9b7..fd694e3 100644 --- a/web/public/css/taginfo.css +++ b/web/public/css/taginfo.css @@ -682,3 +682,49 @@ div#tagcloud a:hover { display: none; } +/* ========== */ + +table.wiki-images { + border-spacing: 4px; +} + +table.wiki-images td.key { + background-color: #ffffff; + padding: 0 10px; +} + +table.wiki-images td.images { + padding: 0; +} + +table.wiki-images td.images div.langimg { + position:relative; + width: 50px; + height: 50px; + float: left; + z-index: 0; + margin-right: 4px; +} + +table.wiki-images td.images div div { + position: absolute; + bottom: 0px; + width: 50px; + height: 12px; + text-align: center; + font-size: 80%; + line-height: 1; + z-index: 2; + background-color: #202020; + color: #ffffff; +} + +table.wiki-images td.images div img { + z-index: 1; + margin: 0 auto; + display: block; + max-width: 50px; + max-height: 50px; + top: 0; +} + diff --git a/web/views/reports/wiki_images.erb b/web/views/reports/wiki_images.erb new file mode 100644 index 0000000..26dbc3e --- /dev/null +++ b/web/views/reports/wiki_images.erb @@ -0,0 +1,26 @@ +<div class="pre"> + <h1><%= h(t.reports.wiki_images.name) %></h1> + <p><%= h(t.reports.wiki_images.intro) %></p> +</div> +<div class="box"> + <table class="wiki-images"><tr><td colspan="2"> +<% lastkey = '' + @db.select("SELECT p.key, p.title, p.lang, i.width, i.height, i.image_url, i.thumb_url_prefix, i.thumb_url_suffix FROM wiki.wikipages p, wiki.wiki_images i WHERE i.image=p.image AND p.value IS NULL ORDER BY p.key, p.lang").execute() do |row| %> +<% if lastkey != row['key'] + lastkey = row['key'] %> + </td></tr><tr><td class="key"><a class="keyimg" href=""></a></td><td class="images"> +<% end %> + <div class="langimg"> + <div><%= row['lang'] %></div> +<% imagesize = 50 + if row['width'].to_i <= imagesize && row['height'].to_i <= imagesize + src = row['image_url'] + else + src = row['thumb_url_prefix'] + imagesize.to_s + row['thumb_url_suffix'] + end +%> + <a href="http://wiki.openstreetmap.org/wiki/<%= row['title'] %>"><img src="<%= src %>"/></a> + </div> +<% end %> + </td></tr></table> +</div> diff --git a/web/viewsjs/reports/wiki_images.js.erb b/web/viewsjs/reports/wiki_images.js.erb new file mode 100644 index 0000000..2e90453 --- /dev/null +++ b/web/viewsjs/reports/wiki_images.js.erb @@ -0,0 +1,15 @@ +<% + osm = @trans.t.osm + misc = @trans.t.misc + %> +function page_init() { + var keys = <%= @db.select("SELECT DISTINCT key FROM wiki.wikipages WHERE value IS NULL AND image IN (SELECT image FROM wiki.wiki_images) ORDER BY key").execute().map{ |row| row['key'] }.to_json; %>; + console.log(keys); + up = function() { window.location = '/reports'; }; + jQuery('.keyimg').each(function(index) { + console.log(index, this); + jQuery(this).attr('href', url_for_key(keys[index])); + jQuery(this).text(fmt_key(keys[index])); + }); +} + |