From f9e08bd1b8aa168a49b741f155c39c9320d75127 Mon Sep 17 00:00:00 2001 From: Arnold Kochari Date: Tue, 26 Nov 2024 09:28:03 +0100 Subject: [PATCH] SS-1213 Combine recently updated and created apps into one list on the homepage (#254) --- portal/views.py | 22 +++-------------- templates/portal/home.html | 50 ++++++++------------------------------ 2 files changed, 14 insertions(+), 58 deletions(-) diff --git a/portal/views.py b/portal/views.py index be0c18f6..0f3353e5 100644 --- a/portal/views.py +++ b/portal/views.py @@ -150,24 +150,11 @@ class HomeView(View): template = "portal/home.html" def get(self, request, app_id=0): - all_published_apps_created_on, request = get_public_apps( - request, app_id=app_id, order_by="created_on", order_reverse=True - ) - all_published_apps_updated_on, request = get_public_apps( + published_apps_updated_on, request = get_public_apps( request, app_id=app_id, order_by="updated_on", order_reverse=True - ) - - # Make sure we don't have the same apps displayed in both Recently updated and Recently added fields - published_apps_created_on = [ - app for app in all_published_apps_created_on if app.updated_on <= (app.created_on + timedelta(minutes=60)) - ][ - :3 - ] # we display only 3 apps - published_apps_updated_on = [ - app for app in all_published_apps_updated_on if app.updated_on > (app.created_on + timedelta(minutes=60)) - ][ - :3 - ] # we display only 3 apps + )[ + :6 + ] # we display only 6 apps news_objects = NewsObject.objects.all().order_by("-created_on") link_all_news = False @@ -200,7 +187,6 @@ def get(self, request, app_id=0): context = { "published_apps_updated_on": published_apps_updated_on, - "published_apps_created_on": published_apps_created_on, "news_objects": news_objects, "link_all_news": link_all_news, "collection_objects": collection_objects, diff --git a/templates/portal/home.html b/templates/portal/home.html index b615578c..feff80fa 100644 --- a/templates/portal/home.html +++ b/templates/portal/home.html @@ -65,47 +65,12 @@
Development environments

Recent updates

+
+ {% for app in published_apps_updated_on %}
-
Recently updated
-
- {% for app in published_apps_updated_on %} -
-
-
- -
{{ app.name|truncatechars:30 }}
-
-
- {% static 'images/logos/apps/' as static_url %} - App Logo -
-
-
- {{ app.description|truncatechars:100 }} -
-
- - -
- {% endfor %} -
- -