From: Ævar Arnfjörð Bjarmason Date: Thu, 15 Oct 2009 08:21:57 +0000 (+0000) Subject: [18163] commited by me yesterday (and reverted in [18165]) was X-Git-Tag: live~6530 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/e0eb2b79b7ee19bcf6254cd0d652b9f1248a0fe8 [18163] commited by me yesterday (and reverted in [18165]) was broken. I didn't restart rails when testing it because I thought lib/ was auto-refreshed as well and that: ruby -e 'x = []; x[0]["foo"] = "bar"' Would work and autovify like it does in Perl. But no, you have to do: ruby -e 'x = [{}]; x[0]["foo"] = "bar"' This commit is equivalent to [18163] aside from that fix to lib/potlatch.rb --- diff --git a/app/controllers/amf_controller.rb b/app/controllers/amf_controller.rb index 687262e74..7df237de8 100644 --- a/app/controllers/amf_controller.rb +++ b/app/controllers/amf_controller.rb @@ -232,6 +232,12 @@ class AmfController < ApplicationController help = localised["help_html"] localised.delete("help_html") + # Populate icon names + POTLATCH_PRESETS[10].each { |id| + POTLATCH_PRESETS[11][id] = localised["preset_icon_#{id}"] + localised.delete("preset_icon_#{id}") + } + return POTLATCH_PRESETS+[localised,help] end diff --git a/config/potlatch/icon_presets.txt b/config/potlatch/icon_presets.txt index 326928640..f81d47c3f 100644 --- a/config/potlatch/icon_presets.txt +++ b/config/potlatch/icon_presets.txt @@ -1,26 +1,26 @@ -airport Airport amenity=airport -bus_stop Bus stop highway=bus_stop -ferry_terminal Ferry amenity=ferry_terminal -parking Parking amenity=parking -station Rail station railway=station -taxi Taxi rank amenity=taxi -bar Bar amenity=bar -cafe Cafe amenity=cafe -cinema Cinema amenity=cinema -fast_food Fast food amenity=fast_food -pub Pub amenity=pub -restaurant Restaurant amenity=restaurant -theatre Theatre amenity=theatre -convenience Convenience shop shop=convenience -hotel Hotel tourism=hotel -pharmacy Pharmacy amenity=pharmacy -post_box Postbox amenity=post_box -recycling Recycling amenity=recycling -supermarket Supermarket shop=supermarket -telephone Telephone amenity=telephone -fire_station Fire station amenity=fire_station -hospital Hospital amenity=hospital -police Police station amenity=police -place_of_worship Place of worship amenity=place_of_worship -museum Museum tourism=museum -school School amenity=school +airport amenity=airport +bus_stop highway=bus_stop +ferry_terminal amenity=ferry_terminal +parking amenity=parking +station railway=station +taxi amenity=taxi +bar amenity=bar +cafe amenity=cafe +cinema amenity=cinema +fast_food amenity=fast_food +pub amenity=pub +restaurant amenity=restaurant +theatre amenity=theatre +convenience shop=convenience +hotel tourism=hotel +pharmacy amenity=pharmacy +post_box amenity=post_box +recycling amenity=recycling +supermarket shop=supermarket +telephone amenity=telephone +fire_station amenity=fire_station +hospital amenity=hospital +police amenity=police +place_of_worship amenity=place_of_worship +museum tourism=museum +school amenity=school diff --git a/config/potlatch/locales/en.yml b/config/potlatch/locales/en.yml index 2c712e211..142fc4f79 100644 --- a/config/potlatch/locales/en.yml +++ b/config/potlatch/locales/en.yml @@ -145,3 +145,29 @@ en: tip_undo: Undo $1 (Z) uploading: Uploading... way: Way + preset_icon_school: School + preset_icon_restaurant: Restaurant + preset_icon_station: Rail station + preset_icon_airport: Airport + preset_icon_police: Police station + preset_icon_pharmacy: Pharmacy + preset_icon_fast_food: Fast food + preset_icon_fire_station: Fire station + preset_icon_hotel: Hotel + preset_icon_supermarket: Supermarket + preset_icon_post_box: Postbox + preset_icon_theatre: Theatre + preset_icon_ferry_terminal: Ferry + preset_icon_bus_stop: Bus stop + preset_icon_hospital: Hospital + preset_icon_convenience: Convenience shop + preset_icon_parking: Parking + preset_icon_recycling: Recycling + preset_icon_pub: Pub + preset_icon_cafe: Cafe + preset_icon_telephone: Telephone + preset_icon_cinema: Cinema + preset_icon_bar: Bar + preset_icon_museum: Museum + preset_icon_place_of_worship: Place of worship + preset_icon_taxi: Taxi rank diff --git a/lib/potlatch.rb b/lib/potlatch.rb index 7a7926f04..29ab4535a 100644 --- a/lib/potlatch.rb +++ b/lib/potlatch.rb @@ -187,12 +187,11 @@ module Potlatch end # Read POI presets - icon_list=[]; icon_names={}; icon_tags={}; + icon_list=[]; icon_tags={}; File.open("#{RAILS_ROOT}/config/potlatch/icon_presets.txt") do |file| file.each_line {|line| - (icon,name,tags)=line.chomp.split("\t") + (icon,tags)=line.chomp.split("\t") icon_list.push(icon) - icon_names[icon]=name icon_tags[icon]=Hash[*tags.scan(/([^;=]+)=([^;=]+)/).flatten] } end @@ -211,7 +210,7 @@ module Potlatch } end - [presets,presetmenus,presetnames,colours,casing,areas,autotags,relcolours,relalphas,relwidths,icon_list,icon_names,icon_tags] + [presets,presetmenus,presetnames,colours,casing,areas,autotags,relcolours,relalphas,relwidths,icon_list,{},icon_tags] end end