From 344763fc1df4949ab2ab4a93498586c5ba4dedb1 Mon Sep 17 00:00:00 2001 From: Andrei Date: Tue, 1 Nov 2022 14:06:28 +0500 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B0=20?= =?UTF-8?q?=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8=D1=8F=20JS=20=D1=84?= =?UTF-8?q?=D0=B0=D0=B9=D0=BB=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 20 +++++++++++++------- static/css/safe_app_school/route.css | 3 +++ templates/safe_app_school/base.html | 2 +- templates/safe_app_school/route.html | 2 +- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/main.py b/main.py index 13e5f5b..0aa5388 100644 --- a/main.py +++ b/main.py @@ -41,7 +41,8 @@ user_email = "" def remove_java(): - os.remove('static/js/safe_app_school/mapbasics.js') + global help_arg + os.remove(help_arg) def norm_data(datatime, date_or_time, r=False): @@ -312,6 +313,7 @@ def safe_app_school_setting(): @app.route('/safeappschool/go/') def safe_app_school_go(point): + global help_arg if current_user.is_authenticated: data_session = db_session.create_session() address = data_session.query(UserPoint).filter(UserPoint.user == current_user.id).first() @@ -320,20 +322,24 @@ def safe_app_school_go(point): with open('static/js/safe_app_school/mapbasics_templates.js', 'r', encoding='utf-8') as file: new_file = file.read().split('') new_file = new_file[ - 0] + f'\'{address.home_address if point == "home" else address.school_address}\'' \ + 0] + f'\'{str(address.home_address).strip() if point == "home" else str(address.school_address).strip()}\'' \ + new_file[1] new_file = new_file.split('') new_file = new_file[ - 0] + f'\'{address.school_address if point == "home" else address.home_address}\'' + \ + 0] + f'\'{str(address.school_address).strip() if point == "home" else str(address.home_address).strip()}\'' + \ new_file[1] - with open('static/js/safe_app_school/mapbasics.js', 'w', encoding='utf-8') as new_js: + with open(f'static/js/safe_app_school/{str(current_user.id)}mapbasics.js', 'w', + encoding='utf-8') as new_js: new_js.write(new_file) - t = Timer(1, remove_java, args=None, kwargs=None) + help_arg = f'static/js/safe_app_school/{str(current_user.id)}mapbasics.js' + t = Timer(15, remove_java, args=None, kwargs=None) t.start() if point == 'home': - return render_template('safe_app_school/route.html', title='Маршрут домой', route='домой') + return render_template('safe_app_school/route.html', title='Маршрут домой', route='домой', + path=help_arg) elif point == 'school': - return render_template('safe_app_school/route.html', title='Маршрут в школу', route='в школу') + return render_template('safe_app_school/route.html', title='Маршрут в школу', route='в школу', + path=help_arg) else: return redirect('/safe_app_school/main') else: diff --git a/static/css/safe_app_school/route.css b/static/css/safe_app_school/route.css index 23ef9f5..52221b7 100644 --- a/static/css/safe_app_school/route.css +++ b/static/css/safe_app_school/route.css @@ -43,4 +43,7 @@ .header_button_text { text-align: center; color: #ffffff; +} +body { + margin-bottom: 10%; } \ No newline at end of file diff --git a/templates/safe_app_school/base.html b/templates/safe_app_school/base.html index 6f9d88e..f953a33 100644 --- a/templates/safe_app_school/base.html +++ b/templates/safe_app_school/base.html @@ -18,7 +18,7 @@ --> - +