]> git.openstreetmap.org Git - nominatim-ui.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Sat, 6 Apr 2024 07:11:42 +0000 (09:11 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Sat, 6 Apr 2024 07:11:42 +0000 (09:11 +0200)
CHANGES.md
package.json
src/components/DetailsOneRow.svelte
src/pages/DetailsPage.svelte
test/details.js

index 0cc68df2948cdb43d2dad0d4af95e7cec2f6b5dd..e07ed244551f39674c1a5033421ef804fdbd8abb 100644 (file)
@@ -1,5 +1,10 @@
 # CHANGES
 
+* version 3.5.2 - 2024-04-05
+    * Detail page: Link to postcode search not includes the country code
+    * test-suite: fix typos based on a codespell run
+    * NPM package updates (Svelte 4.2)
+
 * version 3.5.1 - 2024-02-14
     * Automatic release creation for 3.5.0 failed on Github Actions
 
index 23c25945baa3c53457c328b2b7add64469056112..b94e2a394fd741b37f4c96332c5f962228835638 100644 (file)
@@ -1,7 +1,7 @@
 {
   "name": "nominatim-ui",
   "description": "Debug web interface for Nominatim geocoder",
-  "version": "3.5.1",
+  "version": "3.5.2",
   "license": "GPL-2.0",
   "scripts": {
     "build": "rollup -c",
index 8b77df236c1d25a0f2f1457b0b5266fa9bf8fcc1..8ba3769b7b76188b1176485704be2e9dcd0c9a7b 100644 (file)
@@ -8,6 +8,7 @@
   export let addressLine;
   export let bDistanceInMeters;
   export let bMarkUnusedLines = false;
+  export let sCountryCode;
 
   $: bAddressLineUsed = addressLine.isaddress;
   $: reverse_only = Nominatim_Config.Reverse_Only;
@@ -38,7 +39,8 @@
         search by name
       </PageLink>
     {:else if !reverse_only && addressLine.type === 'postcode'}
-      <PageLink page='search' params_hash={{ postalcode: addressLine.localname }}>
+      <PageLink page='search'
+                params_hash={{ postalcode: addressLine.localname, country: sCountryCode }}>
         search by name
       </PageLink>
     {/if}
index 225d1a0662ff81353acd063e5ee50ba337c493af..aa3670f072f02c74ed61583bf689cb7f356048fd 100644 (file)
     );
   }
 
+  function country_code(aThisPlace) {
+    let aLine = aThisPlace.address.find((address_line) => address_line.type === 'country_code');
+    return aLine ? aLine.localname : null;
+  }
+
   $: {
     let pageinfo = $page;
     if (pageinfo.tab === 'details') {
     <div class="row">
       <div class="col-md-12">
         <h2>Address</h2>
-         <table id="address" class="table table-striped table-small">
+        <table id="address" class="table table-striped table-small">
           <thead>
             <tr>
               <th>Local name</th>
               {#each aPlace.address as addressLine}
                 <DetailsOneRow addressLine={addressLine}
                                bMarkUnusedLines={true}
-                               bDistanceInMeters={false} />
+                               bDistanceInMeters={false}
+                               sCountryCode={country_code(aPlace)} />
               {/each}
             {/if}
 
index 2d1094d78f3cf59372c4287434de0c238a6b6910..a6fd5e58068847e851df5fa284d67b66e9ebd467 100644 (file)
@@ -68,6 +68,12 @@ describe('Details Page', function () {
 
     // Reverse-only installation have no search index, therefore no keywords
     if (!reverse_only) {
+      it('should have a link to postcode which includes country code', async function () {
+        const url = 'search.html?postalcode=9490&country=li';
+
+        assert.strictEqual((await page.$$eval(`a[href="${url}"]`, (links) => links.length)), 1);
+      });
+
       it('should change url and add new header on clicking display keywords', async function () {
         let current_url;
         let display_headers;