diff --git a/mobile/templates/mobile/home.html b/mobile/templates/mobile/home.html index a24ccee..a96537e 100644 --- a/mobile/templates/mobile/home.html +++ b/mobile/templates/mobile/home.html @@ -126,12 +126,12 @@ {% endif %} - {% if news_items %} -
-
- {% trans "Club news" %} - {% trans "All news" %} -
+
+
+ {% trans "Club news" %} + {% trans "All news" %} +
+ {% if news_items %} {% with lead=news_items.0 %}
{% trans "News photo" %}
@@ -156,10 +156,14 @@ {% endfor %}
{% endif %} -
- {% endif %} + {% else %} +
+

{% trans "No news yet." %}

+
+ {% endif %} + - {% if not hero_attendance and not needs_answer and not dues_rows and not news_items %} + {% if not hero_attendance and not needs_answer and not dues_rows %}

{% trans "Nothing to show right now." %}

diff --git a/mobile/tests.py b/mobile/tests.py index ab8ad5f..bd076e0 100644 --- a/mobile/tests.py +++ b/mobile/tests.py @@ -326,6 +326,15 @@ class HomeViewTests(TestCase): self.assertEqual(list(response.context["news_items"]), []) + def test_news_card_shows_an_empty_state_with_a_link_to_all_news_when_there_is_none(self): + self.client.force_login(self.user) + + response = self._get("home") + + self.assertEqual(list(response.context["news_items"]), []) + self.assertContains(response, "No news yet.") + self.assertContains(response, 'href="/app/news/"') + def test_empty_account_gets_a_graceful_empty_state(self): bare_user = User.objects.create_user(email="new@example.com", password="pw-secret-123") self.client.force_login(bare_user)