view weather_server/templates/index.html @ 26:7def5611895b

Add support for an index page displaying all locations. This seems as good a time as any to declare 0.1.0.
author Paul Fisher <paul@pfish.zone>
date Sun, 10 Nov 2019 23:46:51 -0500
parents
children 99b0759386b1
line wrap: on
line source

<!doctype html>
<html>
    <head>
        <title>The Weather In Places</title>
        <link
            rel="stylesheet"
            href="{{ url_for('static', filename='style.css') }}">
        <link
            rel="shortcut icon"
            href="{{ url_for('static', filename='thermometer.png') }}">
    </head>
    <body class="home">
        <h1><span>Weather</span></h1>
        <ul>
            {% for location in locations %}
            <li>
                <a href="{{ url_for('show', location=location.key) }}">
                    <b>{{ location.name }}</b>
                    <span>
                        {%- set reading = location.latest() -%}
                        {%- if reading -%}
                            {{ reading.temp_f|round|int -}}
                            &nbsp;°F
                        {%- else -%}
                            ???
                        {%- endif -%}
                    </span>
                </a>
            </li>
            {% endfor %}
        </ul>
    </body>
</html>