Merge branch 'main' of https://github.com/moll-re/polyhack_2021
This commit is contained in:
commit
7db1c2736f
@ -1,41 +1,54 @@
|
||||
import datetime
|
||||
import random
|
||||
|
||||
def populate_data(Users, Events):
|
||||
Events.add_event(
|
||||
id = 1,
|
||||
name = "a",
|
||||
location_name = 'Center of Switzerland',
|
||||
location_coordinates = [46.8132, 8.2242],
|
||||
date = datetime.date.today() - datetime.timedelta(days=100)
|
||||
date = datetime.date.today() - datetime.timedelta(days=100),
|
||||
description = "slkjfslkdfjsldkfjsd"
|
||||
)
|
||||
Events.add_event(
|
||||
id = 2,
|
||||
name = "b",
|
||||
location_name = 'Center of Switzerland',
|
||||
location_coordinates = [46, 8],
|
||||
date = datetime.date.today() - datetime.timedelta(days=1)
|
||||
date = datetime.date.today() - datetime.timedelta(days=1),
|
||||
description = "slkjfslkdfjsldkfjsd"
|
||||
)
|
||||
Events.add_event(
|
||||
id = 3,
|
||||
name = "kfkslkjdf",
|
||||
location_name = 'Center of Switzerland',
|
||||
location_coordinates = [46.8132, 9],
|
||||
date = datetime.date.today() - datetime.timedelta(days=2)
|
||||
date = datetime.date.today() - datetime.timedelta(days=2),
|
||||
description = "slkjfslkdfjsldkfjsd"
|
||||
)
|
||||
Events.add_event(
|
||||
id = 4,
|
||||
name = "s",
|
||||
location_name = 'Center of Switzerland',
|
||||
location_coordinates = [47, 8.2242],
|
||||
date = datetime.date.today() - datetime.timedelta(days=3)
|
||||
date = datetime.date.today() - datetime.timedelta(days=3),
|
||||
description = "slkjfslkdfjsldkfjsd"
|
||||
)
|
||||
Events.add_event(
|
||||
id = 5,
|
||||
name = "d",
|
||||
location_name = 'Center of Switzerland',
|
||||
location_coordinates = [40.8132, 8.2242],
|
||||
date = datetime.date.today() - datetime.timedelta(days=56)
|
||||
date = datetime.date.today() - datetime.timedelta(days=56),
|
||||
description = "slkjfslkdfjsldkfjsd"
|
||||
)
|
||||
Events.add_event(
|
||||
id = 6,
|
||||
name = "kfkslkjdf",
|
||||
location_name = 'Zermatt',
|
||||
location_coordinates = [46.11654, 10.445683],
|
||||
date = datetime.date.today()
|
||||
date = datetime.date.today(),
|
||||
description = "slkjfslkdfjsldkfjsd"
|
||||
)
|
||||
|
||||
Users.add_user(
|
||||
@ -49,6 +62,8 @@ def populate_data(Users, Events):
|
||||
max_age=20,
|
||||
)
|
||||
u = Users.get_by_id(239842123)
|
||||
|
||||
for e in Events:
|
||||
e.add_review(text="Nice view, good weather. Would recommend.", rating=random.randint(0,5))
|
||||
u.travel_history.append(e)
|
||||
|
||||
|
@ -1,26 +1,35 @@
|
||||
|
||||
class Event:
|
||||
id = 0
|
||||
name = ""
|
||||
location_name = []
|
||||
location_coordinates = []
|
||||
description = ""
|
||||
reviews = []
|
||||
category = []
|
||||
weather_requirements = 0
|
||||
date = ""
|
||||
|
||||
image_path = "fallback.jpg"
|
||||
duration = "" # datetime object
|
||||
trip_to = "" # Trip object
|
||||
trip_back = ""
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
self.id = kwargs.pop("id")
|
||||
self.name = kwargs.pop("name")
|
||||
self.location_name = kwargs.pop("location_name")
|
||||
self.location_coordinates = kwargs.pop("location_coordinates")
|
||||
self.date = kwargs.pop("date")
|
||||
self.description = kwargs.pop("description")
|
||||
|
||||
|
||||
def find_optimal_trip(self):
|
||||
pass
|
||||
|
||||
def add_review(self, **kwargs):
|
||||
self.reviews.append(Review(**kwargs))
|
||||
|
||||
|
||||
@property
|
||||
def trip_is_good(self):
|
||||
pass
|
||||
@ -31,6 +40,13 @@ class Event:
|
||||
return self.trip_to.co2_savings + self.trip_back.co2_savings
|
||||
except:
|
||||
return 5
|
||||
@property
|
||||
def rating(self):
|
||||
return int(sum([r.rating for r in self.reviews]) / len(self.reviews))
|
||||
|
||||
@property
|
||||
def nreviews(self):
|
||||
return len(self.reviews)
|
||||
|
||||
|
||||
class Review:
|
||||
@ -54,9 +70,10 @@ class Events:
|
||||
self._events.append(Event(**kwargs))
|
||||
|
||||
def get_by_id(self, id):
|
||||
for e in self.events:
|
||||
for e in self._events:
|
||||
if e.id == id:
|
||||
return e
|
||||
return None
|
||||
|
||||
def __iter__(self):
|
||||
return iter(self._events)
|
53
server.py
53
server.py
@ -1,18 +1,22 @@
|
||||
from flask import Flask, render_template, request, request, session
|
||||
import random
|
||||
|
||||
from apis.interactive_maps import SwissMap
|
||||
from models.user import Users
|
||||
from models.event import Events
|
||||
from flask import Flask, render_template, request, request, session, abort
|
||||
import plotly.graph_objects as go
|
||||
from plotly.offline import plot
|
||||
|
||||
|
||||
from apis.interactive_maps import SwissMap
|
||||
from apis.weather import WeatherScoreCalculator
|
||||
from models.user import Users
|
||||
from models.event import Events
|
||||
|
||||
USERBASE = Users()
|
||||
MAP = SwissMap()
|
||||
EVENTBASE = Events()
|
||||
|
||||
WEATHERCALCULATOR = WeatherScoreCalculator()
|
||||
import dummy_data
|
||||
dummy_data.populate_data(USERBASE, EVENTBASE)
|
||||
|
||||
|
||||
|
||||
app = Flask(__name__)
|
||||
app.secret_key = 'A0Zr98j/3yX R~XHH!jmN]LWX/,?RT'
|
||||
|
||||
@ -20,17 +24,16 @@ app.secret_key = 'A0Zr98j/3yX R~XHH!jmN]LWX/,?RT'
|
||||
@app.route("/")
|
||||
def index():
|
||||
session["user_id"] = 239842123 # a perfectly safe login, hem hem
|
||||
wscore = WEATHERCALCULATOR.calc_weather_score(EVENTBASE.get_by_id(1))
|
||||
print(wscore)
|
||||
weather_icon = ["☀️","🌥️","🌧️","⛈️"][int(wscore/25)]
|
||||
print(weather_icon)
|
||||
context = {
|
||||
"title" : f"Event title {id}",
|
||||
"image_name" : "fallback.jpg",
|
||||
"star_rating" : random.randint(1,4),
|
||||
"reviews" : random.randint(10,30),
|
||||
"user" : USERBASE.get_by_id(session["user_id"]).name
|
||||
}
|
||||
return render_template("event_overview.html", context=context)
|
||||
|
||||
|
||||
|
||||
@app.route("/profile")
|
||||
def profile():
|
||||
uid = session["user_id"]
|
||||
@ -61,19 +64,25 @@ def profile():
|
||||
return render_template("user_detail.html", context=context, user=user)
|
||||
|
||||
|
||||
|
||||
@app.route("/get_event")
|
||||
def get_event():
|
||||
id = request.args.get("id", type = int)
|
||||
context = {
|
||||
"title" : f"Event title {id}",
|
||||
"image_name" : "fallback.jpg",
|
||||
"star_rating" : random.randint(1,4),
|
||||
"reviews" : random.randint(10,30),
|
||||
"user" : "Remy"
|
||||
}
|
||||
return render_template("event_card.html", context=context)
|
||||
eid = request.args.get("id", type = int)
|
||||
event = EVENTBASE.get_by_id(eid)
|
||||
if event:
|
||||
return render_template("event_card.html", event=event)
|
||||
else:
|
||||
abort(404)
|
||||
|
||||
|
||||
@app.route("/event/<event_id>")
|
||||
def event_detail(event_id):
|
||||
event = EVENTBASE.get_by_id(int(event_id))
|
||||
if event:
|
||||
return render_template("event_detail.html", event=event)
|
||||
else:
|
||||
abort(404)
|
||||
|
||||
|
||||
#############################
|
||||
## And, liftoff!
|
||||
app.run(port=8000, debug=True)
|
@ -1,4 +1,4 @@
|
||||
.bg-primary .btn-primary .btn-primary:hover{
|
||||
.bg-primary, .btn-primary, .btn-primary:hover{
|
||||
border-color: #D50505;
|
||||
background-color: #D50505 !important;
|
||||
|
||||
|
@ -28,6 +28,8 @@ function callData(counter) {
|
||||
//alert(result[0]);
|
||||
$(result).appendTo('.list');
|
||||
},
|
||||
error: function (result) {}
|
||||
error: function (result) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
<meta name="viewport" content="width=device-width,
|
||||
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<style>
|
||||
#map_5ba084a655cd4fc584236f2425f4de29 {
|
||||
#map_2b19214dbaf846488f2433d621b9a708 {
|
||||
position: relative;
|
||||
width: 100.0%;
|
||||
height: 100.0%;
|
||||
@ -35,13 +35,13 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="folium-map" id="map_5ba084a655cd4fc584236f2425f4de29" ></div>
|
||||
<div class="folium-map" id="map_2b19214dbaf846488f2433d621b9a708" ></div>
|
||||
|
||||
</body>
|
||||
<script>
|
||||
|
||||
var map_5ba084a655cd4fc584236f2425f4de29 = L.map(
|
||||
"map_5ba084a655cd4fc584236f2425f4de29",
|
||||
var map_2b19214dbaf846488f2433d621b9a708 = L.map(
|
||||
"map_2b19214dbaf846488f2433d621b9a708",
|
||||
{
|
||||
center: [46.8132, 8.2242],
|
||||
crs: L.CRS.EPSG3857,
|
||||
@ -55,157 +55,157 @@
|
||||
|
||||
|
||||
|
||||
var tile_layer_40152bdb738846ba8477c732f027648d = L.tileLayer(
|
||||
var tile_layer_5d96e6c02c1c4683b41982c3300a820b = L.tileLayer(
|
||||
"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
||||
{"attribution": "Data by \u0026copy; \u003ca href=\"http://openstreetmap.org\"\u003eOpenStreetMap\u003c/a\u003e, under \u003ca href=\"http://www.openstreetmap.org/copyright\"\u003eODbL\u003c/a\u003e.", "detectRetina": false, "maxNativeZoom": 12, "maxZoom": 12, "minZoom": 6, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}
|
||||
).addTo(map_5ba084a655cd4fc584236f2425f4de29);
|
||||
).addTo(map_2b19214dbaf846488f2433d621b9a708);
|
||||
|
||||
|
||||
var marker_0660c49d8fb24ff1b0409062f4679504 = L.marker(
|
||||
var marker_ca63f695315f4bb6b671d25118151e99 = L.marker(
|
||||
[46.8132, 8.2242],
|
||||
{}
|
||||
).addTo(map_5ba084a655cd4fc584236f2425f4de29);
|
||||
).addTo(map_2b19214dbaf846488f2433d621b9a708);
|
||||
|
||||
|
||||
var icon_c7f93358bcb44e67a5c367b728b8e3e5 = L.AwesomeMarkers.icon(
|
||||
var icon_2ad62ef64ac64cf88189dc11eed7cdf5 = L.AwesomeMarkers.icon(
|
||||
{"extraClasses": "fa-rotate-0", "icon": "info-sign", "iconColor": "white", "markerColor": "red", "prefix": "glyphicon"}
|
||||
);
|
||||
marker_0660c49d8fb24ff1b0409062f4679504.setIcon(icon_c7f93358bcb44e67a5c367b728b8e3e5);
|
||||
marker_ca63f695315f4bb6b671d25118151e99.setIcon(icon_2ad62ef64ac64cf88189dc11eed7cdf5);
|
||||
|
||||
|
||||
var popup_055041826c6e48abb64946ad1fd0e85c = L.popup({"maxWidth": "100%"});
|
||||
var popup_65fa70c1d5c044b0846c404db6263d30 = L.popup({"maxWidth": "100%"});
|
||||
|
||||
|
||||
var html_10f0fccc127d44768c1d1c9cba178d7e = $(`<div id="html_10f0fccc127d44768c1d1c9cba178d7e" style="width: 100.0%; height: 100.0%;">Center of Switzerland</div>`)[0];
|
||||
popup_055041826c6e48abb64946ad1fd0e85c.setContent(html_10f0fccc127d44768c1d1c9cba178d7e);
|
||||
var html_5ec8c647dc83447b832427368990bda9 = $(`<div id="html_5ec8c647dc83447b832427368990bda9" style="width: 100.0%; height: 100.0%;">Center of Switzerland</div>`)[0];
|
||||
popup_65fa70c1d5c044b0846c404db6263d30.setContent(html_5ec8c647dc83447b832427368990bda9);
|
||||
|
||||
|
||||
marker_0660c49d8fb24ff1b0409062f4679504.bindPopup(popup_055041826c6e48abb64946ad1fd0e85c)
|
||||
marker_ca63f695315f4bb6b671d25118151e99.bindPopup(popup_65fa70c1d5c044b0846c404db6263d30)
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
var marker_7591da9e5d7e4359a88df76b3ca54633 = L.marker(
|
||||
var marker_72f25b8a481b4aecb66a56c1cce6db63 = L.marker(
|
||||
[46.0, 8.0],
|
||||
{}
|
||||
).addTo(map_5ba084a655cd4fc584236f2425f4de29);
|
||||
).addTo(map_2b19214dbaf846488f2433d621b9a708);
|
||||
|
||||
|
||||
var icon_feda126eb8ff45d9bbfc7cba013e3274 = L.AwesomeMarkers.icon(
|
||||
var icon_d04bab6dbd2a4f93bcd2229321fecd08 = L.AwesomeMarkers.icon(
|
||||
{"extraClasses": "fa-rotate-0", "icon": "info-sign", "iconColor": "white", "markerColor": "red", "prefix": "glyphicon"}
|
||||
);
|
||||
marker_7591da9e5d7e4359a88df76b3ca54633.setIcon(icon_feda126eb8ff45d9bbfc7cba013e3274);
|
||||
marker_72f25b8a481b4aecb66a56c1cce6db63.setIcon(icon_d04bab6dbd2a4f93bcd2229321fecd08);
|
||||
|
||||
|
||||
var popup_60efbb58821e48d09d5f097eef3f26e0 = L.popup({"maxWidth": "100%"});
|
||||
var popup_2476bd5ce0394663bd5a68557e6da3f2 = L.popup({"maxWidth": "100%"});
|
||||
|
||||
|
||||
var html_ae4580e3548843a4b867da474fe9cd08 = $(`<div id="html_ae4580e3548843a4b867da474fe9cd08" style="width: 100.0%; height: 100.0%;">Center of Switzerland</div>`)[0];
|
||||
popup_60efbb58821e48d09d5f097eef3f26e0.setContent(html_ae4580e3548843a4b867da474fe9cd08);
|
||||
var html_459d0ba54a8a4667bb3f2782a2976e3c = $(`<div id="html_459d0ba54a8a4667bb3f2782a2976e3c" style="width: 100.0%; height: 100.0%;">Center of Switzerland</div>`)[0];
|
||||
popup_2476bd5ce0394663bd5a68557e6da3f2.setContent(html_459d0ba54a8a4667bb3f2782a2976e3c);
|
||||
|
||||
|
||||
marker_7591da9e5d7e4359a88df76b3ca54633.bindPopup(popup_60efbb58821e48d09d5f097eef3f26e0)
|
||||
marker_72f25b8a481b4aecb66a56c1cce6db63.bindPopup(popup_2476bd5ce0394663bd5a68557e6da3f2)
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
var marker_8853064d921840c1af5740f4ee2e34e6 = L.marker(
|
||||
var marker_1e5d760167f845eb8dbc5b1968eddb13 = L.marker(
|
||||
[46.8132, 9.0],
|
||||
{}
|
||||
).addTo(map_5ba084a655cd4fc584236f2425f4de29);
|
||||
).addTo(map_2b19214dbaf846488f2433d621b9a708);
|
||||
|
||||
|
||||
var icon_ecdd50362a7443c0873edecc52dc57fd = L.AwesomeMarkers.icon(
|
||||
var icon_ebad70bed4ff4660a48f2727d711b3fa = L.AwesomeMarkers.icon(
|
||||
{"extraClasses": "fa-rotate-0", "icon": "info-sign", "iconColor": "white", "markerColor": "red", "prefix": "glyphicon"}
|
||||
);
|
||||
marker_8853064d921840c1af5740f4ee2e34e6.setIcon(icon_ecdd50362a7443c0873edecc52dc57fd);
|
||||
marker_1e5d760167f845eb8dbc5b1968eddb13.setIcon(icon_ebad70bed4ff4660a48f2727d711b3fa);
|
||||
|
||||
|
||||
var popup_18d1efa0560d451985de1860e853f20d = L.popup({"maxWidth": "100%"});
|
||||
var popup_63700943084f4c08a9dd512565c9a140 = L.popup({"maxWidth": "100%"});
|
||||
|
||||
|
||||
var html_dc83f40370374bc5b716197a6d8bf3e5 = $(`<div id="html_dc83f40370374bc5b716197a6d8bf3e5" style="width: 100.0%; height: 100.0%;">Center of Switzerland</div>`)[0];
|
||||
popup_18d1efa0560d451985de1860e853f20d.setContent(html_dc83f40370374bc5b716197a6d8bf3e5);
|
||||
var html_a3c39fae2c8b46a2b75d947f4c613c9a = $(`<div id="html_a3c39fae2c8b46a2b75d947f4c613c9a" style="width: 100.0%; height: 100.0%;">Center of Switzerland</div>`)[0];
|
||||
popup_63700943084f4c08a9dd512565c9a140.setContent(html_a3c39fae2c8b46a2b75d947f4c613c9a);
|
||||
|
||||
|
||||
marker_8853064d921840c1af5740f4ee2e34e6.bindPopup(popup_18d1efa0560d451985de1860e853f20d)
|
||||
marker_1e5d760167f845eb8dbc5b1968eddb13.bindPopup(popup_63700943084f4c08a9dd512565c9a140)
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
var marker_f776dd130d2c41b4a4403cc20b089197 = L.marker(
|
||||
var marker_ff2f599e863c46f2bc6bd924a13464e9 = L.marker(
|
||||
[47.0, 8.2242],
|
||||
{}
|
||||
).addTo(map_5ba084a655cd4fc584236f2425f4de29);
|
||||
).addTo(map_2b19214dbaf846488f2433d621b9a708);
|
||||
|
||||
|
||||
var icon_eebb26101c2541aab20288eeba3fd092 = L.AwesomeMarkers.icon(
|
||||
var icon_766cef5e5b954f739795dc7a0e2a47e0 = L.AwesomeMarkers.icon(
|
||||
{"extraClasses": "fa-rotate-0", "icon": "info-sign", "iconColor": "white", "markerColor": "red", "prefix": "glyphicon"}
|
||||
);
|
||||
marker_f776dd130d2c41b4a4403cc20b089197.setIcon(icon_eebb26101c2541aab20288eeba3fd092);
|
||||
marker_ff2f599e863c46f2bc6bd924a13464e9.setIcon(icon_766cef5e5b954f739795dc7a0e2a47e0);
|
||||
|
||||
|
||||
var popup_7e654904d22f43bf9c55611b4a2d8f1a = L.popup({"maxWidth": "100%"});
|
||||
var popup_402264ea1bab4f3fb5fab2f065e8e2df = L.popup({"maxWidth": "100%"});
|
||||
|
||||
|
||||
var html_a6bd9db8dace4c23ac8bd4932f23e9b2 = $(`<div id="html_a6bd9db8dace4c23ac8bd4932f23e9b2" style="width: 100.0%; height: 100.0%;">Center of Switzerland</div>`)[0];
|
||||
popup_7e654904d22f43bf9c55611b4a2d8f1a.setContent(html_a6bd9db8dace4c23ac8bd4932f23e9b2);
|
||||
var html_9131a36e8c3c49e0bfd59ef28d9be5cb = $(`<div id="html_9131a36e8c3c49e0bfd59ef28d9be5cb" style="width: 100.0%; height: 100.0%;">Center of Switzerland</div>`)[0];
|
||||
popup_402264ea1bab4f3fb5fab2f065e8e2df.setContent(html_9131a36e8c3c49e0bfd59ef28d9be5cb);
|
||||
|
||||
|
||||
marker_f776dd130d2c41b4a4403cc20b089197.bindPopup(popup_7e654904d22f43bf9c55611b4a2d8f1a)
|
||||
marker_ff2f599e863c46f2bc6bd924a13464e9.bindPopup(popup_402264ea1bab4f3fb5fab2f065e8e2df)
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
var marker_531b4d892c1248528bed9e28c45a0071 = L.marker(
|
||||
var marker_3f88a80516a94c3583fc411b99719178 = L.marker(
|
||||
[40.8132, 8.2242],
|
||||
{}
|
||||
).addTo(map_5ba084a655cd4fc584236f2425f4de29);
|
||||
).addTo(map_2b19214dbaf846488f2433d621b9a708);
|
||||
|
||||
|
||||
var icon_207de4a422dd47d2ae255822073a20c5 = L.AwesomeMarkers.icon(
|
||||
var icon_2c84ed4b8f154af4bd365d584ec2a082 = L.AwesomeMarkers.icon(
|
||||
{"extraClasses": "fa-rotate-0", "icon": "info-sign", "iconColor": "white", "markerColor": "red", "prefix": "glyphicon"}
|
||||
);
|
||||
marker_531b4d892c1248528bed9e28c45a0071.setIcon(icon_207de4a422dd47d2ae255822073a20c5);
|
||||
marker_3f88a80516a94c3583fc411b99719178.setIcon(icon_2c84ed4b8f154af4bd365d584ec2a082);
|
||||
|
||||
|
||||
var popup_2e281073197241d69b565e29b7c30971 = L.popup({"maxWidth": "100%"});
|
||||
var popup_846c9cd927fd4d80a9ce464dad2ab2c3 = L.popup({"maxWidth": "100%"});
|
||||
|
||||
|
||||
var html_69e3f6cccf894922bb51d399f0f14421 = $(`<div id="html_69e3f6cccf894922bb51d399f0f14421" style="width: 100.0%; height: 100.0%;">Center of Switzerland</div>`)[0];
|
||||
popup_2e281073197241d69b565e29b7c30971.setContent(html_69e3f6cccf894922bb51d399f0f14421);
|
||||
var html_578e7e7d0d91472d970b4a1cdc32f30e = $(`<div id="html_578e7e7d0d91472d970b4a1cdc32f30e" style="width: 100.0%; height: 100.0%;">Center of Switzerland</div>`)[0];
|
||||
popup_846c9cd927fd4d80a9ce464dad2ab2c3.setContent(html_578e7e7d0d91472d970b4a1cdc32f30e);
|
||||
|
||||
|
||||
marker_531b4d892c1248528bed9e28c45a0071.bindPopup(popup_2e281073197241d69b565e29b7c30971)
|
||||
marker_3f88a80516a94c3583fc411b99719178.bindPopup(popup_846c9cd927fd4d80a9ce464dad2ab2c3)
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
var marker_106fb6cf83a745b7b8d01d3ac5399d23 = L.marker(
|
||||
var marker_b134bea0a19642428ea1441073f96dfb = L.marker(
|
||||
[46.11654, 10.445683],
|
||||
{}
|
||||
).addTo(map_5ba084a655cd4fc584236f2425f4de29);
|
||||
).addTo(map_2b19214dbaf846488f2433d621b9a708);
|
||||
|
||||
|
||||
var icon_bdbfc792d78445ef9257d0e9dc2e53a6 = L.AwesomeMarkers.icon(
|
||||
var icon_2a49b7f0516a4018be4142fc7297dfb0 = L.AwesomeMarkers.icon(
|
||||
{"extraClasses": "fa-rotate-0", "icon": "info-sign", "iconColor": "white", "markerColor": "red", "prefix": "glyphicon"}
|
||||
);
|
||||
marker_106fb6cf83a745b7b8d01d3ac5399d23.setIcon(icon_bdbfc792d78445ef9257d0e9dc2e53a6);
|
||||
marker_b134bea0a19642428ea1441073f96dfb.setIcon(icon_2a49b7f0516a4018be4142fc7297dfb0);
|
||||
|
||||
|
||||
var popup_5df9394c37c94f26bb59cfaf5b5216e5 = L.popup({"maxWidth": "100%"});
|
||||
var popup_d4d40d6cd05b4956892dc6d70a997b05 = L.popup({"maxWidth": "100%"});
|
||||
|
||||
|
||||
var html_b63d6c6945b546349c24295a4bebf7ca = $(`<div id="html_b63d6c6945b546349c24295a4bebf7ca" style="width: 100.0%; height: 100.0%;">Zermatt</div>`)[0];
|
||||
popup_5df9394c37c94f26bb59cfaf5b5216e5.setContent(html_b63d6c6945b546349c24295a4bebf7ca);
|
||||
var html_88e1de9e53184c4285695742f599624f = $(`<div id="html_88e1de9e53184c4285695742f599624f" style="width: 100.0%; height: 100.0%;">Zermatt</div>`)[0];
|
||||
popup_d4d40d6cd05b4956892dc6d70a997b05.setContent(html_88e1de9e53184c4285695742f599624f);
|
||||
|
||||
|
||||
marker_106fb6cf83a745b7b8d01d3ac5399d23.bindPopup(popup_5df9394c37c94f26bb59cfaf5b5216e5)
|
||||
marker_b134bea0a19642428ea1441073f96dfb.bindPopup(popup_d4d40d6cd05b4956892dc6d70a997b05)
|
||||
;
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" integrity="undefined" crossorigin="anonymous">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.min.js" integrity="undefined" crossorigin="anonymous"></script>
|
||||
<link href="static/custom-bootstrap-override.css" rel="stylesheet">
|
||||
<link href="/static/custom-bootstrap-override.css" rel="stylesheet">
|
||||
|
||||
<!-- Font Awesome JS -->
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.12/css/all.css" integrity="sha384-G0fIWCsCzJIMAVNQPfjH08cyYaUtMwjJwqiRKxxE/rx96Uroj1BtIQ6MLJuheaO9" crossorigin="anonymous">
|
||||
@ -14,7 +14,7 @@
|
||||
<!-- Jquery + ajax (dynamic content) -->
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
||||
|
||||
<script src="static/index.js"></script>
|
||||
<script src="/static/index.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -1,24 +1,26 @@
|
||||
<a href="event/{{event.id}}" style="color: inherit; text-decoration: none;">
|
||||
<div class="card mb-4 shadow">
|
||||
<!-- <div class="card-header"> -->
|
||||
<img src="static/{{ context.image_name }}" class="card-img-top" alt="...">
|
||||
<img src="static/{{ event.image_path }}" class="card-img-top" alt="...">
|
||||
<!-- </div> -->
|
||||
<div class="sep"></div>
|
||||
<div class="card-body">
|
||||
<h5 class="card-title ">{{ context.title }}</h5>
|
||||
<h5 class="card-title ">{{ event.name }}</h5>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item"><i class="far fa-clock"></i> Total duration: {{context.duration }}</li>
|
||||
<li class="list-group-item"><i class="far fa-map"></i> {{ context.location }}</li>
|
||||
<li class="list-group-item"><i class="far fa-clock"></i> Total duration: {{event.duration }}</li>
|
||||
<li class="list-group-item"><i class="far fa-map"></i> {{ event.location_name }}</li>
|
||||
<ul class="list-group-item d-flex justify-content-between align-items-center">
|
||||
<span>
|
||||
{% for n in range(context.star_rating) %}
|
||||
{% for n in range(event.rating) %}
|
||||
<i class="fas fa-star"></i>
|
||||
{% endfor %}
|
||||
{% for n in range(5 - context.star_rating) %}
|
||||
{% for n in range(5 - event.rating) %}
|
||||
<i class="far fa-star"></i>
|
||||
{% endfor %}
|
||||
</span>
|
||||
<span class="badge bg-secondary small rounded-pill">{{ context.reviews }} reviews</span>
|
||||
<span class="badge bg-secondary small rounded-pill">{{ event.nreviews }} reviews</span>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
@ -0,0 +1,38 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
|
||||
<h1 class="display-3">{{ event.name }}</h1>
|
||||
<div class="card mb-4 shadow">
|
||||
<!-- <div class="card-header"> -->
|
||||
<img src="/static/{{ event.image_path }}" class="card-img-top" alt="...">
|
||||
<!-- </div> -->
|
||||
<div class="sep"></div>
|
||||
<div class="card-body">
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item"><i class="far fa-clock"></i> Total duration: {{event.duration }}</li>
|
||||
<li class="list-group-item"><i class="far fa-map"></i> {{ event.location_name }}</li>
|
||||
<li class="list-group-item">{{ event.description }}</li>
|
||||
</ul>
|
||||
<span class="d-flex flex-row-reverse"><a href="" class="btn btn-primary">Book now</a></span>
|
||||
</div>
|
||||
</div>
|
||||
<h1 class="display-4">Reviews:</h1>
|
||||
|
||||
{% for r in event.reviews %}
|
||||
<div class="card mb-4 shadow">
|
||||
<div class="card-body">
|
||||
{{ r.text }}
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<span classs="d-flex align-items-center">
|
||||
{% for n in range(r.rating) %}
|
||||
<i class="fas fa-star"></i>
|
||||
{% endfor %}
|
||||
{% for n in range(5 - r.rating) %}
|
||||
<i class="far fa-star"></i>
|
||||
{% endfor %}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
Loading…
x
Reference in New Issue
Block a user