]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'upstream/pull/4371'
authorTom Hughes <tom@compton.nu>
Thu, 7 Dec 2023 16:19:23 +0000 (16:19 +0000)
committerTom Hughes <tom@compton.nu>
Thu, 7 Dec 2023 16:19:23 +0000 (16:19 +0000)
app/assets/images/key/opnvkarte/bus_stop13.svg [new file with mode: 0644]
app/assets/images/key/opnvkarte/bus_stop15.svg [new file with mode: 0644]
app/assets/images/key/opnvkarte/rail11.svg [new file with mode: 0644]
app/assets/images/key/opnvkarte/rail15.svg [new file with mode: 0644]
app/assets/images/key/opnvkarte/rail17.svg [new file with mode: 0644]
app/assets/images/key/opnvkarte/stop13.svg [new file with mode: 0644]
app/assets/images/key/opnvkarte/stop15.svg [new file with mode: 0644]
app/assets/javascripts/leaflet.key.js
app/views/site/key.html.erb
config/key.yml
config/locales/en.yml

diff --git a/app/assets/images/key/opnvkarte/bus_stop13.svg b/app/assets/images/key/opnvkarte/bus_stop13.svg
new file mode 100644 (file)
index 0000000..ae4ffee
--- /dev/null
@@ -0,0 +1,3 @@
+<svg xmlns='http://www.w3.org/2000/svg' width='5' height='5'>
+<circle cx='2.5' cy='2.5' r='2.15' stroke='black' fill='#ffffff' />
+</svg>
diff --git a/app/assets/images/key/opnvkarte/bus_stop15.svg b/app/assets/images/key/opnvkarte/bus_stop15.svg
new file mode 100644 (file)
index 0000000..a259919
--- /dev/null
@@ -0,0 +1,3 @@
+<svg xmlns='http://www.w3.org/2000/svg' width='9' height='9'>
+<circle cx='4.5' cy='4.5' r='4' stroke='black' fill='#ffffff' />
+</svg>
diff --git a/app/assets/images/key/opnvkarte/rail11.svg b/app/assets/images/key/opnvkarte/rail11.svg
new file mode 100644 (file)
index 0000000..849f5cf
--- /dev/null
@@ -0,0 +1,4 @@
+<svg xmlns='http://www.w3.org/2000/svg' width='52' height='3'>
+<rect width='100%' height='100%' fill='#868686' />
+<line x2='100%' y1='50%' y2='50%' stroke='#eeeeee' stroke-dasharray='10 10' stroke-dashoffset='9' />
+</svg>
diff --git a/app/assets/images/key/opnvkarte/rail15.svg b/app/assets/images/key/opnvkarte/rail15.svg
new file mode 100644 (file)
index 0000000..efe7792
--- /dev/null
@@ -0,0 +1,4 @@
+<svg xmlns='http://www.w3.org/2000/svg' width='52' height='4'>
+<rect width='100%' height='100%' fill='#868686' />
+<line x2='100%' y1='50%' y2='50%' stroke='#eeeeee' stroke-dasharray='10 10' stroke-dashoffset='9' stroke-width='2' />
+</svg>
diff --git a/app/assets/images/key/opnvkarte/rail17.svg b/app/assets/images/key/opnvkarte/rail17.svg
new file mode 100644 (file)
index 0000000..8cada29
--- /dev/null
@@ -0,0 +1,9 @@
+<svg xmlns='http://www.w3.org/2000/svg' width='52' height='12' stroke='#999999' stroke-dashoffset='-1'>
+  <g stroke-dasharray='2 4'>
+    <line x2='100%' y1='1' y2='1' stroke-width='2' />
+    <line x2='100%' y1='6' y2='6' stroke-width='4' />
+    <line x2='100%' y1='11' y2='11' stroke-width='2' />
+  </g>
+  <line x2='100%' y1='2.5' y2='2.5' stroke-width='1' />
+  <line x2='100%' y1='9.5' y2='9.5' stroke-width='1' />
+</svg>
diff --git a/app/assets/images/key/opnvkarte/stop13.svg b/app/assets/images/key/opnvkarte/stop13.svg
new file mode 100644 (file)
index 0000000..cfe65b3
--- /dev/null
@@ -0,0 +1,3 @@
+<svg xmlns='http://www.w3.org/2000/svg' width='5' height='5'>
+<circle cx='2.5' cy='2.5' r='2.15' stroke='black' fill='#e23148' />
+</svg>
diff --git a/app/assets/images/key/opnvkarte/stop15.svg b/app/assets/images/key/opnvkarte/stop15.svg
new file mode 100644 (file)
index 0000000..3ae6267
--- /dev/null
@@ -0,0 +1,3 @@
+<svg xmlns='http://www.w3.org/2000/svg' width='9' height='9'>
+<circle cx='4.5' cy='4.5' r='4' stroke='black' fill='#e23148' />
+</svg>
index bcd5839cdad8891e183e2fcec8bf7c19b14e4191..088d0f9d3ea0fcf71cd36f10dd44090f8df35745 100644 (file)
@@ -39,11 +39,11 @@ L.OSM.key = function (options) {
 
       $(".mapkey-table-entry").each(function () {
         var data = $(this).data();
-        if (layer === data.layer && zoom >= data.zoomMin && zoom <= data.zoomMax) {
-          $(this).show();
-        } else {
-          $(this).hide();
-        }
+        $(this).toggle(
+          layer === data.layer &&
+          (!data.zoomMin || zoom >= data.zoomMin) &&
+          (!data.zoomMax || zoom <= data.zoomMax)
+        );
       });
     }
   };
index da76389481088141ae44aa42295c2365270b1034..d3da868569dbd97fff87ab6b927ed6f93525f654 100644 (file)
@@ -2,7 +2,7 @@
   <table class="table table-sm table-borderless mapkey-table mb-0">
     <% YAML.load_file(Rails.root.join("config/key.yml")).each do |name,data| %>
       <% data.each do |entry| %>
-        <tr class="mapkey-table-entry" data-layer="<%= name %>" data-zoom-min="<%= entry["min_zoom"] %>" data-zoom-max="<%= entry["max_zoom"] %>">
+        <%= tag.tr :class => "mapkey-table-entry", :data => { :layer => name, :zoom_min => entry["min_zoom"], :zoom_max => entry["max_zoom"] } do %>
           <td class="mapkey-table-key align-middle">
             <% if entry["width"] && entry["height"] && entry["fill"] %>
               <%= image_tag "data:image/svg+xml,#{u("<svg xmlns='http://www.w3.org/2000/svg' width='#{entry['width']}' height='#{entry['height']}'><rect width='100%' height='100%' fill='#{entry['fill']}' /></svg>")}" %>
@@ -13,7 +13,7 @@
           <td class="mapkey-table-value">
             <%= Array(t(".table.entry.#{entry['name']}")).to_sentence %>
           </td>
-        </tr>
+        <% end %>
       <% end %>
     <% end %>
   </table>
index 2d1cf97a026594f297ff89cf8f16928828359ed4..ab3eaf3cc9c5223de42634831fd40cb610003d39 100644 (file)
@@ -69,3 +69,26 @@ cyclemap:
   - { min_zoom: 14, max_zoom: 19, name: bicycle_shop, image: bicycle_shop.png }
   - { min_zoom: 14, max_zoom: 19, name: bicycle_parking, image: bicycle_parking.png }
   - { min_zoom: 16, max_zoom: 19, name: toilets, image: toilets.png }
+opnvkarte:
+  - { min_zoom: 6, max_zoom: 7, name: rail, width: 52, height: 1, fill: "#868686" }
+  - { min_zoom: 8, max_zoom: 10, name: rail, width: 52, height: 2, fill: "#868686" }
+  - { min_zoom: 11, max_zoom: 14, name: rail, image: rail11.svg }
+  - { min_zoom: 15, max_zoom: 16, name: rail, image: rail15.svg }
+  - { min_zoom: 17, name: rail, image: rail17.svg }
+  - { min_zoom: 6, max_zoom: 9, name: train, width: 52, height: 2, fill: "#ffc366" }
+  - { min_zoom: 10, max_zoom: 11, name: train, width: 52, height: 3, fill: "#ffc366" }
+  - { min_zoom: 12, name: train, width: 52, height: 4, fill: "#ffc366" }
+  - { min_zoom: 10, name: light_rail, width: 52, height: 4, fill: "#66ff66" }
+  - { min_zoom: 10, name: tram_only, width: 52, height: 4, fill: "#3333fe" }
+  - { min_zoom: 10, name: subway, width: 52, height: 4, fill: "#33339f" }
+  - { min_zoom: 9, max_zoom: 13, name: ferry, width: 52, height: 2, fill: "#9f339f" }
+  - { min_zoom: 14, name: ferry, width: 52, height: 3, fill: "#9f339f" }
+  - { min_zoom: 10, name: trolleybus, width: 52, height: 4, fill: "#9f3333" }
+  - { min_zoom: 11, max_zoom: 11, name: bus, width: 52, height: 1, fill: "#fe3333" }
+  - { min_zoom: 12, max_zoom: 12, name: bus, width: 52, height: 2, fill: "#fe3333" }
+  - { min_zoom: 13, max_zoom: 13, name: bus, width: 52, height: 3, fill: "#fe3333" }
+  - { min_zoom: 14, name: bus, width: 52, height: 4, fill: "#fe3333" }
+  - { min_zoom: 13, max_zoom: 14, name: bus_stop, image: bus_stop13.svg }
+  - { min_zoom: 15, name: bus_stop, image: bus_stop15.svg }
+  - { min_zoom: 13, max_zoom: 14, name: stop, image: stop13.svg }
+  - { min_zoom: 15, name: stop, image: stop15.svg }
index c48a940177da36de6d00838f19c5301b239f5fd4..4b4f6b301807fd6cb5198e1ae8d4a8391e127e97 100644 (file)
@@ -2290,10 +2290,16 @@ en:
           cycleway_local: "Local cycleway"
           footway: "Footway"
           rail: "Railway"
+          train: "Train"
           subway: "Subway"
+          ferry: "Ferry"
           tram:
             - Light rail
             - tram
+          light_rail: "Light rail"
+          tram_only: "Tram"
+          trolleybus: "Trolleybus"
+          bus: "Bus"
           cable:
             - Cable car
             - chair lift
@@ -2341,6 +2347,8 @@ en:
           private: "Private access"
           destination: "Destination access"
           construction: "Roads under construction"
+          bus_stop: "Bus stop"
+          stop: "Stop"
           bicycle_shop: "Bicycle shop"
           bicycle_parking: "Bicycle parking"
           toilets: "Toilets"