Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
File size: 3,976 Bytes
ebc2ece a1551a6 4008992 a1551a6 ebc2ece a1551a6 ebc2ece 4008992 ebc2ece a1551a6 ebc2ece e8f588a ebc2ece e8f588a ebc2ece 13a019a ebc2ece a1551a6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
from branca.element import Template, MacroElement
labels_unverified_requests="""
<li><span style='background:#CE3C28;opacity:0.7;'></span>Rescue / Secours / إغاثة</li>
<li><span style='background:#ED922E;opacity:0.7;'></span>Medical Assistance / Assistance Médicale / مساعدة طبية</li>
<li><span style='background:#FFCA92;opacity:0.7;'></span>Shelter / Abris / مأوى</li>
<li><span style='background:#37A8DA;opacity:0.7;'></span>Food & Water / Nourriture et eau / طعام وماء</li>
<li><span style='background:#575757;opacity:0.7;'></span>Dangers / Dangers / مخاطر</li>
<li><span style='background:#6EAA25;opacity:0.7;'></span>Done / terminée / تم</li>
<li><span style='background:#023020;opacity:0.7;'></span>Partial / Partiellement terminée / تم جزئيا</li>
<li><span style='background:#FF91E8;opacity:0.7;'></span>Planned / Prévue / مخطط لها</li>
"""
labels_verified="""
<li><span style='background:#CE3C28;opacity:0.7;'></span>High Emergency / طوارئ عالية</li>
<li><span style='background:#ED922E;opacity:0.7;'></span>Medium Emergency / طوارئ متوسطة</li>
<li><span style='background:#FFCA92;opacity:0.7;'></span>Low Emergency / طوارئ منخفضة</li>
<li><span style='background:#6EAA25;opacity:0.7;'></span>Done / تم</li>
<li><span style='background:#023020;opacity:0.7;'></span>Partial / تم جزئيا</li>
<li><span style='background:#FF91E8;opacity:0.7;'></span>Planned / مخطط لها</li>
"""
template_1 = """
{% macro html(this, kwargs) %}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery UI Draggable - Default functionality</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$( function() {
$( "#maplegend" ).draggable({
start: function (event, ui) {
$(this).css({
right: "auto",
top: "auto",
bottom: "auto"
});
}
});
});
</script>
</head>
<body>
<div id='maplegend' class='maplegend'
style='position: absolute; z-index:9999; border:2px solid grey; background-color:rgba(255, 255, 255, 0.8);
border-radius:6px; padding: 10px; font-size:14px; right: 20px; bottom: 20px;'>
<div class='legend-title'>Legend / Nomenclature / مفتاح الخريطة</div>
<div class='legend-scale'>
<ul class='legend-labels'>
"""
template_2 = """
</ul>
</div>
</div>
</body>
</html>
<style type='text/css'>
.maplegend .legend-title {
text-align: left;
margin-bottom: 5px;
font-weight: bold;
font-size: 90%;
color: #333;
}
.maplegend .legend-scale ul {
margin: 0;
margin-bottom: 5px;
padding: 0;
float: left;
list-style: none;
}
.maplegend .legend-scale ul li {
font-size: 80%;
list-style: none;
margin-left: 0;
line-height: 18px;
margin-bottom: 2px;
color: #111;
}
.maplegend ul.legend-labels li span {
display: block;
float: left;
height: 16px;
width: 30px;
margin-right: 5px;
margin-left: 0;
border: 1px solid #999;
}
.maplegend .legend-source {
font-size: 80%;
color: #777;
clear: both;
}
.maplegend a {
color: #777;
}
.leaflet-control-geocoder-form input {
color: black;
}
</style>
{% endmacro %}"""
def get_legend_macro(show_unverified):
legend_macro = MacroElement()
legend_macro._template = Template(template_1 + (labels_unverified_requests if show_unverified else labels_verified) + template_2)
return legend_macro
__all__ = ["get_legend_macro"] |