forked from orson/bachemap
ahora con menos comentarios de codigo basura
This commit is contained in:
parent
94fb44661f
commit
04482e4c3b
13
app.py
13
app.py
@ -22,7 +22,6 @@ def create_app():
|
|||||||
mongo = PyMongo(app)
|
mongo = PyMongo(app)
|
||||||
login_manager = LoginManager(app)
|
login_manager = LoginManager(app)
|
||||||
login_manager.session_protection = "strong"
|
login_manager.session_protection = "strong"
|
||||||
#form = PinForm()
|
|
||||||
|
|
||||||
class User(UserMixin):
|
class User(UserMixin):
|
||||||
def __init__(self, user_data):
|
def __init__(self, user_data):
|
||||||
@ -76,11 +75,7 @@ def create_app():
|
|||||||
pins = mongo.db.pins.find()
|
pins = mongo.db.pins.find()
|
||||||
return render_template('index.html', pins=pins, form=form)
|
return render_template('index.html', pins=pins, form=form)
|
||||||
else:
|
else:
|
||||||
#@app.route('/add_pin')
|
|
||||||
#def add_pin():
|
|
||||||
form = request.form
|
form = request.form
|
||||||
# if form.validate_on_submit():
|
|
||||||
#description = form.description.data
|
|
||||||
try:
|
try:
|
||||||
photo = request.files["photo"]
|
photo = request.files["photo"]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -92,7 +87,6 @@ def create_app():
|
|||||||
photo.save(filepath)
|
photo.save(filepath)
|
||||||
|
|
||||||
pin = {
|
pin = {
|
||||||
#'description': description,
|
|
||||||
'time': datetime.now(),
|
'time': datetime.now(),
|
||||||
'photo': filepath,
|
'photo': filepath,
|
||||||
'lat': request.form['lat'],
|
'lat': request.form['lat'],
|
||||||
@ -105,13 +99,6 @@ def create_app():
|
|||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
else:
|
else:
|
||||||
return allowed_file(photo.filename), 404
|
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')
|
@app.route('/quienes')
|
||||||
def quienes():
|
def quienes():
|
||||||
return render_template('quienes.html')
|
return render_template('quienes.html')
|
||||||
|
|||||||
@ -4,7 +4,6 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Interactive Map</title>
|
<title>Interactive Map</title>
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='pico.amber.css') }}">
|
<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"
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
|
||||||
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
|
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
|
||||||
crossorigin=""/>
|
crossorigin=""/>
|
||||||
@ -12,12 +11,6 @@
|
|||||||
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
|
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
|
||||||
crossorigin=""></script>
|
crossorigin=""></script>
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
|
<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') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
@ -66,7 +59,6 @@
|
|||||||
|
|
||||||
</body>
|
</body>
|
||||||
<script>
|
<script>
|
||||||
// pin button logic
|
|
||||||
const observer = new MutationObserver((mutations) => {
|
const observer = new MutationObserver((mutations) => {
|
||||||
const element = document.getElementById('pinner-pop');
|
const element = document.getElementById('pinner-pop');
|
||||||
if (element) {
|
if (element) {
|
||||||
@ -74,7 +66,6 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
const pinner_button_top = document.getElementById("pinner-top");
|
const pinner_button_top = document.getElementById("pinner-top");
|
||||||
//var pinner_button_pop = document.getElementById("pinner-pop");
|
|
||||||
const modal_stat = document.getElementById("pinner-modal");
|
const modal_stat = document.getElementById("pinner-modal");
|
||||||
function toggleSlide() {
|
function toggleSlide() {
|
||||||
if (modal_stat.hidden === true) {
|
if (modal_stat.hidden === true) {
|
||||||
|
|||||||
@ -3,11 +3,9 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<div id="map" style="height: 100%; border-style: groove; border-radius: 22px; border-width: 4px; position: absolute;"></div>
|
<div id="map" style="height: 100%; border-style: groove; border-radius: 22px; border-width: 4px; position: absolute;"></div>
|
||||||
<script>
|
<script>
|
||||||
//setView([51.505, -0.09], 13);
|
|
||||||
var map = new L.map('map', {zoomControl: false}, center=([20.57, -100.38], zoom=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_marker = new L.marker([20.57, -100.38]);
|
||||||
var user_radial = new L.circle(L.circle(user_marker.latlng));
|
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
|
//types of markers
|
||||||
var iconTypes = {
|
var iconTypes = {
|
||||||
@ -32,16 +30,7 @@
|
|||||||
.bindPopup("<b>{{ pin.description }}</b><p>Fecha del reporte: {{pin.time}}</p><br><img src='{{ pin.photo }}'>");
|
.bindPopup("<b>{{ pin.description }}</b><p>Fecha del reporte: {{pin.time}}</p><br><img src='{{ pin.photo }}'>");
|
||||||
{% endfor %}
|
{% 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.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||||
//L.tileLayer('https://{s}.tile-cyclosm.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png', {
|
|
||||||
attribution: '© OpenStreetMap contributors'
|
attribution: '© OpenStreetMap contributors'
|
||||||
}).addTo(map);
|
}).addTo(map);
|
||||||
|
|
||||||
@ -49,17 +38,13 @@
|
|||||||
// Geolocation function
|
// Geolocation function
|
||||||
function onLocationFound(e) {
|
function onLocationFound(e) {
|
||||||
var radius = e.accuracy / 2; // Accuracy of the location
|
var radius = e.accuracy / 2; // Accuracy of the location
|
||||||
|
|
||||||
// Add a pin (marker) at the user's location
|
// Add a pin (marker) at the user's location
|
||||||
user_marker = L.marker(e.latlng).addTo(map)
|
user_marker = L.marker(e.latlng).addTo(map)
|
||||||
.bindPopup("Te detectamos en un radio de " + radius + " metros de este punto").openPopup();
|
.bindPopup("Te detectamos en un radio de " + radius + " metros de este punto").openPopup();
|
||||||
|
|
||||||
// Add a circle around the user's location
|
// Add a circle around the user's location
|
||||||
user_radial = L.circle(e.latlng, radius).addTo(map);
|
user_radial = L.circle(e.latlng, radius).addTo(map);
|
||||||
|
|
||||||
// Center the map on the user's location
|
// Center the map on the user's location
|
||||||
map.setView(e.latlng, 16); // Adjust zoom level as needed
|
map.setView(e.latlng, 16); // Adjust zoom level as needed
|
||||||
//return marker, radial;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error handling for geolocation
|
// Error handling for geolocation
|
||||||
@ -78,19 +63,8 @@
|
|||||||
document.getElementById('lat').value = latlng.lat;
|
document.getElementById('lat').value = latlng.lat;
|
||||||
document.getElementById('lng').value = latlng.lng;
|
document.getElementById('lng').value = latlng.lng;
|
||||||
map.flyTo(e.latlng, zoom=18);
|
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_marker.setLatLng(e.latlng).bindPopup('<button id="pinner-pop">Agregar bache-o-cosa</button>').openPopup();
|
||||||
user_radial.remove();
|
user_radial.remove();
|
||||||
//setLanLng(e.latlng);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@ -9,10 +9,10 @@
|
|||||||
<h3>Este proyecto es de gente libre para gente libre</h3>
|
<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 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>
|
<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>
|
<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>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>
|
</div>
|
||||||
|
|||||||
@ -5,11 +5,6 @@
|
|||||||
<title>Interactive Map</title>
|
<title>Interactive Map</title>
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='pico.amber.css') }}">
|
<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') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user