diff --git a/README.md b/README.md index 8989126..5ab0ea2 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,15 @@ ### summary: this repository includes the webpage frontend for the calendar watch server -it gets served via a python server \ No newline at end of file +it gets served via a python server + +### app description: + +Longitude is a 24h slow watch-face. +The Sun moves around the watch over the course of the day, while the planet completes a rotation every hour. Add your Calendar via a web-platform, so that every glance at your watch shows a summary of your day. + +Version 0.1 (beta): +- This version of the watchface includes the sun and the planet for time visualization + +Future (beta): +- The next version will add support for connecting the device to the web platform diff --git a/app.db b/app.db index b9794f2..c834ba8 100644 Binary files a/app.db and b/app.db differ diff --git a/backend b/backend index 804ab33..ba912de 160000 --- a/backend +++ b/backend @@ -1 +1 @@ -Subproject commit 804ab33a6d07b34c2f0942a63c71f652dfb067f3 +Subproject commit ba912de7f312f130e6916f067c15585143dfd6c2 diff --git a/server/googleHandler.py b/server/googleHandler.py index 62cbd36..b36b089 100644 --- a/server/googleHandler.py +++ b/server/googleHandler.py @@ -94,21 +94,22 @@ def get_google_provider_cfg(): return requests.get(GOOGLE_DISCOVERY_URL).json() class Calendar: - def __init__(self, name, toggle='False', color="#000000"): + def __init__(self, name, calendarId, toggle='False', color="#000000"): self.name = name self.color = color self.toggle=toggle + self.calendarId = calendarId def calendarsFromDb(): calendars = dbCalendar.getCalendars(dbCalendar, current_user.id) pyCalendars = [] for calendar in calendars: name = calendar.name - # calId = calendar.calendar_id + calendarId = calendar.calendar_id toggle = calendar.toggle color = calendar.color - pyCalendars.append(Calendar(name, toggle, color)) + pyCalendars.append(Calendar(name, calendarId, toggle, color)) return pyCalendars diff --git a/server/models.py b/server/models.py index 245f1a5..b28cbce 100644 --- a/server/models.py +++ b/server/models.py @@ -68,12 +68,12 @@ class Calendar(db.Model): return calendar @staticmethod - def updateCalendar(user_id, calendar_name, toggle=None, color=None): + def updateCalendar(user_id, calendar_id, toggle=None, color=None): - calendar = Calendar.query.filter(Calendar.usr_id==user_id, Calendar.name==calendar_name).first() + calendar = Calendar.query.filter(Calendar.usr_id==user_id, Calendar.calendar_id==calendar_id).first() - print("updating") + print("updating", flush=True) if(toggle != None): print(toggle) calendar.toggle = toggle diff --git a/server/routes.py b/server/routes.py index 49d5d6a..7d7e2cb 100644 --- a/server/routes.py +++ b/server/routes.py @@ -148,15 +148,17 @@ def downloader(user): @login_required def user(): if request.method == 'POST': - calName = request.json.get('calendar_id') - color = request.json.get('color') - toggle = request.json.get('toggle') + calId = request.json.get('calendar_id') + color = request.json.get('color', None) + toggle = request.json.get('toggle', None) + print(request.json, flush=True) if color != None: - Calendar.updateCalendar(current_user.id, calName, color=color) + Calendar.updateCalendar(current_user.id, calId, color=color) if toggle != None: - Calendar.updateCalendar(current_user.id, calName, toggle=toggle) + Calendar.updateCalendar(current_user.id, calId, toggle=toggle) # toggle specific calendar of user + elif request.method == 'DELETE': # do nothing return 'NONE' diff --git a/server/template/calendar.html b/server/template/calendar.html index 959e264..5bef014 100644 --- a/server/template/calendar.html +++ b/server/template/calendar.html @@ -17,14 +17,14 @@
-
+
@@ -73,7 +73,6 @@ ($(".colorPickSelector").each(function() { // console.log($( this )[0].attributes.getNamedItem("style")); - var color = $( this )[0].attributes.getNamedItem("defaultcolor").nodeValue; var style = document.createAttribute("style"); style.value = 'background-color: ' + color + '; color: ' + color + ';'; @@ -84,7 +83,7 @@ })); function post(type, id, data) { - var url = "https://192.168.68.103.xip.io:1234/calendar"; + var url = "calendar"; var method = "POST"; switch (type) { case "color": @@ -125,4 +124,4 @@ init = true; -{% endblock %} \ No newline at end of file +{% endblock %}