Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #263 - Request the removal of Geoman (Leaflet Plugin For Creati… #264

Merged
merged 2 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions smdb/smdb/forms.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Submit, Row, Column, Reset
from crispy_forms.layout import Layout, Submit, Div, Row, Column, Reset


class MissionFilterFormHelper(FormHelper):
Expand All @@ -13,11 +13,12 @@ class MissionFilterFormHelper(FormHelper):
Column("repeat_survey", css_class="form-group col-md mb-0"),
Column("mgds_compilation", css_class="form-group col-md mb-0"),
Column("expedition__name", css_class="form-group col-md mb-0"),
Column(Submit("submit", "Filter", css_class="col-md mb-0 btn-primary")),
Column(Submit("submit", "Filter", css_id="missionFilterSubmit", css_class="col-md mb-0 btn-primary")),
Column(
Reset(
"clear",
"Clear",
css_id="missionFilterCancel",
css_class="col-md mb-0 btn-secondary",
onclick="this.form.reset()",
type="button",
Expand All @@ -31,13 +32,14 @@ class ExpeditionFilterFormHelper(FormHelper):
form_method = "GET"
layout = Layout(
Row(
Column("name", css_class="form-group col-md mb-0"),
Column(Submit("submit", "Filter", css_class="col-md mb-0 btn-primary")),
Column("name", css_id="expeditionFilterName", css_class="form-group col-md-3 mb-0"),
Column(Submit("submit", "Filter", css_id="expeditionFilterSubmit", css_class="col-sm-2 mb-0 btn-primary")),
Column(
Reset(
"clear",
"Clear",
css_class="col-md mb-0 btn-secondary",
css_id="expeditionFilterCancel",
css_class="col-sm-2 mb-0 btn-secondary",
onclick="this.form.reset()",
type="button",
)
Expand All @@ -50,13 +52,14 @@ class CompilationFilterFormHelper(FormHelper):
form_method = "GET"
layout = Layout(
Row(
Column("name", css_class="form-group col-md mb-0"),
Column(Submit("submit", "Filter", css_class="col-md mb-0 btn-primary")),
Column("name", css_id="compilationFilterName", css_class="form-group col-md-3 mb-0"),
Column(Submit("submit", "Filter", css_id="compilationFilterSubmit", css_class="col-md-2 mb-0 btn-primary")),
Column(
Reset(
"clear",
"Clear",
css_class="col-md mb-0 btn-secondary",
css_id="compilationFilterCancel",
css_class="col-md-2 mb-0 btn-secondary",
onclick="this.form.reset()",
type="button",
)
Expand Down
70 changes: 68 additions & 2 deletions smdb/smdb/static/css/filters.css
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ div.col-md {
margin-top: 10px;
}

/* Buttons */
div.form-group.col-md-2,
div.col-md-2 {
width: 30%;
margin-bottom: 10px;
margin-top: 10px;
}

form.leaflet-control-layers-list {
top: 0px;
margin-right: 0px;
Expand All @@ -114,9 +122,9 @@ div.row {
height: 55px;
}

#div_id_name {
/* #div_id_name {
align-content: center;
}
} */

#submit_id_submit, .btn, .btn-primary {
border: 1.75px solid;
Expand All @@ -142,6 +150,13 @@ div#tableContainers4.table-container {
width: 95%;
}

div#div_id_name.mb-3 {
width: 100%;
margin-top: 0.5rem !important;
margin-bottom: 0.5rem !important;
}


#slider-row {
margin-left: 0.5rem;
margin-right: 0.5rem;
Expand All @@ -163,6 +178,57 @@ div#tableContainers4.table-container {
width: 80%
}

.mb-0
#missionFilterSubmit {
margin-bottom: 0.5rem !important;
margin-top: 0.5rem !important;
}

#mission_detail_row {
position: relative;
padding-top: 100px;
padding-bottom: 25px;
}

#mission_detail_notes_row, h3 {
position: relative;
padding-right: 25px;
top: 10px;
}

.mb-0
#expeditionFilterSubmit {
margin-bottom: 0.5rem !important;
margin-top: 0.5rem !important;
}

.col-md
#expeditionFilterSubmit {
width: 30%
}

#expedition_detail_row {
width: 30%;
}

#expedition_detail_row {
position: relative;
padding-top: 100px;
padding-bottom: 25px;
}

.mb-0
#compilationFilterSubmit {
margin-bottom: 0.5rem !important;
margin-top: 0.5rem !important;
}

#compilation_detail_row {
position: relative;
padding-top: 100px;
padding-bottom: 25px;
}

form#searchBarForm {
top: 0px;
position: relative;
Expand Down
46 changes: 0 additions & 46 deletions smdb/smdb/static/js/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -466,49 +466,3 @@ L.Control.Layers.include({
return layers;
},
});

//////// ADD GEOMAN for LEAFLET /////////
var toggle = L.easyButton({
position: "topright",
id: "geoMan",
states: [
{
stateName: "add-geoman",
icon: "fas fa-draw-polygon fa-xl",
title: "Show Geometry Toolbar",
onClick: function (control) {
map.pm.addControls({
position: "topright",
drawControls: true,
editControls: true,
editMode: false,
optionsControls: true,
customControls: true,
oneBlock: true,
enableGlobalRotateMode: true,
});
control.state("remove-geoman");
// Check Geoman Geometry Tool Status
if (control.state("remove-geoman")) {
console.log("Geoman menu open!");
// toggle.onClick = updateMap();
}
},
},
{
stateName: "remove-geoman",
icon: "fa-undo",
title: "Hide Geometry Toolbar",
onClick: function (control) {
map.pm.removeControls();
control.state("add-geoman");
// Check Geoman Geometry Tool Status
if (control.state("add-geoman")) {
console.log("Geoman menu closed!");
}
// toggle.onClick = updateMap();
},
},
],
});
toggle.addTo(map);
11 changes: 0 additions & 11 deletions smdb/smdb/static/js/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,6 @@ function updateMap() {
// Catch degenerate case when checkboxes aren't on the page and continue
console.log(err.message);
}
// Try and incorporate with updateMap() - Easy Button
if ((toggle = "remove-geoman")) {
console.log("This works.");
}
if ((toggle.stateName = "add-geoman")) {
console.log("Geoman is currently closed.");
toggle.stateName = "remove-geoman";
} else if ((toggle.stateName = "remove-geoman")) {
console.log("Geoman is currently open.");
toggle.stateName = "add-geoman";
}

if (document.getElementById("searchbar") != null) {
//if (document.getElementById("searchbar").value) {
Expand Down
1 change: 0 additions & 1 deletion smdb/smdb/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

{# Add leaflet CSS #}
<link rel="stylesheet" type="text/css" href="https://unpkg.com/[email protected]/dist/leaflet.css">
<link rel="stylesheet" href="https://unpkg.com/@geoman-io/leaflet-geoman-free@latest/dist/leaflet-geoman.css">

{# Your stuff: Third-party CSS libraries go here #}
<link href="https://cdn.jsdelivr.net/npm/[email protected]/fonts/remixicon.css" rel="stylesheet">
Expand Down
3 changes: 0 additions & 3 deletions smdb/smdb/templates/pages/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@
integrity="sha512-pYExthzLUD0etGnsvN2vg1LOEBd0nAfIwgZWlxavdBPNc2JT+f9hDQrXJrIhHK5WmuHVAuAb8jDekD36P/pXhg=="
crossorigin=""></script>

{# Load Leaflet Geometry Tool from CDN #}
<script src="https://unpkg.com/@geoman-io/leaflet-geoman-free@latest/dist/leaflet-geoman.min.js"></script>

{# Load Leaflet Grouped Layers Control#}
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet-groupedlayercontrol/0.6.1/leaflet.groupedlayercontrol.js"></script>
{#<script src="../../static/js/leaflet.groupedlayercontrol.js"></script>#}
Expand Down
4 changes: 2 additions & 2 deletions smdb/smdb/templates/smdb/expedition_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

{% block content %}
<tab>
<div class="row">
<div class="col">
<div class="row" id="expedition_detail_row">
<div class="col-md-3" id="expedition_detail_col">
<h2>{{ expedition.name }}</h2>
<h2>Missions:</h2>
<div>
Expand Down
7 changes: 3 additions & 4 deletions smdb/smdb/templates/smdb/mission_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
{% block content %}

<!-- A Bootstrap two column presentation-->
<div class="row">
<div class="col">
<div class="row" id="mission_detail_row">
<div class="col" id="mission_detail_col">
<h2>Mission {{ mission.name }}</h2>
<a href="{{ thumbnail_fullrez_url }}"><img src="{{ thumbnail_url }}" /></a>
<div>
Expand Down Expand Up @@ -66,8 +66,7 @@ <h2>Used in Compilations:</h2>
</div>
</div>
</div>
<br><br>
<div class="row">
<div class="row" id="mission_detail_notes_row">
<h3>Notes:</h3>
<pre>{{ mission.notes_text }}</pre>
</div>
Expand Down