Skip to content

Commit

Permalink
add the map to the entry creation page
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaelicke committed Nov 8, 2024
1 parent f8d60b3 commit 2747820
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
1 change: 1 addition & 0 deletions metacatalog_api/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def variables(id: int = None, only_available: bool = False, offset: int = None,

return variables


def add_entry(flat_dict: dict) -> Metadata:
# get the variable
# TODO: put this into the server, as this is due to the FORM. the core package should use the payload model
Expand Down
26 changes: 22 additions & 4 deletions metacatalog_api/templates/add_entry.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@ <h3 class="text-lg font-semibold text-gray-800">Authors</h3>
</div>
</div>

<div x-data="{open: false}">
<div class="flex justify-between items-center p-4 bg-gray-100 border-b border-gray-300 cursor-pointer" @click="open = !open;window.dispatchEvent(new Event('resize'));">
<h2 class="text-lg font-medium text-gray-700">Location</h2>
<svg class="w-6 h-6 text-gray-700" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
</svg>
</div>
<div class="flex flex-col space-y-4 p-4" x-show="open" x-collapse>
<div class="flex flex-col space-y-2">
<div class="w-full h-96 border border-gray-300 rounded-md">
<div hx-get="/utils/leaflet_draw.html?embedded=true&view-inputs" hx-trigger="load" hx-swap="outerHTML"></div>
</div>
</div>
</div>


<div x-data="{open: false}">
<div class="flex justify-between items-center p-4 bg-gray-100 border-b border-gray-300 cursor-pointer" @click="open = !open">
<h2 class="text-lg font-medium text-gray-700">License</h2>
Expand Down Expand Up @@ -69,10 +85,7 @@ <h2 class="text-lg font-medium text-gray-700">Details</h2>
<button type="submit" class="px-4 py-4 bg-blue-500 text-white rounded-md hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2">
Save Entry
</button>
</div>



</div>

</form>

Expand All @@ -81,3 +94,8 @@ <h2 class="text-lg font-medium text-gray-700">Details</h2>
<script defer src="https://cdn.jsdelivr.net/npm/@alpinejs/[email protected]/dist/cdn.min.js"></script>
<script src="//unpkg.com/alpinejs" defer></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/stemmer/lib/Snowball.min.js"></script>
<!-- leaflet -->
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin=""/>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js" integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.draw.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.draw.min.css" rel="stylesheet">

0 comments on commit 2747820

Please sign in to comment.