Repository: rclement/datasette-dashboards (language: python)

Issue:
Fix menu not showing in plugin pages
The top-right menu bar is not showing in the plugin pages:

- `dashboard_list.html`
- `dashboard_view.html`
- `dashboard_chart.html`

The issue seems to come from a misuse of the `nav` template block instead of `crumbs`.


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml
index 5ccabfa..3ae5dac 100644
--- a/.github/workflows/ci-cd.yml
+++ b/.github/workflows/ci-cd.yml
@@ -67,8 +67,8 @@ jobs:
         run: echo "DEPLOYMENT_URL=https://${DEMO_BASE_URL_PRODUCTION}" >> ${GITHUB_ENV}
       - id: output_step
         run: |
-          echo "::set-output name=github_ref_slug::${GITHUB_REF_SLUG_URL}"
-          echo "::set-output name=deployment_url::${DEPLOYMENT_URL}"
+          echo "github_ref_slug=${GITHUB_REF_SLUG_URL}" >> $GITHUB_OUTPUT
+          echo "deployment_url=${DEPLOYMENT_URL}" >> $GITHUB_OUTPUT
 
   deploy-demo-preview:
     runs-on: ubuntu-latest
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d4be18f..a97c65d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - Improve filters layout
 - Embed external static assets for Vega, Vega-Lite and Vega-Embed
 
+### Fixed
+- Menu not showing in plugin pages
+
 ## [0.3.0] - 2023-03-14
 ### Added
 - Select filter type with static and dynamic values
diff --git a/datasette_dashboards/templates/dashboard_chart.html b/datasette_dashboards/templates/dashboard_chart.html
index f49b86b..d8d8d4c 100644
--- a/datasette_dashboards/templates/dashboard_chart.html
+++ b/datasette_dashboards/templates/dashboard_chart.html
@@ -8,7 +8,7 @@
 <link href="{{ urls.static_plugins('datasette_dashboards', 'dashboards.css') }}" rel="stylesheet"/>
 {% endblock %}
 
-{% block nav %}
+{% block crumbs %}
     <p class="crumbs">
         <a href="{{ urls.instance() }}">home</a> /
         <a href="{{ urls.path('-/dashboards') }}">dashboards</a> /
diff --git a/datasette_dashboards/templates/dashboard_list.html b/datasette_dashboards/templates/dashboard_list.html
index ad47399..70bf455 100644
--- a/datasette_dashboards/templates/dashboard_list.html
+++ b/datasette_dashboards/templates/dashboard_list.html
@@ -2,7 +2,7 @@
 
 {% block title %}Dashboards{% endblock %}
 
-{% block nav %}
+{% block crumbs %}
     <p class="crumbs">
         <a href="{{ urls.instance() }}">home</a>
     </p>
diff --git a/datasette_dashboards/templates/dashboard_view.html b/datasette_dashboards/templates/dashboard_view.html
index 1e29c2c..25f3c46 100644
--- a/datasette_dashboards/templates/dashboard_view.html
+++ b/datasette_dashboards/templates/dashboard_view.html
@@ -27,7 +27,7 @@
 </style>
 {% endblock %}
 
-{% block nav %}
+{% block crumbs %}
     <p class="crumbs">
         <a href="{{ urls.instance() }}">home</a> /
         <a href="{{ urls.path('-/dashboards') }}">dashboards</a>


Test patch:
diff --git a/tests/test_dashboard_chart.py b/tests/test_dashboard_chart.py
index 01c89ef..670a5d2 100644
--- a/tests/test_dashboard_chart.py
+++ b/tests/test_dashboard_chart.py
@@ -9,6 +9,7 @@ async def test_dashboard_chart(datasette):
             props = chart.keys()
             response = await datasette.client.get(f"/-/dashboards/{slug}/{chart_slug}")
             assert response.status_code == 200
+            assert '<li><a href="/-/dashboards">Dashboards</a></li>' in response.text
             assert f'<h1>{dashboard["title"]}</h1>' in response.text
             if "title" in props:
                 assert f'<p>{chart["title"]}</p>' in response.text
diff --git a/tests/test_dashboard_list.py b/tests/test_dashboard_list.py
index 8241abe..46181d4 100644
--- a/tests/test_dashboard_list.py
+++ b/tests/test_dashboard_list.py
@@ -8,6 +8,7 @@
 async def test_dashboard_list_index(datasette):
     response = await datasette.client.get("/-/dashboards")
     assert response.status_code == 200
+    assert '<li><a href="/-/dashboards">Dashboards</a></li>' in response.text
     assert "<h1>Dashboards</h1>" in response.text
 
     dashboards = datasette._metadata["plugins"]["datasette-dashboards"]
diff --git a/tests/test_dashboard_view.py b/tests/test_dashboard_view.py
index d2283ee..309d254 100644
--- a/tests/test_dashboard_view.py
+++ b/tests/test_dashboard_view.py
@@ -12,6 +12,7 @@ async def test_dashboard_views(datasette):
             f"/-/dashboards/{slug}", follow_redirects=True
         )
         assert response.status_code == 200
+        assert '<li><a href="/-/dashboards">Dashboards</a></li>' in response.text
         assert f'<h1>{dashboard["title"]}</h1>' in response.text
         assert f'<p>{dashboard["description"]}</p>' in response.text
         assert "grid-template-columns: repeat(2, 1fr);" in response.text