From 342ef34cabd9d3c398d28ad7ce72f3652e7856e7 Mon Sep 17 00:00:00 2001 From: Markus Graf Date: Fri, 17 Oct 2025 15:19:49 +0200 Subject: [PATCH] Fix url_for references and improve navigation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issues fixed: - Fixed base.html to use url_for('landing.index') instead of url_for('index') - Fixed error_403.html and error_404.html to use correct landing page endpoint - Added Dashboard link in base.html nav for product owners - Removed obsolete templates/index.html (replaced by landing page) - Added dashboard link in landing/index.html for authenticated product owners - Added test to verify landing page renders correctly with proper url_for references All 8 landing page tests passing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/templates/base.html | 4 ++-- app/templates/error_403.html | 2 +- app/templates/error_404.html | 2 +- app/templates/index.html | 22 ---------------------- app/templates/landing/index.html | 10 ++++++++++ tests/contract/test_landing_routes.py | 16 ++++++++++++++++ 6 files changed, 30 insertions(+), 26 deletions(-) delete mode 100644 app/templates/index.html diff --git a/app/templates/base.html b/app/templates/base.html index c6e3fb9..ede1194 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -189,9 +189,9 @@
{% if current_user and current_user.is_authenticated %} {% endblock %} diff --git a/app/templates/error_404.html b/app/templates/error_404.html index 43ac8d8..f7c8852 100644 --- a/app/templates/error_404.html +++ b/app/templates/error_404.html @@ -8,7 +8,7 @@

The page or resource you requested could not be found.

Return to Dashboard | - Go to Home + Go to Home

{% endblock %} diff --git a/app/templates/index.html b/app/templates/index.html deleted file mode 100644 index d561129..0000000 --- a/app/templates/index.html +++ /dev/null @@ -1,22 +0,0 @@ -{% extends "base.html" %} - -{% block title %}Welcome - Reklamator{% endblock %} - -{% block content %} -
-

Reklamator

-

- Anonymous Feedback Platform -

- -
-

Submit Feedback

-

If you have a product-specific submission link, use it to submit your feedback anonymously.

- -

Product Owners & Administrators

-

- Login to Dashboard -

-
-
-{% endblock %} diff --git a/app/templates/landing/index.html b/app/templates/landing/index.html index 5b34c1a..d7a4cfa 100644 --- a/app/templates/landing/index.html +++ b/app/templates/landing/index.html @@ -8,6 +8,16 @@ {% if products %}

Select a product to share your feedback, report issues, or suggest improvements.

+ {% if current_user and current_user.is_authenticated and current_user.role == 'product_owner' %} +
+

+ Product Owner: + Go to Dashboard + to view and analyze feedback. +

+
+ {% endif %} +
{% for product in products %}
diff --git a/tests/contract/test_landing_routes.py b/tests/contract/test_landing_routes.py index 3d979b8..57a1dc7 100644 --- a/tests/contract/test_landing_routes.py +++ b/tests/contract/test_landing_routes.py @@ -164,3 +164,19 @@ def test_get_landing_page_missing_slug(client, test_products): assert b'No Slug Product' not in response.data # But other active products should appear assert b'Apple Product' in response.data + + +@pytest.mark.contract +def test_landing_page_with_authenticated_user_renders_correctly(client, test_products, app): + """Test that landing page renders correctly - verifies url_for('landing.index') works + + This test verifies that the base.html template references url_for('landing.index') + instead of url_for('index'), which would cause a BuildError. + """ + # Just access the landing page - if url_for references are broken, this will fail + response = client.get('/') + + assert response.status_code == 200 + # Should contain products (proving the page rendered successfully) + assert b'Apple Product' in response.data + assert b'Zebra Product' in response.data