-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
zone.js | ||
MIT | ||
The MIT License | ||
|
||
Copyright (c) 2010-2022 Google LLC. https://angular.io/license | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" data-critters-container> | ||
<head><base href="./"> | ||
<meta charset="utf-8"> | ||
<title>Geoadmin + Geocat Search</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<script src="https://cdn.jsdelivr.net/gh/camptocamp/geocat-geonetwork-ui@wc-dist-geocat-gpf/gn-wc.js"></script> | ||
<style>body,html{margin:0;padding:0;height:100%;font-family:Arial,sans-serif}.map-container{position:relative;width:100%;height:100vh}.search-container{position:absolute;top:60px;left:20px;width:300px;z-index:10}#search{width:100%;padding:10px;margin-bottom:0;border:1px solid #ddd;border-radius:8px;box-shadow:0 2px 4px #0000001a}#results{background:white;border:1px solid #ddd;border-radius:8px;list-style:none;padding:0;margin:0;max-height:400px;overflow-y:auto;box-shadow:0 4px 6px #0000001a;width:100%}#geoadmin-root{width:100%;height:100vh;border:none}</style><link rel="stylesheet" href="styles.14d8a527d228c33c.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles.14d8a527d228c33c.css"></noscript></head> | ||
<body> | ||
<div class="map-container"> | ||
<div class="search-container"> | ||
<input type="text" id="search" placeholder="Search for record.."> | ||
<ul id="results"></ul> | ||
</div> | ||
<iframe id="geoadmin-root" src="https://map.geo.admin.ch/#embed?bgLayer=ch.swisstopo.pixelkarte-grau"></iframe> | ||
</div> | ||
<script> | ||
const searchInput = document.getElementById('search'); | ||
const resultsContainer = document.getElementById('results'); | ||
|
||
searchInput.addEventListener('input', (e) => { | ||
const searchTerm = e.target.value; | ||
|
||
if (!searchTerm) { | ||
resultsContainer.innerHTML = ''; | ||
return; | ||
} | ||
|
||
GNUI.recordsRepository | ||
.search({ | ||
filters: { | ||
any: searchTerm, | ||
linkProtocol: '/OGC:WMT?S.*/', | ||
}, | ||
offset: 0, | ||
limit: 10, | ||
sort: ['desc', '_score'], | ||
fields: ['resourceTitleObject', 'link', 'uuid'], | ||
}) | ||
.subscribe({ | ||
next: (results) => { | ||
displayResults(results.records); | ||
}, | ||
error: (err) => { | ||
console.error('Error fetching search results:', err); | ||
} | ||
}); | ||
}); | ||
|
||
function displayResults(items) { | ||
resultsContainer.innerHTML = items | ||
.map( | ||
(item) => ` | ||
<li> | ||
<div> | ||
<div class="result-title">${item.title || 'No title available'}</div> | ||
</div> | ||
<button class="open-btn" data-uuid="${item.uniqueIdentifier}">Open</button> | ||
</li> | ||
` | ||
) | ||
.join(''); | ||
|
||
resultsContainer.querySelectorAll('.open-btn').forEach((btn) => { | ||
btn.addEventListener('click', (e) => { | ||
const uuid = e.target.dataset.uuid; | ||
console.log('Selected UUID:', uuid); | ||
|
||
const existingContainer = document.querySelector('.gn-record-view-container'); | ||
if (existingContainer) { | ||
existingContainer.remove(); | ||
} | ||
|
||
const container = document.createElement('div'); | ||
container.classList.add('gn-record-view-container'); | ||
|
||
const closeButton = document.createElement('button'); | ||
closeButton.classList.add('close-btn'); | ||
closeButton.innerHTML = '×'; | ||
closeButton.addEventListener('click', () => { | ||
container.remove(); | ||
}); | ||
|
||
const recordView = document.createElement('gn-record-view'); | ||
recordView.setAttribute('api-url', 'https://www.geocat.ch/geonetwork/srv/api'); | ||
recordView.setAttribute('primary-color', '#0f4395'); | ||
recordView.setAttribute('secondary-color', '#8bc832'); | ||
recordView.setAttribute('record-id', uuid); | ||
|
||
container.appendChild(closeButton); | ||
container.appendChild(recordView); | ||
|
||
document.body.appendChild(container); | ||
}); | ||
}); | ||
} | ||
|
||
</script> | ||
<script src="runtime.8339a0f837fda2e5.js" type="module"></script><script src="polyfills.04dda538a81fc9e4.js" type="module"></script><script src="main.9c5c1285d2d75fd1.js" type="module"></script></body> | ||
</html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.