diff --git a/templates/index.html b/templates/index.html index fd66154..5dcf8c3 100644 --- a/templates/index.html +++ b/templates/index.html @@ -188,52 +188,6 @@ {% endif %} {% endfor %} -

Space launches

- {% for launch in rockets %} -
-
{{ launch.t0_date }} - -
- {% if launch.t0_time %} - {{ launch.t0_time }}{% endif %} - {{ launch.net_precision }} -
-
- launch status: - {{ launch.status.abbrev }} -
-
{{ launch.rocket }} - – - {{launch.mission.name }} - – - - {% if launch.launch_provider_abbrev %} - {{ launch.launch_provider_abbrev }} - {% else %} - {{ launch.launch_provider }} - {% endif %} - ({{ launch.launch_provider_type }}) - — - {{ launch.orbit.name }} ({{ launch.orbit.abbrev }}) -
- {% if launch.pad_wikipedia_url %} - {{ launch.pad_name }} - {% else %} - {{ launch.pad_name }} {% if launch.pad_name != "Unknown Pad" %}(no Wikipedia article){% endif %} - {% endif %} - — {{ launch.location }}
- - {% if launch.mission %} - {% for line in launch.mission.description.splitlines() %} -

{{ line }}

- {% endfor %} - {% else %} -

No description.

- {% endif %} - -
-
- {% endfor %} diff --git a/templates/launches.html b/templates/launches.html new file mode 100644 index 0000000..c048d5e --- /dev/null +++ b/templates/launches.html @@ -0,0 +1,53 @@ +{% extends "base.html" %} + +{% block content %} +
+

Space launches

+ + {% for launch in rockets %} +
+
{{ launch.t0_date }} + +
+ {% if launch.t0_time %} + {{ launch.t0_time }}{% endif %} + {{ launch.net_precision }} +
+
+ launch status: + {{ launch.status.abbrev }} +
+
{{ launch.rocket }} + – + {{launch.mission.name }} + – + + {% if launch.launch_provider_abbrev %} + {{ launch.launch_provider_abbrev }} + {% else %} + {{ launch.launch_provider }} + {% endif %} + ({{ launch.launch_provider_type }}) + — + {{ launch.orbit.name }} ({{ launch.orbit.abbrev }}) +
+ {% if launch.pad_wikipedia_url %} + {{ launch.pad_name }} + {% else %} + {{ launch.pad_name }} {% if launch.pad_name != "Unknown Pad" %}(no Wikipedia article){% endif %} + {% endif %} + — {{ launch.location }}
+ + {% if launch.mission %} + {% for line in launch.mission.description.splitlines() %} +

{{ line }}

+ {% endfor %} + {% else %} +

No description.

+ {% endif %} + +
+
+ {% endfor %} +
+{% endblock %} diff --git a/templates/navbar.html b/templates/navbar.html index 2f7c4b9..444fa14 100644 --- a/templates/navbar.html +++ b/templates/navbar.html @@ -6,6 +6,7 @@ {"endpoint": "travel_list", "label": "Travel" }, {"endpoint": "accommodation_list", "label": "Accommodation" }, {"endpoint": "gaps_page", "label": "Gaps" }, + {"endpoint": "launch_list", "label": "Space launches" }, ] %} diff --git a/web_view.py b/web_view.py index 86db0a2..0a31d2e 100755 --- a/web_view.py +++ b/web_view.py @@ -16,6 +16,7 @@ import yaml import agenda.data import agenda.error_mail +import agenda.thespacedevs import agenda.travel app = flask.Flask(__name__) @@ -61,6 +62,17 @@ async def index() -> str: return flask.render_template("index.html", today=now.date(), **data) +@app.route("/launches") +async def launch_list() -> str: + """Web page showing List of space launches.""" + now = datetime.now() + data_dir = app.config["DATA_DIR"] + rocket_dir = os.path.join(data_dir, "thespacedevs") + rockets = await agenda.thespacedevs.get_launches(rocket_dir, limit=100) + + return flask.render_template("launches.html", rockets=rockets, now=now) + + @app.route("/gaps") async def gaps_page() -> str: """List of available gaps."""