1
0
forked from orson/bachemap

ahora con menos comentarios de codigo basura

This commit is contained in:
Orson 2024-08-31 18:00:54 -06:00
parent 94fb44661f
commit 04482e4c3b
5 changed files with 4 additions and 57 deletions

13
app.py
View File

@ -22,7 +22,6 @@ def create_app():
mongo = PyMongo(app)
login_manager = LoginManager(app)
login_manager.session_protection = "strong"
#form = PinForm()
class User(UserMixin):
def __init__(self, user_data):
@ -76,11 +75,7 @@ def create_app():
pins = mongo.db.pins.find()
return render_template('index.html', pins=pins, form=form)
else:
#@app.route('/add_pin')
#def add_pin():
form = request.form
# if form.validate_on_submit():
#description = form.description.data
try:
photo = request.files["photo"]
except Exception as e:
@ -92,7 +87,6 @@ def create_app():
photo.save(filepath)
pin = {
#'description': description,
'time': datetime.now(),
'photo': filepath,
'lat': request.form['lat'],
@ -105,13 +99,6 @@ def create_app():
return redirect(url_for('index'))
else:
return allowed_file(photo.filename), 404
#render_template('index.html', pins=pins, form=form)
#except Exception as e:
# flash(f'An error occurred: {e}')
#return redirect(url_for('add_pin'))
#else:
# flash('Invalid file type. Only images are allowed.')
#return render_template('index.html', form=form)
@app.route('/quienes')
def quienes():
return render_template('quienes.html')

View File

@ -4,7 +4,6 @@
<meta charset="UTF-8">
<title>Interactive Map</title>
<link rel="stylesheet" href="{{ url_for('static', filename='pico.amber.css') }}">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
crossorigin=""/>
@ -12,12 +11,6 @@
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
crossorigin=""></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
<!--<script type="text/javascript" src="https://stamen-maps.a.ssl.fastly.net/js/tile.stamen.js?v1.3.0"></script>-->
<!--<link rel="stylesheet" href="{{ url_for('static', filename='leaflet.css') }}">
<script src="{{ url_for('static', filename='leaflet.js') }}"></script>-->
<link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
</head>
@ -66,7 +59,6 @@
</body>
<script>
// pin button logic
const observer = new MutationObserver((mutations) => {
const element = document.getElementById('pinner-pop');
if (element) {
@ -74,7 +66,6 @@
}
})
const pinner_button_top = document.getElementById("pinner-top");
//var pinner_button_pop = document.getElementById("pinner-pop");
const modal_stat = document.getElementById("pinner-modal");
function toggleSlide() {
if (modal_stat.hidden === true) {

View File

@ -3,11 +3,9 @@
{% block content %}
<div id="map" style="height: 100%; border-style: groove; border-radius: 22px; border-width: 4px; position: absolute;"></div>
<script>
//setView([51.505, -0.09], 13);
var map = new L.map('map', {zoomControl: false}, center=([20.57, -100.38], zoom=13));
var user_marker = new L.marker([20.57, -100.38]);
var user_radial = new L.circle(L.circle(user_marker.latlng));
//L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
//types of markers
var iconTypes = {
@ -32,16 +30,7 @@
.bindPopup("<b>{{ pin.description }}</b><p>Fecha del reporte: {{pin.time}}</p><br><img src='{{ pin.photo }}'>");
{% endfor %}
//var live_location = map.locate()
//if (navigator.geolocation) {
// navigator.geolocation.getCurrentPosition((position)) => {
// change map position
// };
// };
//var youarehere = L.marker([latlng.lat, latlng.lng]).addTo(map);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
//L.tileLayer('https://{s}.tile-cyclosm.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap contributors'
}).addTo(map);
@ -49,17 +38,13 @@
// Geolocation function
function onLocationFound(e) {
var radius = e.accuracy / 2; // Accuracy of the location
// Add a pin (marker) at the user's location
user_marker = L.marker(e.latlng).addTo(map)
.bindPopup("Te detectamos en un radio de " + radius + " metros de este punto").openPopup();
// Add a circle around the user's location
user_radial = L.circle(e.latlng, radius).addTo(map);
// Center the map on the user's location
map.setView(e.latlng, 16); // Adjust zoom level as needed
//return marker, radial;
}
// Error handling for geolocation
@ -78,19 +63,8 @@
document.getElementById('lat').value = latlng.lat;
document.getElementById('lng').value = latlng.lng;
map.flyTo(e.latlng, zoom=18);
//map.eachLayer( function (layer)) {
// console.log(layer);
// map.removeLayer(layer);
//};
//marker.remove();
//radial.remove();
user_marker.setLatLng(e.latlng).bindPopup('<button id="pinner-pop">Agregar bache-o-cosa</button>').openPopup();
user_radial.remove();
//setLanLng(e.latlng);
});
});
</script>
{% endblock %}

View File

@ -9,11 +9,11 @@
<h3>Este proyecto es de gente libre para gente libre</h3>
<p>Si ves este mapa y te molesta que alguien se atreva a profanar el nombre de [inserte su partido político favorito aquí], entonces deja de trabajar para quienes no tienen ni un ápice de escrúpulos.</p>
<p>Si quieres participar en este proyecto aportando datos valiosos, consigue que alguien te de una invitación, porque si nadie te invita, no estás invitad@.</p>
<br>
<h2>Este mapa no hubiera sido posible si no hubieramos conocido a José Luis Ramos</h2>
<p>José Luis falleció en Marzo del 2024. No sólo se nos fue una persona maravillosa, sino también el activista más activo que much@s de nosotr@s conocimos. Este mapa es un homenaje a su vida y a la lucha que encabezó siempre buscando hacer del mundo un lugar mejor para <b>tod@s</b>. Sí, incluso para quienes nunca lo entendieron a él o a su lucha.</p>
<p>Nos volveremos a ver, amigo José Luis, y rodaremos juntos de nuevo. Esperamos que te estés riendo desde las alturas de tu vuelo <3 </p>
<p>Nos volveremos a ver, amigo José Luis, y rodaremos juntos de nuevo. Esperamos que te estés riendo desde las alturas de tu vuelo </p>
<img src="{{url_for('static', filename='images/ramos.jpg')}}">
<img src="{{url_for('static', filename='images/ramos.jpg')}}">
</div>
{% endblock %}

View File

@ -5,11 +5,6 @@
<title>Interactive Map</title>
<link rel="stylesheet" href="{{ url_for('static', filename='pico.amber.css') }}">
<!--<link rel="stylesheet" href="{{ url_for('static', filename='leaflet.css') }}">
<script src="{{ url_for('static', filename='leaflet.js') }}"></script>-->
<link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
</head>