# HG changeset patch # User Teemu Piippo # Date 1502450893 -10800 # Node ID 428cfdf64ccc5a2701683b75d8df2da7a57f44c0 # Parent 18953691af299331db03d69dd5289c1e7fc3c318 Lisätty uudelleenohjauksia diff -r 18953691af29 -r 428cfdf64ccc service.py --- a/service.py Mon Jul 31 01:15:28 2017 +0300 +++ b/service.py Fri Aug 11 14:28:13 2017 +0300 @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -from flask import Flask, render_template, abort, send_from_directory +from flask import Flask, render_template, abort, send_from_directory, redirect from datetime import datetime, date, time, timedelta from os import path, listdir from configparser import ConfigParser @@ -77,7 +77,7 @@ def imminent(schedule_entry): return (schedule_entry['time'] - now()) <= timedelta(minutes = 3) -@app.route('/pysäkki/') +@app.route('/stop/') def bus_stop_schedule(reference): from buses import bus_stops schedule = [] @@ -120,7 +120,7 @@ with activate_locale(): return time.strftime('%-d.%-m. %H:%M').replace(' ', '\xa0') -@app.route('/pysäkkiryhmä/') +@app.route('/stop_cluster/') def cluster_schedule(cluster_name): from buses import bus_stops, clusters_by_name schedule = [] @@ -159,7 +159,7 @@ tr = tr, ) -@app.route('/ajovuoro/') +@app.route('/trip/') def trip(trip_reference): from flask import request from buses import all_trips @@ -205,7 +205,7 @@ length = trip.length / 1000, ) -@app.route('/linja/') +@app.route('/route/') def route_page(name): from buses import routes route = routes[name.upper()] @@ -224,6 +224,22 @@ schedule = schedule, ) +@app.route('/') +def index(): + return redirect('/stop_cluster/kauppatori') + +@app.route('/pysäkki/') +def redirect_pysäkki(reference): + return redirect('/stop/' + str(reference)) + +@app.route('/pysäkkiryhmä/') +def redirect_pysäkkiryhmä(reference): + return redirect('/stop_cluster/' + str(reference)) + +@app.route('/ajovuoro/') +def redirect_ajovuoro(reference): + return redirect('/trip/' + str(reference)) + @app.route('/static/') def static_file(path): return send_from_directory(path.join('static', path)) diff -r 18953691af29 -r 428cfdf64ccc templates/cluster.html --- a/templates/cluster.html Mon Jul 31 01:15:28 2017 +0300 +++ b/templates/cluster.html Fri Aug 11 14:28:13 2017 +0300 @@ -63,13 +63,13 @@ {{halt['time']}} - {{halt['route']}} + {{halt['route']}} - {{halt['sign']}} + {{halt['sign']}} - {{halt['stop_code']}} + {{halt['stop_code']}} {% endfor %} diff -r 18953691af29 -r 428cfdf64ccc templates/route.html --- a/templates/route.html Mon Jul 31 01:15:28 2017 +0300 +++ b/templates/route.html Fri Aug 11 14:28:13 2017 +0300 @@ -18,9 +18,9 @@ {% for trip in schedule %} {{trip['time']}} - {{trip['from']}} - {{trip['to']}} - {{trip['status']}} + {{trip['from']}} + {{trip['to']}} + {{trip['status']}} {% endfor %} diff -r 18953691af29 -r 428cfdf64ccc templates/stop.html --- a/templates/stop.html Mon Jul 31 01:15:28 2017 +0300 +++ b/templates/stop.html Fri Aug 11 14:28:13 2017 +0300 @@ -30,7 +30,7 @@

{% if cluster %}

- {{tr('nearby-area-schedule', 'misc-text')}} + {{tr('nearby-area-schedule', 'misc-text')}}

{% endif %} @@ -47,10 +47,10 @@ {% endif %} {{halt['time']}} {% endfor %} diff -r 18953691af29 -r 428cfdf64ccc templates/trip.html --- a/templates/trip.html Mon Jul 31 01:15:28 2017 +0300 +++ b/templates/trip.html Fri Aug 11 14:28:13 2017 +0300 @@ -67,8 +67,8 @@ {% for halt in entry['stops'] %} - - + + {% endfor %}
- {{halt['route']}} + {{halt['route']}} - {{halt['sign']}} + {{halt['sign']}}
{{halt['time']}} {{halt['code']}}{{halt['name']}} {{halt['code']}}{{halt['name']}}